This patch addresses two issues with the libstdc++ testsuite:

  * duplicate "-g -O2" CXXFLAGS
  * missing "-g -O2" for remote targets

The duplicate "-g -O2" flags is a result of testsuite_flags.in using
build-time CXXFLAGS and proc libstdc++_init using the environmental
CXXFLAGS, which defaults to its build-time value. This patch prevents
testsuite_flags.in from using build-time CXXFLAGS.

Certain remote targets require a minimum optimization level -O1 in order
to pass several atomics built-in function tests. This patch ensures
cxxflags contains "-g -O2" at minimum when no other optimization flags
are specified. The testsuite used to set those flags prior to Benjamin's
patch to remove duplicate cxxflags here
<http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01572.html>.

Is this OK for trunk? If so, please apply.

Thanks,
Cesar
2013-10-28  Cesar Philippidis  <ce...@codesourcery.com>

        libstdc++-v3/
        * scripts/testsuite_flags.in (cxxflags): Don't use build-time
        CXXFLAGS and EXTRA_CXX_FLAGS.
        * testsuite/lib/libstdc++.exp (libstdc++_init): Ensure, at minimum,
        cxxflags contains "-g -O2".

diff --git a/libstdc++-v3/scripts/testsuite_flags.in 
b/libstdc++-v3/scripts/testsuite_flags.in
index d7710ca..35b36e7 100755
--- a/libstdc++-v3/scripts/testsuite_flags.in
+++ b/libstdc++-v3/scripts/testsuite_flags.in
@@ -55,7 +55,7 @@ case ${query} in
       ;;
     --cxxflags)
       CXXFLAGS_default="-D_GLIBCXX_ASSERT -fmessage-length=0"
-      CXXFLAGS_config="@SECTION_FLAGS@ @CXXFLAGS@ @EXTRA_CXX_FLAGS@"
+      CXXFLAGS_config="@SECTION_FLAGS@"
       echo ${CXXFLAGS_default} ${CXXFLAGS_config}
       ;;
     --cxxparallelflags)
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp 
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 51ff6dd..68dcb15 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -265,6 +265,15 @@ proc libstdc++_init { testfile } {
     }
     append cxxflags " "
     append cxxflags [getenv CXXFLAGS]
+
+    if {$cxxflags == "-D_GLIBCXX_ASSERT -fmessage-length=0 "} {
+       append cxxflags "-g"
+    }
+
+    if ![regexp "\-O" $cxxflags] {
+       append cxxflags " -O2"
+    }
+
     v3track cxxflags 2
 
     # Always use MO files built by this test harness.

Reply via email to