aboutsummaryrefslogtreecommitdiffstats
path: root/ws_diag_control.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-05-18 14:41:26 -0700
committerGuy Harris <guy@alum.mit.edu>2018-05-18 22:31:05 +0000
commitb1de8c87a12ea431e45e86dea85546948937e21e (patch)
treeb4ade80a03f7d39a774bc04756f272c5f18e23ec /ws_diag_control.h
parent1a4f65c4a31d7366f2e4d3fee62bf05105fd0ebf (diff)
Older versions of Clang don't understand -Wpedantic.
Define DIAG_OFF_PEDANTIC and DIAG_ON_PEDANTIC, and have it do nothing on Clang prior to 4.0. Change-Id: Ic6b2e607659db66f3210401024bf3f2239665506 Reviewed-on: https://code.wireshark.org/review/27649 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ws_diag_control.h')
-rw-r--r--ws_diag_control.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/ws_diag_control.h b/ws_diag_control.h
index 40b9831e43..b865b8c186 100644
--- a/ws_diag_control.h
+++ b/ws_diag_control.h
@@ -48,6 +48,18 @@ extern "C" {
#define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
#define DIAG_ON(x) DIAG_PRAGMA(pop)
#endif
+
+ /*
+ * Not all versions of Clang understand -Wpedantic. Clang 4.0 appears
+ * to be the first version to do so.
+ */
+ #if WS_IS_AT_LEAST_CLANG_VERSION(4,0)
+ #define DIAG_OFF_PEDANTIC DIAG_OFF(pedantic)
+ #define DIAG_ON_PEDANTIC DIAG_ON(pedantic)
+ #else
+ #define DIAG_OFF_PEDANTIC
+ #define DIAG_ON_PEDANTIC
+ #endif
#elif defined(__GNUC__)
/*
* GCC, or a compiler (other than Clang) that claims to be GCC.
@@ -65,6 +77,15 @@ extern "C" {
#define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(GCC diagnostic x)
#define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
#define DIAG_ON(x) DIAG_PRAGMA(pop)
+
+ /*
+ * We assume GCC 4.8 and later understand -Wpedantic.
+ */
+ #define DIAG_OFF_PEDANTIC DIAG_OFF(pedantic)
+ #define DIAG_ON_PEDANTIC DIAG_ON(pedantic)
+ #else
+ #define DIAG_OFF_PEDANTIC
+ #define DIAG_ON_PEDANTIC
#endif
#endif
@@ -79,6 +100,8 @@ extern "C" {
*/
#define DIAG_OFF(x)
#define DIAG_ON(x)
+ #define DIAG_OFF_PEDANTIC
+ #define DIAG_ON_PEDANTIC
#endif
/* Use for clang specific pragmas, so we can keep -Wpragmas enabled */