From ff19eeafbee6c35dc17baf7259e186481cfd5847 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 18 Apr 2025 19:47:03 +0200 Subject: [PATCH] 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. --- ChangeLog | 7 +++++++ m4/gnulib-common.m4 | 16 +++++++++++++++- m4/iconv.m4 | 11 +++++++---- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0ba5ea3109..f93e002d6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-04-18 Bruno Haible + + 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 unitypes-h: Avoid risky coding pattern. diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 86cec5f674..daf05db2a4 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -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 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. diff --git a/m4/iconv.m4 b/m4/iconv.m4 index 09ab1dc825..915c45ad15 100644 --- a/m4/iconv.m4 +++ b/m4/iconv.m4 @@ -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 . 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. -- 2.39.5