diff options
author | Thomas Haller <thaller@redhat.com> | 2020-02-21 15:15:12 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-02-21 18:27:40 +0100 |
commit | c437d6c60a1d2b051c6e8b4c5a236ea0d11522ba (patch) | |
tree | 4697cc766ffa9a8947d0f0f09db8ea14b2c84102 | |
parent | 86dfc4b099fd686e0fc70cd63bde9871dcf0ee43 (diff) | |
download | NetworkManager-c437d6c60a1d2b051c6e8b4c5a236ea0d11522ba.tar.gz |
libnm-core/tests: avoid -Wstring-compare in unit test for NM_IN_SET()
Clang 10 doesn't like NM_IN_SET() with strings and is right about that:
../libnm-core/tests/test-general.c:7763:9: error: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Werror,-Wstring-compare]
(void) NM_IN_SET ("a", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
However, NM_IN_STRSET() should work.
-rw-r--r-- | libnm-core/tests/test-general.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index 88ca93f95d..532e2c2449 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -7760,7 +7760,7 @@ test_nm_in_set (void) _ASSERT (5, NM_IN_SET_SE (-1, G( 1), G( 2), G( 3), G(-1), G( 5))); _ASSERT (6, NM_IN_SET_SE (-1, G( 1), G( 2), G( 3), G( 4), G( 5), G(-1))); - (void) NM_IN_SET ("a", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"); + g_assert (!NM_IN_SET (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); #undef G #undef N #undef _ASSERT @@ -7887,7 +7887,9 @@ test_nm_in_strset (void) _ASSERT (6, NM_IN_STRSET ("a", G(NULL), G("b"), G("c"), G("d"), G("e"), G("a"))); _ASSERT (6, !NM_IN_STRSET ("a", G(NULL), G("b"), G("c"), G("d"), G("e"), G("f"))); - (void) NM_IN_STRSET ("a", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"); + g_assert (!NM_IN_STRSET (NULL, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16")); + g_assert (!NM_IN_STRSET ("_", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16")); + g_assert ( NM_IN_STRSET ("10", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16")); #undef G #undef N #undef _ASSERT |