]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Remove unwanted PACKAGE macros from c++config.h [PR79147]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 19 Sep 2025 11:11:26 +0000 (12:11 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 23 Sep 2025 09:17:09 +0000 (10:17 +0100)
Autoconf insists on adding macros like PACKAGE_NAME and
PACKAGE_BUG_TARNAME to config.h but those are useless for libstdc++
because it's not a complete package, just a sub-directory of gcc, and we
never use any of those strings in our sources.

Since we include the generated config.h in our installed c++config.h
header, those useless macros are exposed to users. We do transform them
to use the reserved _GLIBCXX_ prefix, but they're still just useless
noise in the installed header.

I don't know any way to get autoconf to not add them to config.h but
this change comments them out so they're not defined when users include
our headers.

Although not really important now that the macro isn't being defined,
this change also avoids the double substitution for PACKAGE_VERSION
which was resulting in _GLIBCXX_PACKAGE__GLIBCXX_VERSION.

libstdc++-v3/ChangeLog:

PR libstdc++/79147
* include/Makefile.am (c++config.h): Adjust sed command to
comment out all PACKAGE_XXX macros and to avoid adjusting
PACKAGE_VERSION twice.
* include/Makefile.in: Regenerate.

libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in

index 0b0cbe2d3faf8f920899847b2f07f3e41b55c82e..d1e5c3d84918df5be2b9ea89b55dd472774c24f1 100644 (file)
@@ -1420,8 +1420,8 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
        -e "$$verbose_assert" \
            < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
        sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
-           -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
-           -e 's/VERSION/_GLIBCXX_VERSION/g' \
+           -e '/PACKAGE/s,^,// ,' \
+           -e '/PACKAGE/!s/VERSION/_GLIBCXX_VERSION/g' \
            -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
            -e 's/LT_OBJDIR/_GLIBCXX_LT_OBJDIR/g' \
            -e 's/STDC_HEADERS/_GLIBCXX_STDC_HEADERS/g' \
index e3a6d5f139058e6a8fdcb1bd7923a24e72f61581..13c0b5b4f8393bb4e8904f836cd785b4a0e8e2ec 100644 (file)
@@ -1897,8 +1897,8 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
        -e "$$verbose_assert" \
            < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
        sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
-           -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
-           -e 's/VERSION/_GLIBCXX_VERSION/g' \
+           -e '/PACKAGE/s,^,// ,' \
+           -e '/PACKAGE/!s/VERSION/_GLIBCXX_VERSION/g' \
            -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
            -e 's/LT_OBJDIR/_GLIBCXX_LT_OBJDIR/g' \
            -e 's/STDC_HEADERS/_GLIBCXX_STDC_HEADERS/g' \