From: Bruno Haible Date: Sun, 11 Apr 2010 17:21:20 +0000 (+0200) Subject: Stricter declaration checking in testdirs. X-Git-Tag: v0.1~4270 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=c4816327785a6cc48463453c72f2362b8de63269;p=gnulib.git Stricter declaration checking in testdirs. --- diff --git a/ChangeLog b/ChangeLog index 5c62459c5..e15689460 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-04-11 Bruno Haible + + Stricter declaration checking in testdirs. + * gnulib-tool (func_emit_lib_Makefile_am, func_emit_tests_Makefile_am): + If for_tests is true, augment AM_CPPFLAGS to define + GNULIB_STRICT_CHECKING. + * build-aux/warn-on-use.h (_GL_WARN_ON_USE, _GL_WARN_ON_USE_CXX): When + GNULIB_STRICT_CHECKING is defined, verify that the function is + declared. + 2010-04-11 Paolo Bonzini Bruno Haible diff --git a/build-aux/warn-on-use.h b/build-aux/warn-on-use.h index 37b6d2986..d418ad6f6 100644 --- a/build-aux/warn-on-use.h +++ b/build-aux/warn-on-use.h @@ -67,7 +67,10 @@ /* A compiler attribute is available in gcc versions 4.3.0 and later. */ # define _GL_WARN_ON_USE(function, message) \ extern __typeof__ (function) function __attribute__ ((__warning__ (message))) - +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE(function, message) \ +extern __typeof__ (function) function # else /* Unsupported. */ # define _GL_WARN_ON_USE(function, message) \ _GL_WARN_EXTERN_C int _gl_warn_on_use @@ -85,6 +88,10 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ extern rettype function parameters_and_attributes \ __attribute__ ((__warning__ (msg))) +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ +extern rettype function parameters_and_attributes # else /* Unsupported. */ # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ _GL_WARN_EXTERN_C int _gl_warn_on_use diff --git a/gnulib-tool b/gnulib-tool index 407a96f92..d480f1ee5 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -2781,7 +2781,11 @@ func_emit_lib_Makefile_am () done if test -z "$makefile_name"; then echo - echo "AM_CPPFLAGS =" + if $for_test; then + echo "AM_CPPFLAGS = -DGNULIB_STRICT_CHECKING=1" + else + echo "AM_CPPFLAGS =" + fi echo "AM_CFLAGS =" fi echo @@ -3066,6 +3070,9 @@ func_emit_tests_Makefile_am () done echo echo "AM_CPPFLAGS = \\" + if $for_test; then + echo " -DGNULIB_STRICT_CHECKING=1 \\" + fi if test -n "${witness_macro}"; then echo " -D@${witness_macro}@=1 \\" fi