Clean-up *_DEBUG options.
authorAndy Polyakov <appro@openssl.org>
Wed, 6 Apr 2016 10:47:35 +0000 (12:47 +0200)
committerAndy Polyakov <appro@openssl.org>
Thu, 7 Apr 2016 19:18:00 +0000 (21:18 +0200)
Since NDEBUG is defined unconditionally on command line for release
builds, we can omit *_DEBUG options in favour of effective "all-on"
in debug builds exercised though CI.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Emilia Käsper <emilia@openssl.org>
13 files changed:
Configurations/10-main.conf
Configure
crypto/aes/aes_core.c
crypto/aes/aes_ecb.c
crypto/aes/aes_x86core.c
crypto/bio/b_print.c
crypto/blake2/blake2b.c
crypto/blake2/blake2s.c
crypto/bn/bn_asm.c
crypto/bn/bn_lib.c
crypto/bn/bn_mul.c
e_os.h
ssl/ssl_lib.c

index a36109c7992837c8be40b2b5cf7c52c915adc4a0..6b10d70c356dda1c2658c65265074252879b658c 100644 (file)
@@ -110,7 +110,7 @@ sub vms_info {
         inherit_from     => [ "BASE_unix" ],
         cc               => "gcc",
         cflags           => picker(default => "-Wall -DOPENSSL_SYS_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN",
-                                   debug   => "-O0 -g -DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG",
+                                   debug   => "-O0 -g",
                                    release => "-O3"),
         thread_scheme    => "(unknown)",
         sys_id           => "VOS",
@@ -220,8 +220,7 @@ sub vms_info {
         # -m32 should be safe to add as long as driver recognizes
         # -mcpu=ultrasparc
         inherit_from     => [ "solaris-sparcv7-gcc", asm("sparcv9_asm") ],
-        cflags           => add_before(picker(default => "-m32 -mcpu=ultrasparc",
-                                              debug   => "-DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG -DBN_CTX_DEBUG -DPEDANTIC -O -g -pedantic -ansi -Wshadow -Wno-long-long -D__EXTENSIONS__")),
+        cflags           => add_before("-m32 -mcpu=ultrasparc"),
     },
     "solaris64-sparcv9-gcc" => {
         inherit_from     => [ "solaris-sparcv9-gcc" ],
@@ -239,7 +238,7 @@ sub vms_info {
         inherit_from     => [ "solaris-common" ],
         cc               => "cc",
         cflags           => add_before(picker(default => "-xstrconst -Xa -DB_ENDIAN -DBN_DIV2W",
-                                              debug   => "-g -DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG -DBN_CTX_DEBUG",
+                                              debug   => "-g",
                                               release => "-xO5 -xdepend"),
                                        threads("-D_REENTRANT")),
         lflags           => add(threads("-mt")),
@@ -600,7 +599,7 @@ sub vms_info {
         inherit_from     => [ "BASE_unix" ],
         cc               => "gcc",
         cflags           => combine(picker(default => "-Wall",
-                                           debug   => "-O0 -g -DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG",
+                                           debug   => "-O0 -g",
                                            release => "-O3"),
                                     threads("-pthread")),
         ex_libs          => add("-ldl"),
@@ -1655,7 +1654,7 @@ sub vms_info {
     "vxworks-ppc750-debug" => {
         inherit_from     => [ "BASE_unix" ],
         cc               => "ccppc",
-        cflags           => "-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DBN_DEBUG -DREF_DEBUG -DCONF_DEBUG -DBN_CTX_DEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DDEBUG -g",
+        cflags           => "-ansi -nostdinc -DPPC750 -D_REENTRANT -fvolatile -fno-builtin -fno-for-scope -fsigned-char -Wall -msoft-float -mlongcall -DCPU=PPC604 -I\$(WIND_BASE)/target/h -DPEDANTIC -DDEBUG -g",
         sys_id           => "VXWORKS",
         lflags           => "-r",
     },
index ef5ff9f2e7727f0c827d15dfd8bb067059fe5ac2..8e42ebf170193a21bfc609a80ecdedd5ebae4842 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -77,10 +77,21 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
 # Minimum warning options... any contributions to OpenSSL should at least get
 # past these.
 
-my $gcc_devteam_warn = "-DPEDANTIC -DREF_DEBUG -DDEBUG_UNUSED -DBIO_DEBUG -DBLAKE_DEBUG"
-        . " -pedantic"
+# DEBUG_UNUSED enables __owur (warn unused result) checks.
+my $gcc_devteam_warn = "-DDEBUG_UNUSED"
+        # -DPEDANTIC complements -pedantic and is meant to mask code that
+        # is not strictly standard-compliant and/or implementation-specifc,
+        # e.g. inline assembly, disregards to alignment requirements, such
+        # that -pedantic would complain about. Incidentally -DPEDANTIC has
+        # to be used even in sanitized builds, because sanitizer too is
+        # supposed to and does take notice of non-standard behaviour. Then
+        # -pedantic with pre-C9x compiler would also complain about 'long
+        # long' not being supported. As 64-bit algorithms are common now,
+        # it grew impossible to resolve this without sizeable additional
+        # code, so we just tell compiler to be pedantic about everything
+        # but 'long long' type.
+        . " -DPEDANTIC -pedantic -Wno-long-long"
         . " -Wall"
-        . " -Wno-long-long"
         . " -Wsign-compare"
         . " -Wmissing-prototypes"
         . " -Wshadow"
index 326cc569caedb58cc4f481a45e5577f3aa522f22..837d4feb9f65c858482ad833b67436c42c5ce56d 100644 (file)
 /* Note: rewritten a little bit to provide error control and an OpenSSL-
    compatible API */
 
-#ifndef AES_DEBUG
-# ifndef NDEBUG
-#  define NDEBUG
-# endif
-#endif
 #include <assert.h>
 
 #include <stdlib.h>
index 61cb0e73584aa48787e63e849098173fc5bc68c4..6639c783c47f3f5afd55732dab02c0dac4b329d0 100644 (file)
  *
  */
 
-#ifndef AES_DEBUG
-# ifndef NDEBUG
-#  define NDEBUG
-# endif
-#endif
 #include <assert.h>
 
 #include <openssl/aes.h>
index 400884aff5197c401667f44eea46171b09b0cd1d..1b64f5b65b6c767933a149257356e0040a8559fb 100644 (file)
  */
 
 
-#ifndef AES_DEBUG
-# ifndef NDEBUG
-#  define NDEBUG
-# endif
-#endif
 #include <assert.h>
 
 #include <stdlib.h>
index 17ea8af6784889ed15bacd218351b757d42509d5..72a2ee849b27465717e67b1f68da60cc48b1134b 100644 (file)
  * [including the GNU Public Licence.]
  */
 
-/* disable assert() unless BIO_DEBUG has been defined */
-#ifndef BIO_DEBUG
-# ifndef NDEBUG
-#  define NDEBUG
-# endif
-#endif
-
 /*
  * Stolen from tjh's ssl/ssl_trc.c stuff.
  */
index 672210a751fc930676ca3551458f4cb2475161c7..8e92a0a8bef642b6e2dfe2fc35ded82f5475a190 100644 (file)
  * can be found at https://blake2.net.
  */
 
-#ifndef BLAKE_DEBUG
-# undef NDEBUG                  /* avoid conflicting definitions */
-# define NDEBUG
-#endif
-
 #include <assert.h>
 #include <string.h>
 #include <openssl/crypto.h>
index 03295c08b6e656cc57b6f0f3ecdfe82a9acb84ec..227fa10edc3cfabe7ecca824ed588ce041278bfe 100644 (file)
  * can be found at https://blake2.net.
  */
 
-#ifndef BLAKE_DEBUG
-# undef NDEBUG                  /* avoid conflicting definitions */
-# define NDEBUG
-#endif
-
 #include <assert.h>
 #include <string.h>
 #include <openssl/crypto.h>
index 9e9bce905287bde1b9dc98f2eb35e461d67bb887..4c67d280925756b2309189b05de0abc757ac2351 100644 (file)
  * [including the GNU Public Licence.]
  */
 
-#ifndef BN_DEBUG
-# undef NDEBUG                  /* avoid conflicting definitions */
-# define NDEBUG
-#endif
-
 #include <assert.h>
 #include <openssl/crypto.h>
 #include "internal/cryptlib.h"
index ce9f768cdb149b60db829645f80d2ed5aa584259..4b37906319fc96e72975f33be0a3a72beb7cae37 100644 (file)
  * [including the GNU Public Licence.]
  */
 
-#ifndef BN_DEBUG
-# undef NDEBUG                  /* avoid conflicting definitions */
-# define NDEBUG
-#endif
-
 #include <assert.h>
 #include <limits.h>
 #include "internal/cryptlib.h"
index 7d4cd31004e3df0aca60b2c0967b26f304dde6ad..0d2a743cc7cd5a2195f7814d21663fb4796b0a7a 100644 (file)
  * [including the GNU Public Licence.]
  */
 
-#ifndef BN_DEBUG
-# undef NDEBUG                  /* avoid conflicting definitions */
-# define NDEBUG
-#endif
-
 #include <assert.h>
 #include "internal/cryptlib.h"
 #include "bn_lcl.h"
diff --git a/e_os.h b/e_os.h
index f0a441ec8bfcc475acd567e8484601247752d028..648035d59b0fa68e2bb0b5d167e7e09747ba94b7 100644 (file)
--- a/e_os.h
+++ b/e_os.h
@@ -72,15 +72,12 @@ extern "C" {
 
 /* Used to checking reference counts, most while doing perl5 stuff :-) */
 # if defined(OPENSSL_NO_STDIO)
-#  if defined(REF_DEBUG)
-#   error "REF_DEBUG requires stdio"
-#  endif
 #  if defined(REF_PRINT)
 #   error "REF_PRINT requires stdio"
 #  endif
 # endif
 
-# if defined(REF_DEBUG)
+# if !defined(NDEBUG) && !defined(OPENSSL_NO_STDIO)
 #  define REF_ASSERT_ISNT(test) \
     (void)((test) ? (OPENSSL_die("refcount error", __FILE__, __LINE__), 1) : 0)
 # else
index 5a6e6a7060cc8abc0c3f6ef348f88fdd1d639c47..e7f90ec7f0a9dfd78a445ee50d1266d516f0a86f 100644 (file)
  * OTHERWISE.
  */
 
-#ifdef REF_DEBUG
-# include <assert.h>
-#endif
+#include <assert.h>
 #include <stdio.h>
 #include "ssl_locl.h"
 #include <openssl/objects.h>
@@ -3318,13 +3316,7 @@ void ssl_free_wbio_buffer(SSL *s)
     if (s->bbio == s->wbio) {
         /* remove buffering */
         s->wbio = BIO_pop(s->wbio);
-#ifdef REF_DEBUG
-        /*
-         * not the usual REF_DEBUG, but this avoids
-         * adding one more preprocessor symbol
-         */
         assert(s->wbio != NULL);
-#endif
     }
     BIO_free(s->bbio);
     s->bbio = NULL;