diff options
author | Thomas Haller <thaller@redhat.com> | 2022-02-04 13:32:28 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-02-04 16:30:02 +0100 |
commit | f16d027eb8d76613de7617304090157a604610e0 (patch) | |
tree | 2c6cab50e74503e6b234dd16dcdba06b5f52a8a9 | |
parent | c8ba636d0ed40f1dcd05732f19a03ca2dc32122a (diff) | |
download | NetworkManager-f16d027eb8d76613de7617304090157a604610e0.tar.gz |
systemd: workaround gcc warning about LOG2ULL() by disabling code (2)
gcc-4.8.5-44.el7.x86_64 warns:
In file included from ./src/libnm-systemd-shared/src/basic/hashmap.h:10:0,
from ./src/libnm-systemd-shared/src/shared/dns-domain.h:10,
from src/libnm-systemd-shared/nm-sd-utils-shared.c:12:
./src/libnm-systemd-shared/src/basic/util.h: In function 'log2u64':
./src/libnm-systemd-shared/src/basic/util.h:30:20: error: first argument to '__builtin_choose_expr' not a constant
#define LOG2ULL(x) __builtin_choose_expr(__builtin_constant_p(x), CONST_LOG2ULL(x), NONCONST_LOG2ULL(x))
^
./src/libnm-systemd-shared/src/basic/util.h:34:16: note: in expansion of macro 'LOG2ULL'
return LOG2ULL(x);
^
./src/libnm-systemd-shared/src/basic/util.h: In function 'log2i':
./src/libnm-systemd-shared/src/basic/util.h:53:18: error: first argument to '__builtin_choose_expr' not a constant
#define LOG2U(x) __builtin_choose_expr(__builtin_constant_p(x), CONST_LOG2U(x), NONCONST_LOG2U(x))
^
./src/libnm-systemd-shared/src/basic/util.h:56:16: note: in expansion of macro 'LOG2U'
return LOG2U(x);
^
./src/libnm-systemd-shared/src/basic/util.h: In function 'log2u':
./src/libnm-systemd-shared/src/basic/util.h:53:18: error: first argument to '__builtin_choose_expr' not a constant
#define LOG2U(x) __builtin_choose_expr(__builtin_constant_p(x), CONST_LOG2U(x), NONCONST_LOG2U(x))
^
./src/libnm-systemd-shared/src/basic/util.h:60:16: note: in expansion of macro 'LOG2U'
return LOG2U(x);
^
-rw-r--r-- | src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c | 2 | ||||
-rw-r--r-- | src/libnm-systemd-shared/src/basic/util.h | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c b/src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c index 8db8a778a6..e87d900c4a 100644 --- a/src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c +++ b/src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c @@ -4194,7 +4194,6 @@ _public_ int sd_event_dispatch(sd_event *e) { return 1; } -#if 0 /* NM_IGNORED */ static void event_log_delays(sd_event *e) { char b[ELEMENTSOF(e->delays) * DECIMAL_STR_MAX(unsigned) + 1], *p; size_t l, i; @@ -4274,7 +4273,6 @@ _public_ int sd_event_loop(sd_event *e) { return e->exit_code; } -#endif /* NM_IGNORED */ _public_ int sd_event_get_fd(sd_event *e) { assert_return(e, -EINVAL); diff --git a/src/libnm-systemd-shared/src/basic/util.h b/src/libnm-systemd-shared/src/basic/util.h index 7a745a891d..dd1cb4f37e 100644 --- a/src/libnm-systemd-shared/src/basic/util.h +++ b/src/libnm-systemd-shared/src/basic/util.h @@ -20,7 +20,6 @@ int prot_from_flags(int flags) _const_; bool in_initrd(void); void in_initrd_force(bool value); -#if 0 /* NM_IGNORED */ /* Note: log2(0) == log2(1) == 0 here and below. */ #define CONST_LOG2ULL(x) ((x) > 1 ? (unsigned) __builtin_clzll(x) ^ 63U : 0) @@ -28,7 +27,11 @@ void in_initrd_force(bool value); unsigned long long _x = (x); \ _x > 1 ? (unsigned) __builtin_clzll(_x) ^ 63U : 0; \ }) +#if 0 /* NM_IGNORED */ #define LOG2ULL(x) __builtin_choose_expr(__builtin_constant_p(x), CONST_LOG2ULL(x), NONCONST_LOG2ULL(x)) +#else /* NM_IGNORED */ +#define LOG2ULL(x) NONCONST_LOG2ULL(x) +#endif /* NM_IGNORED */ static inline unsigned log2u64(uint64_t x) { #if __SIZEOF_LONG_LONG__ == 8 @@ -37,7 +40,6 @@ static inline unsigned log2u64(uint64_t x) { # error "Wut?" #endif } -#endif /* NM_IGNORED */ static inline unsigned u32ctz(uint32_t n) { #if __SIZEOF_INT__ == 4 @@ -52,7 +54,11 @@ static inline unsigned u32ctz(uint32_t n) { unsigned _x = (x); \ _x > 1 ? __SIZEOF_INT__ * 8 - __builtin_clz(_x) - 1 : 0; \ }) +#if 0 /* NM_IGNORED */ #define LOG2U(x) __builtin_choose_expr(__builtin_constant_p(x), CONST_LOG2U(x), NONCONST_LOG2U(x)) +#else /* NM_IGNORED */ +#define LOG2U(x) NONCONST_LOG2U(x) +#endif /* NM_IGNORED */ static inline unsigned log2i(int x) { return LOG2U(x); |