diff options
author | Thomas Haller <thaller@redhat.com> | 2014-10-31 20:13:53 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-10-31 21:03:49 +0100 |
commit | a6d9842cd6117f7d21b41c26e065208570c7c70e (patch) | |
tree | 5fd5c2b69e1c0b0bd2766261ed2b17acd120ccac | |
parent | 659b9624873c8447ee9e0adc08ecfc6f6a3c3e42 (diff) | |
download | network-manager-applet-a6d9842cd6117f7d21b41c26e065208570c7c70e.tar.gz |
utils: add macros to suppress compiler warnings
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | 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 3cd04087..a4827de9 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); |