mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 18:40:09 +01:00
std-aux: fix NM_LIKELY()/NM_UNLIKELY() macros
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: 030d68aef7 ('shared: add nm_assert() to "nm-std-aux.h"')
(cherry picked from commit 8bd72d5f2e)
This commit is contained in:
parent
de7696789e
commit
3fd8116646
1 changed files with 2 additions and 2 deletions
|
|
@ -170,8 +170,8 @@ typedef uint64_t _nm_bitwise nm_be64_t;
|
|||
#define NM_LIKELY(expr) (__builtin_expect(NM_BOOLEAN_EXPR(expr), 1))
|
||||
#define NM_UNLIKELY(expr) (__builtin_expect(NM_BOOLEAN_EXPR(expr), 0))
|
||||
#else
|
||||
#define NM_LIKELY(expr) NM_BOOLEAN_EXPR(expr)
|
||||
#define NM_UNLIKELY(expr) NM_BOOLEAN_EXPR(expr)
|
||||
#define NM_LIKELY(expr) (NM_BOOLEAN_EXPR(expr))
|
||||
#define NM_UNLIKELY(expr) (NM_BOOLEAN_EXPR(expr))
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue