diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-05-06 12:54:43 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-05-06 12:54:43 -0700 |
commit | 16cdfdcc492cc76da983c20e3eac1bb4af4a02bd (patch) | |
tree | 285cbd702e643a53d384944f6cda1b589d7daae5 /diag-control.h | |
parent | 199a26bbe5cf21b87c3fa438ef8d39c120e2cf06 (diff) |
Suppress unreachable-code warnings in generated code in MSVC.
Diffstat (limited to 'diag-control.h')
-rw-r--r-- | diag-control.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/diag-control.h b/diag-control.h index 0550dc6b..c8e7f627 100644 --- a/diag-control.h +++ b/diag-control.h @@ -55,13 +55,15 @@ * This is Microsoft Visual Studio; we can use __pragma(warning(disable:XXXX)) * and __pragma(warning(push/pop)). * - * Suppress signed-vs-unsigned comparison and narrowing warnings. + * Suppress signed-vs-unsigned comparison, narrowing, and unreachable + * code warnings. */ #define DIAG_OFF_FLEX \ __pragma(warning(push)) \ __pragma(warning(disable:4127)) \ __pragma(warning(disable:4242)) \ - __pragma(warning(disable:4244)) + __pragma(warning(disable:4244)) \ + __pragma(warning(disable:4702)) #define DIAG_ON_FLEX __pragma(warning(pop)) #elif PCAP_IS_AT_LEAST_CLANG_VERSION(2,8) /* @@ -120,7 +122,18 @@ * So, if we have _Pragma, and have pragmas to suppress diagnostics, * we use it to turn off -Wshadow warnings. */ - #if PCAP_IS_AT_LEAST_CLANG_VERSION(2,8) + #if defined(_MSC_VER) + /* + * This is Microsoft Visual Studio; we can use + * __pragma(warning(disable:XXXX)) and __pragma(warning(push/pop)). + * + * Suppress unreachable code warnings. + */ + #define DIAG_OFF_BISON_BYACC \ + __pragma(warning(push)) \ + __pragma(warning(disable:4702)) + #define DIAG_ON_BISON_BYACC __pragma(warning(pop)) + #elif PCAP_IS_AT_LEAST_CLANG_VERSION(2,8) /* * This is Clang 2.8 or later; we can use "clang diagnostic * ignored -Wxxx" and "clang diagnostic push/pop". |