Add -Wundef to --strict-warnings options.
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Thu, 23 Feb 2017 13:52:23 +0000 (14:52 +0100)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 24 Feb 2017 08:21:59 +0000 (09:21 +0100)
Avoid a -Wundef warning in refcount.h
Avoid a -Wundef warning in o_str.c
Avoid a -Wundef warning in testutil.h
Include internal/cryptlib.h before openssl/stack.h
to avoid use of undefined symbol OPENSSL_API_COMPAT.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2712)

Configure
crypto/o_str.c
crypto/x509/x509_att.c
crypto/x509/x509_ext.c
crypto/x509/x509_v3.c
crypto/x509/x509name.c
crypto/x509/x_all.c
include/internal/refcount.h
test/testutil.h

index e24980ac8fe0e494506e5070b64c603e2d13fd35..4404963aa77d532812ca2879da66693510a9c550 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -124,6 +124,7 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED"
         . " -Wshadow"
         . " -Wformat"
         . " -Wtype-limits"
+        . " -Wundef"
         . " -Werror"
         ;
 
@@ -147,6 +148,7 @@ my $clang_devteam_warn = ""
         . " -Wconditional-uninitialized"
         . " -Wincompatible-pointer-types-discards-qualifiers"
         . " -Wmissing-variable-declarations"
+        . " -Wundef"
         ;
 
 # This adds backtrace information to the memory leak info.  Is only used
index beabec0ddc14a75b5ca3dab3a97aa93818695ae2..d8516c27bbbede979a5d428fca1ec8be63765ed6 100644 (file)
@@ -227,7 +227,8 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen)
     return !strerror_s(buf, buflen, errnum);
 #elif defined(_GNU_SOURCE)
     return strerror_r(errnum, buf, buflen) != NULL;
-#elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
+#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \
+      (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600)
     /*
      * We can use "real" strerror_r. The OpenSSL version differs in that it
      * gives 1 on success and 0 on failure for consistency with other OpenSSL
index a91f9829b5629752422e23928c2921ff79eecb42..3876a83323529c70f77445dfebe472a1b71edfb2 100644 (file)
@@ -8,8 +8,8 @@
  */
 
 #include <stdio.h>
-#include <openssl/stack.h>
 #include "internal/cryptlib.h"
+#include <openssl/stack.h>
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
index 3bbb0a6b6ced187b7753bdbee538ffb51fa9b5dc..3c59079852f59d084eaac95e7da01386e1d47715 100644 (file)
@@ -8,8 +8,8 @@
  */
 
 #include <stdio.h>
-#include <openssl/stack.h>
 #include "internal/cryptlib.h"
+#include <openssl/stack.h>
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
index ad126efebaede19250b793209a4cd6eb8db9c085..213e762f986bd1d29c959554bfab00e0edf5a130 100644 (file)
@@ -8,8 +8,8 @@
  */
 
 #include <stdio.h>
-#include <openssl/stack.h>
 #include "internal/cryptlib.h"
+#include <openssl/stack.h>
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
index ab53794741cd7304a6cccbc4c78b54ff133a8520..2935b17af967760589b1745998c973d1dfc300af 100644 (file)
@@ -8,8 +8,8 @@
  */
 
 #include <stdio.h>
-#include <openssl/stack.h>
 #include "internal/cryptlib.h"
+#include <openssl/stack.h>
 #include <openssl/asn1.h>
 #include <openssl/objects.h>
 #include <openssl/evp.h>
index 124dd2d2f8dc8c8ae288db8532f2231a43819cd1..42bd161185b3ad49cdc9e8166d1853c1966d864b 100644 (file)
@@ -8,8 +8,8 @@
  */
 
 #include <stdio.h>
-#include <openssl/stack.h>
 #include "internal/cryptlib.h"
+#include <openssl/stack.h>
 #include <openssl/buffer.h>
 #include <openssl/asn1.h>
 #include <openssl/evp.h>
index b83e05c4cc236dd8c065dae568ffb797dc1f00d6..591561ffeeb7e4a4ebe7ee8f1b005b7c378cf15a 100644 (file)
@@ -9,12 +9,14 @@
 #ifndef HEADER_INTERNAL_REFCOUNT_H
 # define HEADER_INTERNAL_REFCOUNT_H
 
-# if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__)
+# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
+     && !defined(__STDC_NO_ATOMICS__)
 # include <stdatomic.h>
 # define HAVE_C11_ATOMICS
 # endif
 
-# if defined(HAVE_C11_ATOMICS) && ATOMIC_INT_LOCK_FREE > 0
+# if defined(HAVE_C11_ATOMICS) && defined(ATOMIC_INT_LOCK_FREE) \
+     && ATOMIC_INT_LOCK_FREE > 0
 
 # define HAVE_ATOMICS 1
 
index 39b6d0e6f1c1e0b6adcb7160a99ed9d085434e91..cc2f15306c9c6171078bf2682144bfa41c850ac3 100644 (file)
  * TEST_CASE_NAME is defined as the name of the test case function where
  * possible; otherwise we get by with the file name and line number.
  */
-# if __STDC_VERSION__ < 199901L
+# if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
 #  if defined(_MSC_VER)
 #   define TEST_CASE_NAME __FUNCTION__
 #  else