This patch changes config.status to write the following in config.h:

    #define TRAILING_WHITESPACE /**/

When the following lines are in configure.ac:

    trailing_whitespace=
    AC_DEFINE_UNQUOTED([TRAILING_WHITESPACE], [$trailing_whitespace],
                       [trailing whitespace])

Previously it would have trailing whitespace instead of /**/ causing
annoying GCC warnings.

Collin

>From 270018fb3dabf0c44548949aa9c9efdee73c25ed Mon Sep 17 00:00:00 2001
Message-ID: <270018fb3dabf0c44548949aa9c9efdee73c25ed.1759557576.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Fri, 3 Oct 2025 22:57:05 -0700
Subject: [PATCH] Avoid -Wtrailing-whitespace in config.h.

* lib/autoconf/status.m4: Replace empty definitions with /**/.
---
 lib/autoconf/status.m4 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index 0ac451dc..c93b095a 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -838,6 +838,10 @@ m4_define([_AC_OUTPUT_HEADERS_PREPARE]
   macro = mac2[1]
   prefix = substr(line, 1, index(line, defundef) - 1)
   if (D_is_set[macro]) {
+    # Set empty macros to /**/ to avoid -Wtrailing-whitespace.
+    if (D[macro] = " ") {
+      D[macro] = " /**/"
+    }
     # Preserve the white space surrounding the "#".
     print prefix "define", macro P[macro] D[macro]
     next
-- 
2.51.0

Reply via email to