1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-10 15:36:33 +00:00

Upgrade libpcap to 1.10.4

This commit is contained in:
dmiller
2023-04-28 14:37:51 +00:00
parent 186bed85c8
commit 585832c41e
121 changed files with 13810 additions and 8968 deletions

View File

@@ -37,12 +37,12 @@
#include "pcap/compiler-tests.h"
#ifndef _MSC_VER
#if PCAP_IS_AT_LEAST_CLANG_VERSION(2,8) || PCAP_IS_AT_LEAST_GNUC_VERSION(4,6)
/*
* Clang and GCC both support this way of putting pragmas into #defines.
* We don't use it unless we have a compiler that supports it; the
* warning-suppressing pragmas differ between Clang and GCC, so we test
* for both of those separately.
* We use it only if we have a compiler that supports it; see below
* for the code that uses it and the #defines that control whether
* that code is used.
*/
#define PCAP_DO_PRAGMA(x) _Pragma (#x)
#endif
@@ -86,7 +86,51 @@
/*
* Suppress Flex, narrowing, and deprecation warnings.
*/
#if defined(_MSC_VER)
#if 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".
*
* Suppress -Wdocumentation warnings; GCC doesn't support -Wdocumentation,
* at least according to the GCC 7.3 documentation. Apparently, Flex
* generates code that upsets at least some versions of Clang's
* -Wdocumentation.
*
* (This could be clang-cl, which defines _MSC_VER, so test this
* before testing _MSC_VER.)
*/
#define DIAG_OFF_FLEX \
PCAP_DO_PRAGMA(clang diagnostic push) \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wsign-compare") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wdocumentation") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshorten-64-to-32") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wmissing-noreturn") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunused-parameter") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
#define DIAG_ON_FLEX \
PCAP_DO_PRAGMA(clang diagnostic pop)
/*
* Suppress the only narrowing warnings you get from Clang.
*/
#define DIAG_OFF_NARROWING \
PCAP_DO_PRAGMA(clang diagnostic push) \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshorten-64-to-32")
#define DIAG_ON_NARROWING \
PCAP_DO_PRAGMA(clang diagnostic pop)
/*
* Suppress deprecation warnings.
*/
#define DIAG_OFF_DEPRECATION \
PCAP_DO_PRAGMA(clang diagnostic push) \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wdeprecated-declarations")
#define DIAG_ON_DEPRECATION \
PCAP_DO_PRAGMA(clang diagnostic pop)
#define DIAG_OFF_FORMAT_TRUNCATION
#define DIAG_ON_FORMAT_TRUNCATION
#elif defined(_MSC_VER)
/*
* This is Microsoft Visual Studio; we can use __pragma(warning(disable:XXXX))
* and __pragma(warning(push/pop)).
@@ -121,45 +165,8 @@
__pragma(warning(disable:4996))
#define DIAG_ON_DEPRECATION \
__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".
*
* Suppress -Wdocumentation warnings; GCC doesn't support -Wdocumentation,
* at least according to the GCC 7.3 documentation. Apparently, Flex
* generates code that upsets at least some versions of Clang's
* -Wdocumentation.
*/
#define DIAG_OFF_FLEX \
PCAP_DO_PRAGMA(clang diagnostic push) \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wsign-compare") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wdocumentation") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshorten-64-to-32") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wmissing-noreturn") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunused-parameter") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
#define DIAG_ON_FLEX \
PCAP_DO_PRAGMA(clang diagnostic pop)
/*
* Suppress the only narrowing warnings you get from Clang.
*/
#define DIAG_OFF_NARROWING \
PCAP_DO_PRAGMA(clang diagnostic push) \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshorten-64-to-32")
#define DIAG_ON_NARROWING \
PCAP_DO_PRAGMA(clang diagnostic pop)
/*
* Suppress deprecation warnings.
*/
#define DIAG_OFF_DEPRECATION \
PCAP_DO_PRAGMA(clang diagnostic push) \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wdeprecated-declarations")
#define DIAG_ON_DEPRECATION \
PCAP_DO_PRAGMA(clang diagnostic pop)
#define DIAG_OFF_FORMAT_TRUNCATION
#define DIAG_ON_FORMAT_TRUNCATION
#elif PCAP_IS_AT_LEAST_GNUC_VERSION(4,6)
/*
* This is GCC 4.6 or later, or a compiler claiming to be that.
@@ -188,6 +195,22 @@
PCAP_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
#define DIAG_ON_DEPRECATION \
PCAP_DO_PRAGMA(GCC diagnostic pop)
/*
* Suppress format-truncation= warnings.
* GCC 7.1 had introduced this warning option. Earlier versions (at least
* one particular copy of GCC 4.6.4) treat the request as a warning.
*/
#if PCAP_IS_AT_LEAST_GNUC_VERSION(7,1)
#define DIAG_OFF_FORMAT_TRUNCATION \
PCAP_DO_PRAGMA(GCC diagnostic push) \
PCAP_DO_PRAGMA(GCC diagnostic ignored "-Wformat-truncation=")
#define DIAG_ON_FORMAT_TRUNCATION \
PCAP_DO_PRAGMA(GCC diagnostic pop)
#else
#define DIAG_OFF_FORMAT_TRUNCATION
#define DIAG_ON_FORMAT_TRUNCATION
#endif
#else
/*
* Neither Visual Studio, nor Clang 2.8 or later, nor GCC 4.6 or later
@@ -200,6 +223,8 @@
#define DIAG_ON_NARROWING
#define DIAG_OFF_DEPRECATION
#define DIAG_ON_DEPRECATION
#define DIAG_OFF_FORMAT_TRUNCATION
#define DIAG_ON_FORMAT_TRUNCATION
#endif
#ifdef YYBYACC
@@ -219,21 +244,21 @@
* In addition, the generated code may have functions with unreachable
* code, so suppress warnings about those.
*/
#if defined(_MSC_VER)
#if PCAP_IS_AT_LEAST_CLANG_VERSION(2,8)
/*
* This is Clang 2.8 or later (including clang-cl, so test this
* before _MSC_VER); we can use "clang diagnostic ignored -Wxxx".
*/
#define DIAG_OFF_BISON_BYACC \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshadow") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
#elif defined(_MSC_VER)
/*
* This is Microsoft Visual Studio; we can use
* __pragma(warning(disable:XXXX)).
*/
#define DIAG_OFF_BISON_BYACC \
__pragma(warning(disable:4702))
#elif PCAP_IS_AT_LEAST_CLANG_VERSION(2,8)
/*
* This is Clang 2.8 or later; we can use "clang diagnostic
* ignored -Wxxx".
*/
#define DIAG_OFF_BISON_BYACC \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wshadow") \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
#elif PCAP_IS_AT_LEAST_GNUC_VERSION(4,6)
/*
* This is GCC 4.6 or later, or a compiler claiming to be that.
@@ -257,7 +282,14 @@
* The generated code may have functions with unreachable code and
* switches with only a default case, so suppress warnings about those.
*/
#if defined(_MSC_VER)
#if PCAP_IS_AT_LEAST_CLANG_VERSION(2,8)
/*
* This is Clang 2.8 or later (including clang-cl, so test this
* before _MSC_VER); we can use "clang diagnostic ignored -Wxxx".
*/
#define DIAG_OFF_BISON_BYACC \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
#elif defined(_MSC_VER)
/*
* This is Microsoft Visual Studio; we can use
* __pragma(warning(disable:XXXX)).
@@ -270,13 +302,6 @@
__pragma(warning(disable:4242)) \
__pragma(warning(disable:4244)) \
__pragma(warning(disable:4702))
#elif PCAP_IS_AT_LEAST_CLANG_VERSION(2,8)
/*
* This is Clang 2.8 or later; we can use "clang diagnostic
* ignored -Wxxx".
*/
#define DIAG_OFF_BISON_BYACC \
PCAP_DO_PRAGMA(clang diagnostic ignored "-Wunreachable-code")
#elif PCAP_IS_AT_LEAST_GNUC_VERSION(4,6)
/*
* This is GCC 4.6 or later, or a compiler claiming to be that.
@@ -294,4 +319,20 @@
#endif
#endif
/*
* GCC needs this on AIX for longjmp().
*/
#if PCAP_IS_AT_LEAST_GNUC_VERSION(5,1)
/*
* Beware that the effect of this builtin is more than just squelching the
* warning! GCC trusts it enough for the process to segfault if the control
* flow reaches the builtin (an infinite empty loop in the same context would
* squelch the warning and ruin the process too, albeit in a different way).
* So please remember to use this very carefully.
*/
#define PCAP_UNREACHABLE __builtin_unreachable();
#else
#define PCAP_UNREACHABLE
#endif
#endif /* _diag_control_h */