Stricter declaration checking in testdirs.
authorBruno Haible <bruno@clisp.org>
Sun, 11 Apr 2010 17:21:20 +0000 (19:21 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 11 Apr 2010 17:21:20 +0000 (19:21 +0200)
ChangeLog
build-aux/warn-on-use.h
gnulib-tool

index 5c62459..e156894 100644 (file)
--- 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>
 
index 37b6d29..d418ad6 100644 (file)
 /* 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
index 407a96f..d480f1e 100755 (executable)
@@ -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