From 078dd82d1908c517d95e33356e63a1326afcaaff Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 26 Jul 2014 21:13:52 +0200 Subject: [PATCH] all: add compatibility macros to ignore deprecation warnings for clang For clang, the defines G_GNUC_BEGIN_IGNORE_DEPRECATIONS and G_GNUC_END_IGNORE_DEPRECATIONS are not working. Redefine them for clang in our glib compatibility wrapper. Signed-off-by: Thomas Haller (cherry picked from commit b461bf54f2016791e13eee6164a6669c1b747010) --- cli/src/settings.c | 1 + include/nm-glib-compat.h | 17 +++++++++++++++++ include/nm-gvaluearray-compat.h | 2 ++ tui/newt/nmt-newt-utils.c | 1 + 4 files changed, 21 insertions(+) diff --git a/cli/src/settings.c b/cli/src/settings.c index 0fc708b352..876393f4fd 100644 --- a/cli/src/settings.c +++ b/cli/src/settings.c @@ -29,6 +29,7 @@ #include "utils.h" #include "common.h" #include "settings.h" +#include "nm-glib-compat.h" /* Forward declarations */ static char *wep_key_type_to_string (NMWepKeyType type); diff --git a/include/nm-glib-compat.h b/include/nm-glib-compat.h index cfaddb7d31..81d80f7c5b 100644 --- a/include/nm-glib-compat.h +++ b/include/nm-glib-compat.h @@ -27,8 +27,25 @@ #include #include + +#ifdef __clang__ + +#undef G_GNUC_BEGIN_IGNORE_DEPRECATIONS +#undef G_GNUC_END_IGNORE_DEPRECATIONS + +#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") + +#define G_GNUC_END_IGNORE_DEPRECATIONS \ + _Pragma("clang diagnostic pop") + +#endif + + #include "nm-gvaluearray-compat.h" + #if !GLIB_CHECK_VERSION(2,34,0) static inline void g_type_ensure (GType type) diff --git a/include/nm-gvaluearray-compat.h b/include/nm-gvaluearray-compat.h index e26ce37174..0fb4bd6e94 100644 --- a/include/nm-gvaluearray-compat.h +++ b/include/nm-gvaluearray-compat.h @@ -23,6 +23,8 @@ #include +#include "nm-glib-compat.h" + #define g_value_array_get_type() \ G_GNUC_EXTENSION ({ \ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ diff --git a/tui/newt/nmt-newt-utils.c b/tui/newt/nmt-newt-utils.c index 68d8c449e5..70a65a8489 100644 --- a/tui/newt/nmt-newt-utils.c +++ b/tui/newt/nmt-newt-utils.c @@ -30,6 +30,7 @@ #include +#include "nm-glib-compat.h" #include "nmt-newt-utils.h" static void