diff options
-rw-r--r-- | diag-control.h | 44 | ||||
-rw-r--r-- | pcap.c | 4 |
2 files changed, 45 insertions, 3 deletions
diff --git a/diag-control.h b/diag-control.h index d1622aa6..7a2f787a 100644 --- a/diag-control.h +++ b/diag-control.h @@ -114,6 +114,19 @@ __pragma(warning(pop)) /* + * Suppress pointer-to-integer conversion warnins. + * (This should never be done, but we have an API + * that's a documented WinPcap API, so we're stuck + * with supporting it, even though nobody should + * use it.) + */ + #define DIAG_OFF_PTR_TO_INT \ + __pragma(warning(push)) \ + __pragma(warning(disable:4311)) + #define DIAG_ON_PTR_TOINT \ + __pragma(warning(pop)) + + /* * Suppress deprecation warnings. */ #define DIAG_OFF_DEPRECATION \ @@ -150,11 +163,24 @@ #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 pointer-to-integer conversion warnins. + * (This should never be done, but we have an API + * that's a documented WinPcap API, so we're stuck + * with supporting it, even though nobody should + * use it. And, yes, somebody might compile for + * Windows using a Clang-based compiler.) + */ + #define DIAG_OFF_PTR_TO_INT \ + PCAP_DO_PRAGMA(clang diagnostic push) \ + PCAP_DO_PRAGMA(clang diagnostic ignored "-Wpointer-to-int-cast") + #define DIAG_ON_PTR_TO_INT \ + PCAP_DO_PRAGMA(clang diagnostic pop) + + /* * Suppress deprecation warnings. */ #define DIAG_OFF_DEPRECATION \ @@ -185,6 +211,20 @@ #define DIAG_ON_NARROWING /* + * Suppress pointer-to-integer conversion warnins. + * (This should never be done, but we have an API + * that's a documented WinPcap API, so we're stuck + * with supporting it, even though nobody should + * use it. And, yes, somebody might compile for + * Windows using GCC.) + */ + #define DIAG_OFF_PTR_TO_INT \ + PCAP_DO_PRAGMA(GCC diagnostic push) \ + PCAP_DO_PRAGMA(GCC diagnostic ignored "-Wpointer-to-int-cast") + #define DIAG_ON_PTR_TO_INT \ + PCAP_DO_PRAGMA(GCC diagnostic pop) + + /* * Suppress deprecation warnings. */ #define DIAG_OFF_DEPRECATION \ @@ -218,6 +258,8 @@ #define DIAG_ON_FLEX #define DIAG_OFF_NARROWING #define DIAG_ON_NARROWING + #define DIAG_OFF_PTR_TO_INT + #define DIAG_ON_PTR_TO_INT #define DIAG_OFF_DEPRECATION #define DIAG_ON_DEPRECATION #define DIAG_OFF_FORMAT_TRUNCATION @@ -3484,9 +3484,9 @@ pcap_fileno(pcap_t *p) * routine (and be prepared for it to return * INVALID_HANDLE_VALUE). */ -DIAG_OFF_NARROWING +DIAG_OFF_PTR_TO_INT return ((int)(DWORD)p->handle); -DIAG_ON_NARROWING +DIAG_ON_PTR_TO_INT } else return (PCAP_ERROR); } |