Hi Collin,

> I have pushed the attatched patch to fix it.

The patch is not right: It assumes that AH_BOTTOM inserts a newline
after the given text. But this is not documented, therefore not guaranteed
to always happen. Therefore we might end up with garbage after the
'#endif', in the same line.

Let me fix that in a better way.


2025-09-13  Bruno Haible  <[email protected]>

        gettext-h: Avoid -Wtrailing-whitespace in a better way.
        * m4/gettext_h.m4: New file, extracted from modules/gettext-h. Add back
        the newline at the end of the AH_BOTTOM argument.
        * modules/gettext-h (Files): Add it.
        (configure.ac): Invoke gl_GETTEXT_H.

>From 0f6c3055370024529122de7b11f9c51e5482f8ee Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 14 Sep 2025 03:06:51 +0200
Subject: [PATCH] gettext-h: Avoid -Wtrailing-whitespace in a better way.

* m4/gettext_h.m4: New file, extracted from modules/gettext-h. Add back
the newline at the end of the AH_BOTTOM argument.
* modules/gettext-h (Files): Add it.
(configure.ac): Invoke gl_GETTEXT_H.
---
 ChangeLog         |  8 ++++++++
 m4/gettext_h.m4   | 21 +++++++++++++++++++++
 modules/gettext-h | 11 ++---------
 3 files changed, 31 insertions(+), 9 deletions(-)
 create mode 100644 m4/gettext_h.m4

diff --git a/ChangeLog b/ChangeLog
index b818c46a7b..b06463402c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-09-13  Bruno Haible  <[email protected]>
+
+	gettext-h: Avoid -Wtrailing-whitespace in a better way.
+	* m4/gettext_h.m4: New file, extracted from modules/gettext-h. Add back
+	the newline at the end of the AH_BOTTOM argument.
+	* modules/gettext-h (Files): Add it.
+	(configure.ac): Invoke gl_GETTEXT_H.
+
 2025-09-13  Collin Funk  <[email protected]>
 
 	gettext-h: Avoid -Wtrailing-whitespace in config.h.
diff --git a/m4/gettext_h.m4 b/m4/gettext_h.m4
new file mode 100644
index 0000000000..b4b1995c76
--- /dev/null
+++ b/m4/gettext_h.m4
@@ -0,0 +1,21 @@
+# gettext_h.m4
+# serial 1
+dnl Copyright (C) 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,
+dnl with or without modifications, as long as this notice is preserved.
+dnl This file is offered as-is, without any warranty.
+
+AC_DEFUN_ONCE([gl_GETTEXT_H],
+[
+  AC_SUBST([LIBINTL])
+  AC_SUBST([LTLIBINTL])
+  AH_BOTTOM([
+/* The text domainname for Gnulib messages.  Ordinarily this is "gnulib",
+   but packages that do their own translations of Gnulib can use something
+   different by defining GNULIB_TEXT_DOMAIN in their config.h file.  */
+#ifndef GNULIB_TEXT_DOMAIN
+# define GNULIB_TEXT_DOMAIN/**/"gnulib"
+#endif
+])
+])
diff --git a/modules/gettext-h b/modules/gettext-h
index 876514e324..ffcc7e163a 100644
--- a/modules/gettext-h
+++ b/modules/gettext-h
@@ -3,21 +3,14 @@ Translate messages to user's native language if GNU gettext is also used.
 
 Files:
 lib/gettext.h
+m4/gettext_h.m4
 
 Depends-on:
 locale-h
 vararrays
 
 configure.ac:
-AC_SUBST([LIBINTL])
-AC_SUBST([LTLIBINTL])
-AH_BOTTOM([
-/* The text domainname for Gnulib messages.  Ordinarily this is "gnulib",
-   but packages that do their own translations of Gnulib can use something
-   different by defining GNULIB_TEXT_DOMAIN in their config.h file.  */
-#ifndef GNULIB_TEXT_DOMAIN
-# define GNULIB_TEXT_DOMAIN/**/"gnulib"
-#endif])
+gl_GETTEXT_H
 
 Makefile.am:
 lib_SOURCES += gettext.h
-- 
2.50.1

Reply via email to