Bruno Haible via Gnulib discussion list <[email protected]> writes:
> This patch fixes the handling multiple gnulib-tool invocations in the
> stdbit-h module.
>
> The relevant situation is when, under the same configure.ac, there are
> two gnulib-tool invocations, where one uses, say, the module 'stdc_count_ones'
> and the other one uses, say, the module 'stdc_count_zeros'. Previously,
> both lib/ directories would contain the code for both functions. Which
> is a waste of binary code size. With this patch, stdc_count_ones gets
> defined in the first lib/ directory only, and stdc_count_zeros gets
> defined in the second lib/ directory only. And with the #include_next
> scaffolding from Collin's proposed patch 0001, both function declarations
> will be visible if the package uses the appropriate -I options.
Thanks for helping with this. There is a tiny issue with this commit,
though. I assume you have a system with recent packages, so the file is
not generated and you did not notice. Here is how you can reproduce it:
$ gnulib-tool --create-testdir --dir testdir1 $(gnulib-tool --list | grep stdc_)
$ cd testdir1 && ./configure ac_cv_header_stdbit_h=no && make
[...]
gcc -DHAVE_CONFIG_H -I. -I.. -DGNULIB_STRICT_CHECKING=1 -g -O2 -MT stdbit.o
-MD -MP -MF .deps/stdbit.Tpo -c -o stdbit.o stdbit.c
In file included from stdbit.c:23:
./stdbit.h:285:5: error: #if with no expression
285 | #if
| ^
[...]
This is because the variable names in the Makefile.am do not match the
ones defined in the module indicator:
$ grep -F 'STDC_BIT_CEIL' gllib/Makefile
GL_GNULIB_GL_STDC_BIT_CEIL = 0
-e 's/@''GNULIB_STDC_BIT_CEIL''@/$(GL_GNULIB_STDC_BIT_CEIL)/g' \
I pushed the attached patch adjusting them in stdbit_h.m4, since the
other modules seem to use GNULIB_<MODULE-NAME>, i.e., without the _GL_
in the middle.
Collin
>From dbc80047d2d7fc387a80fd1b88c3cebc8dd6f6fb Mon Sep 17 00:00:00 2001
Message-ID: <dbc80047d2d7fc387a80fd1b88c3cebc8dd6f6fb.1772999532.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Sun, 8 Mar 2026 12:51:41 -0700
Subject: [PATCH] stdbit-h: Fix generated header substitutions (regr. today).
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Adjust the variable
names with 's/_GL_/_/' as expected by the Makefile.am snippet.
---
ChangeLog | 6 ++++++
m4/stdbit_h.m4 | 30 +++++++++++++++---------------
2 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 48500da1f1..a7b2ab0bc9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-03-08 Collin Funk <[email protected]>
+
+ stdbit-h: Fix generated header substitutions (regr. today).
+ * m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Adjust the variable
+ names with 's/_GL_/_/' as expected by the Makefile.am snippet.
+
2026-03-08 Bruno Haible <[email protected]>
acl-permissions: Don't stump on the system namespace.
diff --git a/m4/stdbit_h.m4 b/m4/stdbit_h.m4
index 5ef58d9e2a..997c5b2bfb 100644
--- a/m4/stdbit_h.m4
+++ b/m4/stdbit_h.m4
@@ -1,5 +1,5 @@
# stdbit_h.m4
-# serial 3
+# serial 4
dnl Copyright 2024-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -39,20 +39,20 @@ AC_DEFUN([gl_STDBIT_MODULE_INDICATOR]
AC_DEFUN([gl_STDBIT_H_REQUIRE_DEFAULTS],
[
m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDBIT_H_MODULE_INDICATOR_DEFAULTS], [
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_LEADING_ZEROS])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_LEADING_ONES])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_TRAILING_ZEROS])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_TRAILING_ONES])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_FIRST_LEADING_ZERO])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_FIRST_LEADING_ONE])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_FIRST_TRAILING_ZERO])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_FIRST_TRAILING_ONE])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_COUNT_ZEROS])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_COUNT_ONES])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_HAS_SINGLE_BIT])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_BIT_WIDTH])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_BIT_FLOOR])
- gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GL_STDC_BIT_CEIL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_LEADING_ZEROS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_LEADING_ONES])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_TRAILING_ZEROS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_TRAILING_ONES])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_FIRST_LEADING_ZERO])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_FIRST_LEADING_ONE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_FIRST_TRAILING_ZERO])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_FIRST_TRAILING_ONE])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_COUNT_ZEROS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_COUNT_ONES])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_HAS_SINGLE_BIT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_BIT_WIDTH])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_BIT_FLOOR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_BIT_CEIL])
])
m4_require(GL_MODULE_INDICATOR_PREFIX[_STDBIT_H_MODULE_INDICATOR_DEFAULTS])
AC_REQUIRE([gl_STDBIT_H_DEFAULTS])
--
2.53.0