public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-3035] libstdc++: Filter out unconditional <stdio.h> default include
Date: Mon,  3 Oct 2022 14:45:36 +0000 (GMT)	[thread overview]
Message-ID: <20221003144536.42B4A385802E@sourceware.org> (raw)

https://gcc.gnu.org/g:bcb1f4387cbec369a0a52a0acf7a6497353597a8

commit r13-3035-gbcb1f4387cbec369a0a52a0acf7a6497353597a8
Author: Arsen Arsenović <arsen@aarsen.me>
Date:   Tue Sep 27 12:20:33 2022 +0200

    libstdc++: Filter out unconditional <stdio.h> default include
    
    _AC_INCLUDES_DEFAULT_REQUIREMENTS including <stdio.h> when checking for
    stdint.h has prevented proper detection of whether stdint.h is present,
    since it'd poison the cache variables with test results failing due to
    <stdio.h> failing to include. As a solution, for autoconf versions under
    2.70, we filter out that bit of code from ac_includes_default.
    
    This issue was fixed in autoconf-2.70.
    This also applies to various other headers, but was noticed when looking
    into why HAVE_STDINT_H was misdefined.
    
    libstdc++-v3/ChangeLog:
    
            * configure.ac: Remove any lines that unconditionally include
            <stdio.h> from ac_includes_default, when running Autoconf <2.70.
            * configure: Regenerate.

Diff:
---
 libstdc++-v3/configure    | 25 +++++++++++++++++--------
 libstdc++-v3/configure.ac |  9 +++++++++
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 1ff28af2c2c..4f2c12f6b69 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -3348,6 +3348,15 @@ else
   GLIBCXX_IS_NATIVE=true
 fi
 
+# In the case that we're building without headers, we won't have <stdio.h>
+# available. In these cases, we have to instruct autotools to never include
+# <stdio.h> as a part of default headers.
+
+if test "x$with_headers" = "xno"; then
+  ac_includes_default=`echo "$ac_includes_default" | sed '/^#include <stdio.h>$/d'`
+fi
+
+
 # Sets up automake.  Must come after AC_CANONICAL_SYSTEM.  Each of the
 # following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
 #  1.x:  minimum required version
@@ -12191,7 +12200,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12194 "configure"
+#line 12203 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12297,7 +12306,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12300 "configure"
+#line 12309 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15981,7 +15990,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
   # Fake what AC_TRY_COMPILE does.
 
     cat > conftest.$ac_ext << EOF
-#line 15984 "configure"
+#line 15993 "configure"
 int main()
 {
   typedef bool atomic_type;
@@ -16016,7 +16025,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 16019 "configure"
+#line 16028 "configure"
 int main()
 {
   typedef short atomic_type;
@@ -16051,7 +16060,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 16054 "configure"
+#line 16063 "configure"
 int main()
 {
   // NB: _Atomic_word not necessarily int.
@@ -16087,7 +16096,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
-#line 16090 "configure"
+#line 16099 "configure"
 int main()
 {
   typedef long long atomic_type;
@@ -16243,7 +16252,7 @@ $as_echo "mutex" >&6; }
   # unnecessary for this test.
 
     cat > conftest.$ac_ext << EOF
-#line 16246 "configure"
+#line 16255 "configure"
 int main()
 {
   _Decimal32 d1;
@@ -16285,7 +16294,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
   # unnecessary for this test.
 
   cat > conftest.$ac_ext << EOF
-#line 16288 "configure"
+#line 16297 "configure"
 template<typename T1, typename T2>
   struct same
   { typedef T2 type; };
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index b351622bf46..c05fcdda7e9 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -58,6 +58,15 @@ else
   GLIBCXX_IS_NATIVE=true
 fi
 
+# In the case that we're building without headers, we won't have <stdio.h>
+# available. In these cases, we have to instruct autotools to never include
+# <stdio.h> as a part of default headers.
+m4_version_prereq([2.70], [], [
+if test "x$with_headers" = "xno"; then
+  ac_includes_default=`echo "$ac_includes_default" | sed '/^#include <stdio.h>$/d'`
+fi
+])
+
 # Sets up automake.  Must come after AC_CANONICAL_SYSTEM.  Each of the
 # following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
 #  1.x:  minimum required version

                 reply	other threads:[~2022-10-03 14:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221003144536.42B4A385802E@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).