aboutsummaryrefslogtreecommitdiff
path: root/diag-control.h
Commit message (Collapse)AuthorAgeFilesLines
* Simplify conditional branching in diag-control.h.Denis Ovsienko2023-02-181-43/+43
| | | | | | | | | Since diagnostic macros do not depend on each other, use the same approach as in tcpslice: make one or more attempts to define a diagnostic macro depending on conditions of varying complexity; if after all the busy branching the macro is not yet defined, define it to an empty string once. This way the branches are simpler to rearrange when required, and the file has a manifest of the macro names it defines.
* diag-control.h: improve a comment. [skip ci]Guy Harris2022-07-131-3/+3
|
* diag-control.h: define PCAP_DO_PRAGMA() iff we're going to use it.Guy Harris2022-07-121-1/+1
| | | | | | | | | | Test for whether we're using Clang 2.8 or later or GCC 4.6 or later, rather than testing for MSVC; that way, we define it for Microsoft's clang-cl (which is Clang-based, so we want it defined, but it defines _MSC_VER) and don't define it for compilers that aren't MSVC, Clang, or GCC. This should fix issue #1115.
* Test PCAP_IS_AT_LEAST_CLANG_VERSION(2,8) before testing _MSC_VER.Guy Harris2022-03-211-55/+58
| | | | | | | | As Gisle Vanem notes, "...using clang-cl on Windows to compile with (a MSVC-compatible compiler driver), this includes _MSC_VER as a built-in. Hence the above blocks should be swapped..." This fixes issue #1101.
* Revert the DIAG_{OFF,ON}_PTR_TO_INT changes.Guy Harris2022-01-021-43/+1
| | | | | | | | Windows programs shouldn't use pcap_fileno(); we're already deprecating it, and the fix for GitHub issue #1026 squelches the warning in a fashion that doesn't require any DIAG_OFF/DIAG_ON stuff, and there's no reason for us to care how a deprecated function works around its brokenness-by-design.
* Oops, missed an _ when typing the DIAG_*_PTR_TO_INT stuff in.Guy Harris2022-01-011-1/+1
|
* Have a separate DIAG_OFF_ for pointer-to-integer narrowing.Guy Harris2022-01-011-1/+43
| | | | | | | | | Use that for pcap_fileno() on Windows; that API shouldn't exist on Windows, and should never be used, but WinPcap offered it, so we're stuck with it. At least try to prevent compilation errors when libpcap is built. This should fix the warnings for pcap_fileno() in GitHub issue #1026.
* Use __builtin_unreachable(). [skip ci]Denis Ovsienko2021-08-061-0/+16
| | | | Refine the changes made in commit 3f35396 and use a macro with comments.
* Define DIAG_OFF_FORMAT_TRUNCATION better.Denis Ovsienko2021-07-311-5/+12
| | | | | | | | | | | | | | | | | Apparently, GCC 4.6.4 didn't like it: pcap-new.c:241:4: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas] pcap-new.c:259:4: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas] pcap-new.c:452:2: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas] pcap-rpcap.c:3369:4: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas] pcap-rpcap.c:3406:4: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas] rpcapd.c:1365:4: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
* Suppress temporarily the warnings with "enable remote packet capture"Francois-Xavier Le Bail2021-06-291-0/+15
| | | | | | These were format-truncation warnings (See issue #1029). This is a workaround while waiting for a fix.
* Remove trailing spacesFrancois-Xavier Le Bail2020-12-291-1/+1
|
* grammar: squelch warnings about switch statements with only a default case.Guy Harris2020-07-031-3/+4
| | | | That's generated code over which we have no control.
* bpf_filter: suppress "switch has only a default case" warning.Guy Harris2020-07-031-0/+16
|
* NPF: squelch some warnings about enum values not handled in switches.Guy Harris2020-07-031-0/+20
| | | | | | | | | | | The AppVeyor CI builder started warning about switch statements in which not all enum values were handled explicitly on the VS 1019 build. We can't test for the enum values at compile time, the way we could test for #defines, so, for now, we punt on the NdisPhysicalMedium enums and just suppress that diagnostic for that switch statement. We add MediaConnectStateUnknown to the switch for the connect state; that one is presumably there if the enum is there at all.
* Expand a comment.Guy Harris2020-05-301-1/+1
|
* Add pcap_handle(), and deprecate pcap_fileno(), on Windows.Guy Harris2020-05-301-1/+2
| | | | | | | | | | | | | I don't know whether a Windows HANDLE can be expected to survive conversion to an int - and there's no need for it to have to be converted. If a caller needs to do something with a HANDLE associated with a pcap_t, it should call the new pcap_handle() routine and get a HANDLE; code for UN*X that uses the result of pcap_fileno() is unlikely to work on Windows anyway. Squelch the "pointer truncation from 'HANDLE' to 'DWORD'" warning, as, if that truncation causes an issue, callers should use pcap_handle(), and if it *doesn't* cause an issue, it's, well, not an issue.
* Suppress warnings about the deprecation of gethostbyname().Guy Harris2018-09-141-2/+33
| | | | | | Yes, we know, we shouldn't use it. We only use it to provide a routine that we've exported for a long time (and thus can't necessarily remove), and which *we* now deprecate.
* Don't do push/pop when suppressing warnings in grammar.y.Guy Harris2018-09-131-26/+8
| | | | | | | | | | MSVC may warn about a push not matched by a pop if we don't use DIAG_ON_BISON_BYACC, and there's no way to ensure that DIAG_ON_BISON_BYACC is placed after *all* Berkeley YACC-generated code, so we can't make it work. Instead, don't do a push in DIAG_OFF_BISON_BYACC, and don't define or use DIAG_ON_BISON_BYACC.
* Squelch more narrowing warnings.Guy Harris2018-09-121-0/+27
|
* No, Bison *doesn't* have that problem. It's Flex.Guy Harris2018-05-301-4/+2
| | | | | We're supposedly suppressing that warning with Flex; more debugging is necessary.
* Suppress unused-parameter warnings in Bison-generated code.Guy Harris2018-05-301-2/+8
| | | | | | | | We're seeing them with OpenBSD 6.3 and Bison 3.0.4. While we're at ti, update some comments to reflect that, with Berkeley YACC, we supportess unreachable code warnings with MSVC, GCC, and Clang, not just with MSVC.
* Update a comment.Guy Harris2018-05-061-2/+1
|
* Suppress unreachable-code warnings in generated code in MSVC.Guy Harris2018-05-061-3/+16
|
* Turn on -Wunreachable-code and suppress it in generated code.Guy Harris2018-05-061-42/+70
|
* Ignore unused-parameter warnings in Flex code when compiling with GCC.Guy Harris2018-04-041-1/+2
|
* Enable -Wunused-parameter and fix warnings that are almost trivial.Joerg Mayer2018-04-021-1/+2
| | | | Signed-off-by: Joerg Mayer <jmayer@loplof.de>
* Suppress more narrowing warnings.Guy Harris2018-03-311-1/+2
|
* Suppress narrowing warnings in Flex-generated code.Guy Harris2018-03-311-2/+3
|
* Add -Wmissing-noreturn to compiler warnings and fix all fixable warnings.Joerg Mayer2018-03-281-1/+2
| | | | | | | | Also suppress the one non-fixable warning: build/scanner.c:5020:1: warning: function 'yy_fatal_error' could be declared with attribute 'noreturn' [-Wmissing-noreturn] Signed-off-by: Joerg Mayer <jmayer@loplof.de>
* Turn off -Wdocumentation warning for Flex-generated code.Joerg Mayer2018-03-271-1/+7
| | | | | | | | Flex 2.5.35 Apple(flex-31) appears to generate comments that Clang's -Wdocumentation doesn't like. Comment-updated-by: Guy Harris <guy@alum.mit.edu> Signed-off-by: Joerg Mayer <jmayer@loplof.de>
* Clean up comments.Guy Harris2018-03-211-15/+4
|
* We need at least GCC 4.6 for pushing and popping warnings.Guy Harris2018-03-211-7/+13
|
* Suppress GCC/Clang warnings in Flex-generated code.Guy Harris2018-03-211-3/+51
|
* Suppress warnings in Flex-generated code.Guy Harris2018-03-201-0/+13
|
* Fix indentation.Guy Harris2018-03-201-1/+1
|
* Squelch more warnings in Bison-generated code.Guy Harris2018-03-201-1/+4
|
* Fix header.Guy Harris2018-03-201-1/+1
|
* Suppress some warnings in Bison-generated code.Guy Harris2018-03-201-21/+36
|
* Fix a tyqo.Guy Harris2018-02-241-1/+1
|
* We need pcap/compiler-tests.h in diag-control.h.Guy Harris2018-02-241-0/+2
|
* With some versions of GCC we need to suppress dianostics in grammar.h.Guy Harris2018-02-241-0/+88
With at least some versions of GCC, we need to suppress the -Wshadow diagnostics before the global variable is defined as well as before the local variable is defined, otherwise only the complaint about grammar.c is suppressed, not the compaint about grammar.h.