From: Denis Ovsienko Date: Sun, 3 Mar 2024 21:03:29 +0000 (+0000) Subject: Squelch Clang warnings about OpenSSL. X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/9a408b9808d38fc60013afa3a06db70a30bbe898 Squelch Clang warnings about OpenSSL. SunOS openindiana 5.11 illumos-de27825976 i86pc i386 i86pc clang version 17.0.6 (https://github.com/OpenIndiana/oi-userland.git e8024d02bcf37929f39ab5d7ba1a689029e42ba8) Target: x86_64-pc-solaris2.11 Thread model: posix InstalledDir: /usr/bin In file included from ./sslutils.c:42: In file included from ./sslutils.h:38: In file included from /usr/openssl/1.0/include/openssl/ssl.h:156: In file included from /usr/openssl/1.0/include/openssl/x509.h:87: /usr/openssl/1.0/include/openssl/ecdsa.h:295:14: error: parameter 'flags' not found in the function declaration [-Werror,-Wdocumentation] /usr/openssl/1.0/include/openssl/ecdsa.h:301:14: error: parameter 'ecdsa_method' not found in the function declaration [-Werror,-Wdocumentation] /usr/openssl/1.0/include/openssl/ecdsa.h:302:14: error: parameter 'name' not found in the function declaration [-Werror,-Wdocumentation] Add a pair of diagnostic control macros for -Wdocumentation and use it around including OpenSSL headers. --- diff --git a/diag-control.h b/diag-control.h index 800111bf..fdb76245 100644 --- a/diag-control.h +++ b/diag-control.h @@ -137,6 +137,12 @@ #define DIAG_ON_STRICT_PROTOTYPES \ PCAP_DO_PRAGMA(clang diagnostic pop) #endif + + #define DIAG_OFF_DOCUMENTATION \ + PCAP_DO_PRAGMA(clang diagnostic push) \ + PCAP_DO_PRAGMA(clang diagnostic ignored "-Wdocumentation") + #define DIAG_ON_DOCUMENTATION \ + PCAP_DO_PRAGMA(clang diagnostic pop) #elif defined(_MSC_VER) /* * This is Microsoft Visual Studio; we can use __pragma(warning(disable:XXXX)) @@ -399,6 +405,12 @@ #ifndef DIAG_ON_STRICT_PROTOTYPES #define DIAG_ON_STRICT_PROTOTYPES #endif +#ifndef DIAG_OFF_DOCUMENTATION +#define DIAG_OFF_DOCUMENTATION +#endif +#ifndef DIAG_ON_DOCUMENTATION +#define DIAG_ON_DOCUMENTATION +#endif #ifndef PCAP_UNREACHABLE #define PCAP_UNREACHABLE #endif diff --git a/sslutils.h b/sslutils.h index dd9a5556..3a36c61b 100644 --- a/sslutils.h +++ b/sslutils.h @@ -35,8 +35,14 @@ #ifdef HAVE_OPENSSL #include "pcap/socket.h" // for PCAP_SOCKET +// If this is OpenSSL 1.0, at least one header may trigger a -Wdocumentation +// in Clang, which should not be a problem of this header or a file that +// includes it. +#include "diag-control.h" +DIAG_OFF_DOCUMENTATION #include #include +DIAG_ON_DOCUMENTATION /* * Utility functions