changeset 13217:885b58a1c02f

Stricter declaration checking in testdirs.
author Bruno Haible <bruno@clisp.org>
date Sun, 11 Apr 2010 19:21:20 +0200
parents a46be6280f4e
children 4bfbd08627bf
files ChangeLog build-aux/warn-on-use.h gnulib-tool
diffstat 3 files changed, 26 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-04-11  Bruno Haible  <bruno@clisp.org>
+
+	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  <bonzini@gnu.org>
             Bruno Haible  <bruno@clisp.org>
 
--- 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 @@
 #  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
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -2781,7 +2781,11 @@
   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 @@
   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