[network-manager-applet/nma-0-9-10: 14/15] utils: add macros to suppress compiler warnings
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/nma-0-9-10: 14/15] utils: add macros to suppress compiler warnings
- Date: Fri, 31 Oct 2014 20:19:58 +0000 (UTC)
commit a3a4e9d6377679b21102f288772e82cbaabd2efd
Author: Thomas Haller <thaller redhat com>
Date: Fri Oct 31 20:13:53 2014 +0100
utils: add macros to suppress compiler warnings
Signed-off-by: Thomas Haller <thaller redhat com>
(cherry picked from commit a6d9842cd6117f7d21b41c26e065208570c7c70e)
src/utils/utils.h | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/src/utils/utils.h b/src/utils/utils.h
index 3cd0408..a4827de 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -30,6 +30,42 @@
#include <net/ethernet.h>
#include <nm-access-point.h>
+
+#if defined (__GNUC__)
+#define _NM_PRAGMA_WARNING_DO(warning) G_STRINGIFY(GCC diagnostic ignored warning)
+#elif defined (__clang__)
+#define _NM_PRAGMA_WARNING_DO(warning) G_STRINGIFY(clang diagnostic ignored warning)
+#endif
+
+/* you can only suppress a specific warning that the compiler
+ * understands. Otherwise you will get another compiler warning
+ * about invalid pragma option.
+ * It's not that bad however, because gcc and clang often have the
+ * same name for the same warning. */
+
+#if defined (__GNUC__)
+#define NM_PRAGMA_WARNING_DISABLE(warning) \
+ _Pragma("GCC diagnostic push"); \
+ _Pragma(_NM_PRAGMA_WARNING_DO(warning))
+#elif defined (__clang__)
+#define NM_PRAGMA_WARNING_DISABLE(warning) \
+ _Pragma("clang diagnostic push"); \
+ _Pragma(_NM_PRAGMA_WARNING_DO(warning))
+#else
+#define NM_PRAGMA_WARNING_DISABLE(warning)
+#endif
+
+#if defined (__GNUC__)
+#define NM_PRAGMA_WARNING_REENABLE \
+ _Pragma("GCC diagnostic pop")
+#elif defined (__clang__)
+#define NM_PRAGMA_WARNING_REENABLE \
+ _Pragma("clang diagnostic pop")
+#else
+#define NM_PRAGMA_WARNING_REENABLE
+#endif
+
+
guint32 utils_freq_to_channel (guint32 freq);
guint32 utils_channel_to_freq (guint32 channel, char *band);
guint32 utils_find_next_channel (guint32 channel, int direction, char *band);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]