mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-27 05:30:42 +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.
(cherry picked from commit 7c2ecaa4e0)
This commit is contained in:
parent
4b6955095b
commit
4f45f04d0f
2 changed files with 3 additions and 3 deletions
|
|
@ -4867,10 +4867,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));\
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -619,7 +619,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