platform: workaround build error in nm_platform_ip4_route_hash_update() with old clang

clang-3.4.2-9.el7 does not like nesting NM_MAX() macro inside nm_hash_update_vals() macro.
Workaround by using MAX() instead. NM_MAX() uses an expression statement and NM_UNIQ()
to evaluate the arguments only once. We don't need that here and glib's MAX() suffices.

    CC       src/libnm-platform/src_libnm_platform_libnm_platform_la-nm-platform.lo
  ../src/libnm-platform/nm-platform.c:8247:53: error: in-class initializer for static data member is not a constant expression
                                      (guint8) NM_MAX(obj->weight, 1u));
                                                      ^
  ../src/libnm-std-aux/nm-std-aux.h:399:40: note: expanded from macro 'NM_MAX'
  #define NM_MAX(a, b) __NM_MAX(NM_UNIQ, a, NM_UNIQ, b)
                                         ^
  ../src/libnm-std-aux/nm-std-aux.h:402:39: note: expanded from macro '__NM_MAX'
          typeof(a) NM_UNIQ_T(A, aq) = (a);                                              \
                                        ^
  ../src/libnm-glib-aux/nm-hash-utils.h:124:36: note: expanded from macro 'nm_hash_update_vals'
          NM_HASH_COMBINE_VALS(_val, __VA_ARGS__);      \
                                     ^

Fixes: 8cc41d41fe ('platform: add NM_PLATFORM_IP_ROUTE_CMP_TYPE_ECMP_ID for comparing ECMP base route')
This commit is contained in:
Thomas Haller 2022-11-23 13:52:11 +01:00
parent 0be1b4d95d
commit 2afadee27f
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -8244,7 +8244,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
obj->ifindex,
nm_platform_ip4_route_get_n_nexthops(obj),
obj->gateway,
(guint8) NM_MAX(obj->weight, 1u));
(guint8) MAX(obj->weight, 1u));
}
}
break;
@ -8259,7 +8259,7 @@ nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj,
obj->metric,
nm_platform_ip4_route_get_n_nexthops(obj),
obj->gateway,
(guint8) NM_MAX(obj->weight, 1u),
(guint8) MAX(obj->weight, 1u),
nmp_utils_ip_config_source_round_trip_rtprot(obj->rt_source),
_ip_route_scope_inv_get_normalized(obj),
obj->tos,