]> Savannah Git Hosting - gnulib.git/commitdiff
Pacify gcc -Wtrailing-whitespace warnings across all of config.h.
authorBruno Haible <bruno@clisp.org>
Fri, 18 Apr 2025 17:47:03 +0000 (19:47 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 18 Apr 2025 17:57:26 +0000 (19:57 +0200)
* m4/gnulib-common.m4 (gl_COMMON_BODY): Use AH_TOP and AH_BOTTOM to
disable -Wtrailing-whitespace warnings across all of config.h.
* m4/iconv.m4: Revert last change.

ChangeLog
m4/gnulib-common.m4
m4/iconv.m4

index 0ba5ea3109e6e36119288b52024b152a959e3085..f93e002d6e12750793ccaef4ef92dedb2dad3394 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-04-18  Bruno Haible  <bruno@clisp.org>
+
+       Pacify gcc -Wtrailing-whitespace warnings across all of config.h.
+       * m4/gnulib-common.m4 (gl_COMMON_BODY): Use AH_TOP and AH_BOTTOM to
+       disable -Wtrailing-whitespace warnings across all of config.h.
+       * m4/iconv.m4: Revert last change.
+
 2025-04-18  Bruno Haible  <bruno@clisp.org>
 
        unitypes-h: Avoid risky coding pattern.
index 86cec5f674c6a5f9dd4d2f3f0ca0bd5997c991b9..daf05db2a4750ea306194581c95852814e84ebea 100644 (file)
@@ -1,5 +1,5 @@
 # gnulib-common.m4
-# serial 108
+# serial 109
 dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -20,6 +20,20 @@ AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([0witness],
 [/* Witness that <config.h> has been included.  */
 #define _GL_CONFIG_H_INCLUDED 1
+])
+  dnl Avoid warnings from gcc -Wtrailing-whitespace.
+  dnl This is a temporary workaround until Autoconf fixes it.
+  dnl Test case:
+  dnl empty1=; empty2=; AC_DEFINE_UNQUOTED([FOO], [$empty1$empty2], [...])
+  dnl should produce "#define FOO /**/", not "#define FOO ".
+  AH_TOP([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wtrailing-whitespace"
+#endif
+])
+  AH_BOTTOM([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
+# pragma GCC diagnostic pop
+#endif
 ])
   AH_VERBATIM([_GL_GNUC_PREREQ],
 [/* True if the compiler says it groks GNU C version MAJOR.MINOR.
index 09ab1dc825fa21b49858e5ca2ce56db45991c5cb..915c45ad15179936c4349989e82d529e4d8953d0 100644 (file)
@@ -1,5 +1,5 @@
 # iconv.m4
-# serial 29
+# serial 30
 dnl Copyright (C) 2000-2002, 2007-2014, 2016-2025 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -82,7 +82,7 @@ AC_DEFUN([AM_ICONV_LINK],
         LIBS="$LIBS $LIBICONV"
       fi
       am_cv_func_iconv_works=no
-      for ac_iconv_const in '/*empty*/' 'const'; do
+      for ac_iconv_const in '' 'const'; do
         AC_RUN_IFELSE(
           [AC_LANG_PROGRAM(
              [[
@@ -292,7 +292,7 @@ size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, si
     gl_cv_iconv_nonconst=yes
   fi
   if test $gl_cv_iconv_nonconst = yes; then
-    iconv_arg1="/*empty*/"
+    iconv_arg1=""
   else
     iconv_arg1="const"
   fi
@@ -301,7 +301,10 @@ size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, si
   dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
   m4_ifdef([gl_ICONV_H_DEFAULTS],
     [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
-     ICONV_CONST=$iconv_arg1])
+     if test $gl_cv_iconv_nonconst != yes; then
+       ICONV_CONST="const"
+     fi
+    ])
 
   dnl A summary result, for those packages which want to print a summary at the
   dnl end of the configuration.