From: Wouter Wijngaards Date: Mon, 14 Jan 2008 09:51:20 +0000 (+0000) Subject: - in no debug sets NDEBUG to remove asserts. X-Git-Tag: release-0.9~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b08436c4c3dc7fd177c59a8aba06a0521484655;p=thirdparty%2Funbound.git - in no debug sets NDEBUG to remove asserts. - configure --enable-debug is needed for dependency generation for assertions and for compiler warnings. - ldns.tgz updated with ldns-trunk (where buffer.h is updated). git-svn-id: file:///svn/unbound/trunk@845 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/Makefile.in b/Makefile.in index fedf9faa6..a5db3dcec 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,9 +1,13 @@ # Copyright 2007 NLnet Labs # See the file LICENSE for the license -# -# Standard installation pathnames -QUIET=yes +debug_enabled=@debug_enabled@ +ifeq ($(debug_enabled),yes) + QUIET=yes +else + QUIET=no +endif + ifeq "$(QUIET)" "yes" Q=@ INFO=@echo @@ -262,6 +266,8 @@ $(BUILD)%.d: $(srcdir)/%.c ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),realclean) +ifeq ($(debug_enabled),yes) -include $(addprefix $(BUILD),$(ALL_SRC:.c=.d)) endif endif +endif diff --git a/config.h.in b/config.h.in index 8d92639d5..8739093c2 100644 --- a/config.h.in +++ b/config.h.in @@ -194,6 +194,9 @@ /* use statistics for allocs and frees, for debug use */ #undef UNBOUND_ALLOC_STATS +/* define this to enable debug checks. */ +#undef UNBOUND_DEBUG + /* Define if you want to use internal select based events */ #undef USE_MINI_EVENT @@ -287,6 +290,10 @@ #undef vfork +#ifndef UNBOUND_DEBUG +# define NDEBUG +#endif + #include #include #include diff --git a/configure b/configure index 3e3ff5b76..45b97120b 100755 --- a/configure +++ b/configure @@ -812,6 +812,7 @@ CPP GREP EGREP ub_conf_file +debug_enabled libtool AR doxygen @@ -1430,6 +1431,8 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-debug Enable debug warnings, asserts, + makefile-dependencies --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] @@ -4179,6 +4182,15 @@ echo "${ECHO_T}no" >&6; } fi # flag warnings. +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then + enableval=$enable_debug; +fi + +debug_enabled="$enable_debug" + +case "$enable_debug" in + yes) { echo "$as_me:$LINENO: checking whether $CC supports -W" >&5 @@ -4304,6 +4316,16 @@ echo "${ECHO_T}no" >&6; } fi +cat >>confdefs.h <<\_ACEOF +#define UNBOUND_DEBUG +_ACEOF + + ;; + no|*) + # nothing to do. + ;; +esac + { echo "$as_me:$LINENO: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6; } if test "${ac_cv_c_inline+set}" = set; then @@ -5628,7 +5650,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5631 "configure"' > conftest.$ac_ext + echo '#line 5653 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6930,11 +6952,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6933: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6955: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6937: \$? = $ac_status" >&5 + echo "$as_me:6959: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7198,11 +7220,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7201: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7223: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7205: \$? = $ac_status" >&5 + echo "$as_me:7227: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7302,11 +7324,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7305: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7327: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7309: \$? = $ac_status" >&5 + echo "$as_me:7331: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8767,7 +8789,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 8770 "configure"' > conftest.$ac_ext + echo '#line 8792 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9631,7 +9653,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12092: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12074: \$? = $ac_status" >&5 + echo "$as_me:12096: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12171,11 +12193,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12174: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12196: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12178: \$? = $ac_status" >&5 + echo "$as_me:12200: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12707,7 +12729,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 12710 "configure"' > conftest.$ac_ext + echo '#line 12732 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -13762,11 +13784,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13765: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13787: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13769: \$? = $ac_status" >&5 + echo "$as_me:13791: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13866,11 +13888,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13869: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13891: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13873: \$? = $ac_status" >&5 + echo "$as_me:13895: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15311,7 +15333,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 15314 "configure"' > conftest.$ac_ext + echo '#line 15336 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -16085,11 +16107,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16088: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16110: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16092: \$? = $ac_status" >&5 + echo "$as_me:16114: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16353,11 +16375,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16356: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16378: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16360: \$? = $ac_status" >&5 + echo "$as_me:16382: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16457,11 +16479,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16460: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16482: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16464: \$? = $ac_status" >&5 + echo "$as_me:16486: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17922,7 +17944,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 17925 "configure"' > conftest.$ac_ext + echo '#line 17947 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -25241,6 +25263,7 @@ CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim ub_conf_file!$ub_conf_file$ac_delim +debug_enabled!$debug_enabled$ac_delim libtool!$libtool$ac_delim AR!$AR$ac_delim doxygen!$doxygen$ac_delim @@ -25275,7 +25298,7 @@ ldnsdir!$ldnsdir$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 81; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index 992e80d62..850162a7c 100644 --- a/configure.ac +++ b/configure.ac @@ -223,10 +223,21 @@ int test() { CHECK_COMPILER_FLAG(xO4, [CFLAGS="$CFLAGS -xO4"]) CHECK_COMPILER_FLAG(xtarget=generic, [CFLAGS="$CFLAGS -xtarget=generic"]) # flag warnings. -CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"]) -CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"]) -CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"]) -CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"]) +AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debug warnings, asserts, makefile-dependencies])) +debug_enabled="$enable_debug" +AC_SUBST(debug_enabled) +case "$enable_debug" in + yes) + CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"]) + CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"]) + CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"]) + CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"]) + AC_DEFINE([UNBOUND_DEBUG], [], [define this to enable debug checks.]) + ;; + no|*) + # nothing to do. + ;; +esac AC_C_INLINE @@ -620,6 +631,10 @@ AC_DEFINE(HAVE_GETADDRINFO) AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [5120], [Define to the maximum message length to pass to syslog.]) AH_BOTTOM([ +#ifndef UNBOUND_DEBUG +# define NDEBUG +#endif + #include #include #include diff --git a/doc/Changelog b/doc/Changelog index 7081617f7..978392fe0 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,9 @@ +14 January 2008: Wouter + - in no debug sets NDEBUG to remove asserts. + - configure --enable-debug is needed for dependency generation + for assertions and for compiler warnings. + - ldns.tgz updated with ldns-trunk (where buffer.h is updated). + 11 January 2008: Wouter - man page, warning removed. - added text describing the use of stub zones for private zones. diff --git a/ldns-src.tar.gz b/ldns-src.tar.gz index 79cba33f1..89c19869f 100644 Binary files a/ldns-src.tar.gz and b/ldns-src.tar.gz differ diff --git a/util/log.h b/util/log.h index fb4096375..f69af339d 100644 --- a/util/log.h +++ b/util/log.h @@ -151,12 +151,10 @@ void fatal_exit(const char* format, ...) ATTR_FORMAT(printf, 1, 2); */ void log_vmsg(int pri, const char* type, const char* format, va_list args); -/** always assert for now. */ -#define UNBOUND_ASSERT 1 /** * an assertion that is thrown to the logfile. */ -#ifdef UNBOUND_ASSERT +#ifdef UNBOUND_DEBUG # define log_assert(x) \ do { if(!(x)) \ fatal_exit("%s:%d: %s: assertion %s failed", \