On 11/20, Ángel González wrote:
On 20/11/14 15:29, Darshit Shah wrote:
--- a/src/progress.c
+++ b/src/progress.c
@@ -992,6 +992,7 @@ create_image (struct bar_progress *bp, double 
dl_total_time, bool done)
     {
       int percentage = 100.0 * size / bp->total_length;
       assert (percentage<= 100);
+      assert (false);

       if (percentage<  100)
         sprintf (p, "%3d%%", percentage);
-- 2.1.3
Surely you didn't want to include this :)

Shit! No, that was meant to be for my own debugging purposes. I was trying to see if I could induce an assertion failure. Good thing the patch goes through review first.

I've fixed this in the attached patch.

--
Thanking You,
Darshit Shah
From 61f4228fc4090346199c3b773f2945b6a81205a9 Mon Sep 17 00:00:00 2001
From: Darshit Shah <[email protected]>
Date: Thu, 20 Nov 2014 19:55:51 +0530
Subject: [PATCH] Assertions are now disabled by default

---
 ChangeLog       |  7 +++++++
 NEWS            |  2 +-
 README.checkout | 10 +++++++++-
 configure.ac    | 18 ++++++++++++------
 4 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9fb175e..5c45b0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-11-20  Darshit Shah  <[email protected]>
+
+	* configure.ac: Change option to --enable-assert. Assertions are disabled by
+	default.
+	* NEWS: Edit to reflect default option.
+	* README.checkout: Document --enable-assert for developers
+
 2014-11-20  Tim Ruehsen <[email protected]>
 
 	* configure.ac: Fix libpsl<0.6.0 detection
diff --git a/NEWS b/NEWS
index 4fc61c1..50e41ad 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,7 @@ Please send GNU Wget bug reports to <[email protected]>.
 
 * Changes in Wget X.Y.Z
 
-** Add --disable-assert configure option. Recommended for distro maintainers.
+** Add --enable-assert configure option.
 
 ** Use pkg-config to check for libraries presence.
 
diff --git a/README.checkout b/README.checkout
index 0513bfe..2bfc83f 100644
--- a/README.checkout
+++ b/README.checkout
@@ -85,12 +85,20 @@ Compiling From Repository Sources
        configuring the package:
  $  ./bootstrap
     3. Configure the package and compile it:
- $  ./configure [some_parameters]
+ $  ./configure --enable-assert [some_parameters]
  $  make
     4. Hack, compile, test, hack, compile, test...
  $  src/wget --version
  GNU Wget 1.12-devel (9cb2563197bc)
 
+ All developers are requested to enable the assertions on their development
+ builds to ensure a stable codebase. Assertions are added to state certain
+ assumptions about the code and its data which all developers should be mindful
+ of. To enable assertions, run the configure command with the --enable-assert
+ option, like this:
+
+ $ ./configure --enable-assert [other configure options]
+
  Copyright � 2008,2010 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later
  <http://www.gnu.org/licenses/gpl.html>.
diff --git a/configure.ac b/configure.ac
index 3ad8703..43949a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,12 +57,6 @@ AC_CANONICAL_HOST
 AC_DEFINE_UNQUOTED([OS_TYPE], "$host_os",
                    [Define to be the name of the operating system.])
 
-dnl
-dnl Add option to disable Assertions
-dnl
-dnl Adds a --disable-assert option to ./configure which can be used by distro
-dnl maintainers to compile without assertions.
-AC_HEADER_ASSERT
 
 dnl
 dnl Process External Libraries
@@ -148,6 +142,17 @@ AS_IF([test "x$ENABLE_VALGRIND" != xno], [
   VALGRIND_INFO="Valgrind testing not enabled"
 ])
 
+AC_ARG_ENABLE(assert,
+  [AS_HELP_STRING([--enable-assert], [enable assertions in code base])],
+  [ENABLE_ASSERTION=$enableval],
+  [ENABLE_ASSERTION=no]
+)
+
+AS_IF([test "x$ENABLE_ASSERTION" != xyes], [
+  CFLAGS="-DNDEBUG $CFLAGS"
+  ],
+  [])
+
 dnl
 dnl Find the compiler
 dnl
@@ -717,5 +722,6 @@ AC_MSG_NOTICE([Summary of build options:
   NTLM:              $ENABLE_NTLM
   OPIE:              $ENABLE_OPIE
   Debugging:         $ENABLE_DEBUG
+  Assertions:        $ENABLE_ASSERTION
   Valgrind:          $VALGRIND_INFO
 ])
-- 
2.1.3

Attachment: pgpkgPP748TME.pgp
Description: PGP signature

Reply via email to