]> The Tcpdump Group git mirrors - libpcap/commitdiff
Squelch Clang warnings about OpenSSL. 1286/head
authorDenis Ovsienko <[email protected]>
Sun, 3 Mar 2024 21:03:29 +0000 (21:03 +0000)
committerDenis Ovsienko <[email protected]>
Sun, 3 Mar 2024 21:19:21 +0000 (21:19 +0000)
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.

diag-control.h
sslutils.h

index 800111bf831a44644749f2b36b23ba90705d3e80..fdb7624549641167ae60a1aca882f9f29cd32451 100644 (file)
     #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))
 #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
index dd9a55566dc736321a4edc10c9df652769dac900..3a36c61b7f228e7c8f321921419c4ec71e0bca66 100644 (file)
 
 #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 <openssl/ssl.h>
 #include <openssl/err.h>
+DIAG_ON_DOCUMENTATION
 
 /*
  * Utility functions