systemd: workaround gcc warning about LOG2ULL() by disabling code

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);
                    ^
This commit is contained in:
Thomas Haller 2022-02-04 13:32:28 +01:00
parent 18cb8205b3
commit a16b380d32
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 4 additions and 0 deletions

View file

@ -4194,6 +4194,7 @@ _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;
@ -4273,6 +4274,7 @@ _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);

View file

@ -20,6 +20,7 @@ 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)
@ -36,6 +37,7 @@ static inline unsigned log2u64(uint64_t x) {
# error "Wut?"
#endif
}
#endif /* NM_IGNORED */
static inline unsigned u32ctz(uint32_t n) {
#if __SIZEOF_INT__ == 4