From fc4552d3912f2fc99690c6d0c08cb7f16c6d336f Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 23 Jan 2018 14:31:39 +0100 Subject: [PATCH] shared/utils: don't warn of unknown warning disables with clang When pushing a warning disable with clang, always disable -Wunknown-warning-option first -- it might be that clang wouldn't warn of what we're trying to disable because it doesn't recognize it in the first place. That is entierely okay. With clang-5.0.0: CC libnm/tests/libnm_tests_test_secret_agent-test-secret-agent.o In file included from libnm/tests/test-secret-agent.c:29: In file included from ./shared/nm-test-libnm-utils.h:23: ./shared/nm-utils/nm-test-utils.h:432:3: error: unknown warning group '-Wunused-but-set-variable', ignored [-Werror,-Wunknown-warning-option] NM_PRAGMA_WARNING_DISABLE("-Wunused-but-set-variable") ^ ./shared/nm-utils/nm-macros-internal.h:223:9: note: expanded from macro 'NM_PRAGMA_WARNING_DISABLE' _Pragma(_NM_PRAGMA_WARNING_DO(warning)) ^ :204:25: note: expanded from here GCC diagnostic ignored "-Wunused-but-set-variable" ^ 1 error generated. --- shared/nm-utils/nm-macros-internal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h index 852a87df5b..5837a47bc7 100644 --- a/shared/nm-utils/nm-macros-internal.h +++ b/shared/nm-utils/nm-macros-internal.h @@ -220,6 +220,7 @@ _nm_auto_protect_errno (int *p_saved_errno) #elif defined (__clang__) #define NM_PRAGMA_WARNING_DISABLE(warning) \ _Pragma("clang diagnostic push") \ + _Pragma(_NM_PRAGMA_WARNING_DO("-Wunknown-warning-option")) \ _Pragma(_NM_PRAGMA_WARNING_DO(warning)) #else #define NM_PRAGMA_WARNING_DISABLE(warning)