Add -Wundef to strict-warnings
authorRich Salz <rsalz@openssl.org>
Thu, 23 Feb 2017 14:48:49 +0000 (09:48 -0500)
committerRich Salz <rsalz@openssl.org>
Thu, 23 Feb 2017 14:48:49 +0000 (09:48 -0500)
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/2709)

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
test/testutil.h

index 9a25da5e81562bed5ce4326e8f7074ca31866af1..38081c44a131d632768e08f4d4c2671c7e8a2149 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -121,6 +121,7 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED"
         . " -Wshadow"
         . " -Wformat"
         . " -Wtype-limits"
+        . " -Wundef"
         . " -Werror"
         ;
 
@@ -143,6 +144,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 15f0e4fc87e2537f04a1e5fc199d895cc4d1a20a..836bca505edcaae9ce46a6d8534dc884595692b2 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 919d8c1e7ff95c66f477dc0cf6a645957b0c8d64..f87dc7db993ad26125187c8d984f69e9a4416a19 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 14b7b09800c9295ff9d2602476a38bf7e7f163ac..aaaee2780eaa85dd89d10519fa9b7d4b79e5a85b 100644 (file)
@@ -56,7 +56,7 @@
  * 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