mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-11 18:00:22 +01:00
build: work around GCC -Wlogical-op for "nm_utils_is_power_of_two" macros
We recently added -Wlogical-op in our build process (commit #41e7fca59762dc928c9d67b555b1409c3477b2b0). Seems that old versions of gcc (4.8.x) will hit that warning with our implementation of our "nm_utils_is_power_of_two" and "test_nm_utils_is_power_of_two_do" macros. Fool it just adding an always TRUE check.
This commit is contained in:
parent
6389d637a7
commit
7c2ecaa4e0
2 changed files with 3 additions and 3 deletions
|
|
@ -4942,10 +4942,10 @@ enum TEST_IS_POWER_OF_TWP_ENUM_UNSIGNED_64 {
|
|||
typeof (x) x1 = (x); \
|
||||
type x2 = (type) x1; \
|
||||
\
|
||||
if (((typeof (x1)) x2) == x1 && (x2 > 0 || x2 == 0)) { \
|
||||
if (((typeof (x1)) x2) == x1 && (x2 > 0 || (x2 == 0 && 1))) { \
|
||||
/* x2 equals @x, and is positive. Compare to @expect */ \
|
||||
g_assert_cmpint (expect, ==, nm_utils_is_power_of_two (x2)); \
|
||||
} else if (!(x2 > 0) && !(x2 == 0)) { \
|
||||
} else if (!(x2 > 0) && (!(x2 == 0) && 1)) { \
|
||||
/* a (signed) negative value is always FALSE. */ \
|
||||
g_assert_cmpint (FALSE, ==, nm_utils_is_power_of_two (x2));\
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -644,7 +644,7 @@ nm_clear_g_cancellable (GCancellable **cancellable)
|
|||
* the type is signed. The second expression is a clumsy way for (__x >= 0),
|
||||
* which otherwise causes a compiler warning for unsigned types. */ \
|
||||
( (((typeof(__x)) -1) > ((typeof(__x)) 0)) \
|
||||
|| (__x > 0 || __x == 0) ) \
|
||||
|| (__x > 0 || (__x == 0 && 1)) ) \
|
||||
&& ((__x & (__x - 1)) == 0); \
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue