This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch / Request For Testers] libstdc++/34032


Hi,

as discussed in the audit trail, the issue here is that on some targets
(cygwin / newlib for sure), an undefined __STRICT_ANSI__ enables some
extensions which can appear to the autoconf tests as genuine C99
facilities: first, the risk is serious (e.g., certainly there are around
unreliable non-conforming snprintf); second, those facilities all of a
sudden disappear from the underlying C headers when the user passes
-std=c++98 (or -std=c++0x) instead of the default (ie, -std=gnu++98) and
the compilation breaks. Seems safe to me just running the sensitive
autoconf test with -std=c++98 and I also checked that nothing breaks on
gnu-linux (i.e., viceversa, __STRICT_ANSI__ doesn't disable any real C99
facility).

It would be nice if Eric could double check and possibly other test on,
eg, darwin, which normally enables as many C99 facilities as gnu-linux.

Paolo.

/////////////////
Index: configure
===================================================================
--- configure	(revision 130003)
+++ configure	(working copy)
@@ -15436,9 +15436,10 @@
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
-  # Use -fno-exceptions so that the C driver can link these tests without
-  # hitting undefined references to personality routines.
+  # The default, -std=gnu++98, does not define __STRICT_ANSI__ and some
+  # extensions (not real C99 facilities) can be spuriously enabled.
   ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=c++98"
   ac_save_LIBS="$LIBS"
   ac_save_gcc_no_link="$gcc_no_link"
 
@@ -17778,7 +17779,7 @@
 
   # Fake what AC_TRY_COMPILE does.  XXX Look at redoing this new-style.
     cat > conftest.$ac_ext << EOF
-#line 17781 "configure"
+#line 17782 "configure"
 int main()
 {
   // NB: _Atomic_word not necessarily int.
@@ -39527,6 +39528,11 @@
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
+  # The default, -std=gnu++98, does not define __STRICT_ANSI__ and some
+  # extensions (not real C99 facilities) can be spuriously enabled.
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=c++98"
+
   # Check for the existence of <complex.h> complex math functions used
   # by tr1/complex.
 
@@ -40544,6 +40550,7 @@
 done
 
 
+  CXXFLAGS="$ac_save_CXXFLAGS"
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
Index: acinclude.m4
===================================================================
--- acinclude.m4	(revision 130003)
+++ acinclude.m4	(working copy)
@@ -763,9 +763,10 @@
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
 
-  # Use -fno-exceptions so that the C driver can link these tests without
-  # hitting undefined references to personality routines.
+  # The default, -std=gnu++98, does not define __STRICT_ANSI__ and some
+  # extensions (not real C99 facilities) can be spuriously enabled.
   ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=c++98"
   ac_save_LIBS="$LIBS"
   ac_save_gcc_no_link="$gcc_no_link"
 
@@ -996,6 +997,11 @@
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
 
+  # The default, -std=gnu++98, does not define __STRICT_ANSI__ and some
+  # extensions (not real C99 facilities) can be spuriously enabled.
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=c++98"
+
   # Check for the existence of <complex.h> complex math functions used
   # by tr1/complex.
   AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
@@ -1266,6 +1272,7 @@
   # Check for the existence of the <stdbool.h> header.	
   AC_CHECK_HEADERS(stdbool.h)
 
+  CXXFLAGS="$ac_save_CXXFLAGS"
   AC_LANG_RESTORE
 ])
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]