bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

warn-on-use: stricter checking in testdirs


From: Bruno Haible
Subject: warn-on-use: stricter checking in testdirs
Date: Sun, 11 Apr 2010 19:21:39 +0200
User-agent: KMail/1.9.9

warn-on-use.h contains some code which provides warnings if GCC 4.3 or
higher is in use. And it fails if the function is not declared.
But most of my testing (Cygwin 1.5, mingw, MacOS X) is currently done
with GCC versions older than that, therefore I may miss these errors
that would occur with other compiler versions.

This fixes it, by enabling the verification (but not the warning feature)
also to all GCC versions >= 3.0. But only when gnulib-tool is used to
create a testdir. No effect on gnulib-tool --import/--update.


2010-04-11  Bruno Haible  <address@hidden>

        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.

--- gnulib-tool.orig    Sun Apr 11 19:12:19 2010
+++ gnulib-tool Sun Apr 11 19:10:22 2010
@@ -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 "  address@hidden@=1 \\"
   fi
--- build-aux/warn-on-use.h.orig        Sun Apr 11 19:12:19 2010
+++ build-aux/warn-on-use.h     Sun Apr 11 19:08:56 2010
@@ -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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]