Anybody who is interested in hacking on Wget *should* configure their Wget builds with --enable-assert. This patch will change the configure file and cause autoreconf to run for everybody. This autoreconf invokation will disable assertions in your compiled executables. Please explicitly enable assertions before continuing to hack on Wget.
-- Thanking You, Darshit Shah
From ebb6c180efb803d4117a4067561c703ca86cd4aa 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 ++++++++++++------ src/progress.c | 1 + 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index db0c489..b8eed28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 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 Darshit Shah <[email protected]> + * .gitignore: po/stamp-po should be ignored 2014-11-20 Darshit Shah <[email protected]> diff --git a/NEWS b/NEWS index 21905ef..f86f12e 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 e22bb09..791921a 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 @@ -151,6 +145,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 @@ -718,5 +723,6 @@ AC_MSG_NOTICE([Summary of build options: NTLM: $ENABLE_NTLM OPIE: $ENABLE_OPIE Debugging: $ENABLE_DEBUG + Assertions: $ENABLE_ASSERTION Valgrind: $VALGRIND_INFO ]) diff --git a/src/progress.c b/src/progress.c index e489083..cf68b91 100644 --- 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
pgpOdr5jWMmCz.pgp
Description: PGP signature
