aboutsummaryrefslogtreecommitdiffstats
path: root/ws_diag_control.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-02-15 23:17:04 -0800
committerGuy Harris <guy@alum.mit.edu>2018-02-16 10:35:10 +0000
commit8bc1c6e3e8c0a84ee656d1e1d68530fc9bf2e35d (patch)
tree92c288690894a1f68257711ee594a7da985a7aa9 /ws_diag_control.h
parentb6bec7d1fdf537f12968276344e6191394249b8b (diff)
downloadwireshark-8bc1c6e3e8c0a84ee656d1e1d68530fc9bf2e35d.tar.gz
wireshark-8bc1c6e3e8c0a84ee656d1e1d68530fc9bf2e35d.tar.bz2
wireshark-8bc1c6e3e8c0a84ee656d1e1d68530fc9bf2e35d.zip
Add DIAG_OFF_FLEX and DIAG_ON_FLEX for use in Flex scanners.
DIAG_OFF_FLEX turns off all warnings that we want to disable for Flex-generated code due to some versions of Flex generating code that triggers those warnings. DIAG_ON_FLEX restores those warnings, so we do the checks for code that *we* wrote. Use them in .l files. Change-Id: I613a20309a30cd4c61111a1edbe27a5d05fcbf59 Reviewed-on: https://code.wireshark.org/review/25815 Petri-Dish: Guy Harris <guy@alum.mit.edu> 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.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/ws_diag_control.h b/ws_diag_control.h
index 459a18a9af..155c143077 100644
--- a/ws_diag_control.h
+++ b/ws_diag_control.h
@@ -22,9 +22,16 @@ extern "C" {
#define XSTRINGIFY(x) #x
/*
- * Macros for controlling warnings in GCC >= 4.2 and clang >= 2.8
+ * Macros for controlling warnings in various compilers.
*/
#define DIAG_JOINSTR(x,y) XSTRINGIFY(x ## y)
+
+/*
+ * XXX - this is only for GCC or GCC-compatible compilers, and we only use
+ * it to have a macro that takes a warning as an argument and turns it
+ * off in the appropriate fashion for Clang and GCC; it should only be
+ * used internally in this header.
+ */
#define DIAG_DO_PRAGMA(x) _Pragma (#x)
#if defined(__clang__)
@@ -84,6 +91,27 @@ extern "C" {
#endif
/*
+ * Suppress complaints about conversion of size_t to int and about
+ * signed vs. unsigned comparison.
+ *
+ * XXX - this is done solely to squelch complaints from code generated
+ * by Flex, but newer versions of Flex might fix the code; can we
+ * check the version of Flex and suppress only the checks that code
+ * generated by that version of Flex triggers?
+ */
+#if defined(_MSC_VER)
+ #define DIAG_OFF_FLEX \
+ __pragma(warning(push)) \
+ __pragma(warning(disable:4018))
+ #define DIAG_ON_FLEX __pragma(warning(pop))
+#else
+ #define DIAG_OFF_FLEX \
+ DIAG_OFF(sign-compare)
+ #define DIAG_ON_FLEX \
+ DIAG_ON(sign-compare)
+#endif
+
+/*
* For dealing with APIs which are only deprecated in macOS (like the
* OpenSSL and MIT/Heimdal Kerberos APIs).
*