mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-24 12:10:24 +01:00
Fix this compile error when "defined(__GNUC__) && (__GNUC__ > 2) &&
defined(__OPTIMIZE__)" doesn't match:
In file included from ../src/libnm-std-aux/nm-default-std.h:102,
from ../src/libnm-std-aux/nm-std-utils.c:3:
../src/libnm-std-aux/nm-std-aux.h: In function ‘NM_ALIGN_TO’:
../src/libnm-std-aux/nm-std-aux.h:160:6: error: expected expression before ‘{’ token
160 | ({ \
| ^
../src/libnm-std-aux/nm-std-aux.h:169:31: note: in expansion of macro ‘_NM_BOOLEAN_EXPR_IMPL’
169 | #define NM_BOOLEAN_EXPR(expr) _NM_BOOLEAN_EXPR_IMPL(NM_UNIQ, expr)
| ^~~~~~~~~~~~~~~~~~~~~
../src/libnm-std-aux/nm-std-aux.h:175:27: note: in expansion of macro ‘NM_BOOLEAN_EXPR’
175 | #define NM_LIKELY(expr) NM_BOOLEAN_EXPR(expr)
| ^~~~~~~~~~~~~~~
../src/libnm-std-aux/nm-std-aux.h:238:19: note: in expansion of macro ‘NM_LIKELY’
238 | } else if NM_LIKELY (cond) { \
| ^~~~~~~~~
../src/libnm-std-aux/nm-std-aux.h:449:5: note: in expansion of macro ‘nm_assert’
449 | nm_assert(nm_utils_is_power_of_two(ali));
| ^~~~~~~~~
Fixes:
|
||
|---|---|---|
| .. | ||
| c-list-util.c | ||
| c-list-util.h | ||
| meson.build | ||
| nm-dbus-compat.h | ||
| nm-default-std.h | ||
| nm-linux-compat.h | ||
| nm-networkmanager-compilation.h | ||
| nm-std-aux.h | ||
| nm-std-utils.c | ||
| nm-std-utils.h | ||
| README.md | ||
| unaligned.h | ||
libnm-std-aux
A static helper library with general purpose helpers on top of standard C (C11).
As this has no additional dependencies, we should have all our C code use this internal helper library. It contains helpers that should be available (and used) everywhere where we write C.
Our C is gnu11, that is C11 or newer with some GCC-ism. The requirement is that it is supported by all complilers we care about (in pratice GCC and Clang).
Parts of this library are usually already included via the nm-default*.h
headers.