]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/21674 (basic_string vs debug_mode)
authorBenjamin Kosnik <bkoz@redhat.com>
Thu, 15 Sep 2005 18:58:02 +0000 (18:58 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Thu, 15 Sep 2005 18:58:02 +0000 (18:58 +0000)
2005-09-15  Benjamin Kosnik  <bkoz@redhat.com>

PR libstdc++/21674
PR libstdc++/22205
PR libstdc++/22222
* include/bits/c++config: Set _GLIBCXX_STD regardless of __GXX_WEAK__.
Add in check for __NO_INLINE__ for warning.
* testsuite/lib/dg-options.exp (dg-require-debug-mode): New.
* testsuite/lib/libstdc++.exp (check_v3_target_debug_mode): New.
* testsuite/21_strings/basic_string/element_access/char/21674.cc:
Use it.
* testsuite/21_strings/basic_string/element_access/wchar_t/21674.cc:
Use it.

From-SVN: r104314

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/c++config
libstdc++-v3/testsuite/21_strings/basic_string/element_access/char/21674.cc
libstdc++-v3/testsuite/21_strings/basic_string/element_access/wchar_t/21674.cc
libstdc++-v3/testsuite/lib/dg-options.exp
libstdc++-v3/testsuite/lib/libstdc++.exp

index 1d8713e473eb20725f8996d5eb1a14db46250b5e..ddb1b38d8d5e2dc3f1240f5d761d1617c7dd67aa 100644 (file)
@@ -1,3 +1,17 @@
+2005-09-15  Benjamin Kosnik  <bkoz@redhat.com>
+
+       PR libstdc++/21674
+       PR libstdc++/22205
+       PR libstdc++/22222
+       * include/bits/c++config: Set _GLIBCXX_STD regardless of __GXX_WEAK__.
+       Add in check for __NO_INLINE__ for warning.
+       * testsuite/lib/dg-options.exp (dg-require-debug-mode): New.
+       * testsuite/lib/libstdc++.exp (check_v3_target_debug_mode): New.
+       * testsuite/21_strings/basic_string/element_access/char/21674.cc:
+       Use it.
+       * testsuite/21_strings/basic_string/element_access/wchar_t/21674.cc:
+       Use it.
+
 2005-09-15  Paolo Carlini  <pcarlini@suse.de>
 
        PR libstdc++/23875
index 96d899546b2940c91950e1835ec7d49623f86467..75b7236964d603ca9e8b20f9e7ac7dd66820a255 100644 (file)
@@ -45,10 +45,8 @@ namespace __gnu_debug
 }
 
 #ifdef _GLIBCXX_DEBUG
-# if __GXX_WEAK__
-#  define _GLIBCXX_STD __gnu_norm
-#  define _GLIBCXX_EXTERN_TEMPLATE 0
-
+# define _GLIBCXX_STD __gnu_norm
+# define _GLIBCXX_EXTERN_TEMPLATE 0
 namespace __gnu_norm 
 { 
   using namespace std; 
@@ -57,8 +55,8 @@ namespace std
 {
   using namespace __gnu_debug_def __attribute__ ((strong));
 }
-# else
-#  warning debug mode disabled due to lack of weak symbol support
+# if __NO_INLINE__ && !__GXX_WEAK__
+#  warning debug mode without inlining may fail due to lack of weak symbols
 # endif
 #else
 # define _GLIBCXX_STD std
index ea06de5083784966fcdc0d9813b7a8be1755eca7..3f61fa6ce32211cd710a9bf493baf55136ae7cea 100644 (file)
@@ -1,3 +1,4 @@
+// { dg-require-debug-mode "" }
 // { dg-options "-O0 -D_GLIBCXX_DEBUG" }
 // { dg-do run { xfail *-*-* } }
 
index bd900687ee193419f927354bc137d54f00b58b58..7c27e2b6a4e0f81d1b4a4caa921263300c40a4f6 100644 (file)
@@ -1,3 +1,4 @@
+// { dg-require-debug-mode "" }
 // { dg-options "-O0 -D_GLIBCXX_DEBUG" }
 // { dg-do run { xfail *-*-* } }
 
index 2ab8e425d342b213306a7282ef707344ea3ca380..e7bbb41bcd1234804be4d131e4a8f80e480d507a 100644 (file)
@@ -53,3 +53,12 @@ proc dg-require-sharedlib { args } {
     }
     return
 }
+
+proc dg-require-debug-mode { args } {
+    if { ![ check_v3_target_debug_mode ] } {
+       upvar dg-do-what dg-do-what
+       set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+       return
+    }
+    return
+}
index 9c28ba051d5bebb4458d201e5d9598b782decb6a..ba7da26ce2127b388dfdb29a77801b16122dbf37 100644 (file)
@@ -338,7 +338,7 @@ proc v3_target_compile { source dest type options } {
 # Build the support objects linked in with the libstdc++ tests.  In
 # addition, set v3-wchar_t, v3-threads, v3-test_objs, and v3-symver
 # appropriately.
-proc v3-build_support {} {
+proc v3-build_support { } {
     global srcdir
     global v3-wchar_t
     global v3-threads
@@ -580,3 +580,57 @@ proc check_v3_target_cxa_atexit { } {
     }
     return $et_cxa_atexit
 }
+
+proc check_v3_target_debug_mode { } {
+    global cxxflags
+    global et_debug_mode
+
+    global tool        
+
+    if { ![info exists et_debug_mode_target_name] } {
+       set et_debug_mode_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_debug_mode_target_name } {
+       verbose "check_v3_target_debug_mode: `$et_debug_mode_target_name'" 2
+       set et_debug_mode_target_name $current_target
+       if [info exists et_debug_mode] {
+           verbose "check_v3_target_debug_mode: removing cached result" 2
+           unset et_debug_mode
+       }
+    }
+
+    if [info exists et_debug_mode] {
+       verbose "check_v3_target_debug_mode: using cached result" 2
+    } else {
+       set et_debug_mode 0
+
+       # Set up, compile, and execute a C++ test program that depends
+       # on correct ordering of static object destructors. This is
+       # indicative of the presence and use of __cxa_atexit.
+       set src debug_mode[pid].cc
+       set exe debug_mode[pid].x
+
+       set f [open $src "w"]
+       puts $f "#include <string>"
+       puts $f "using namespace std;"  
+       puts $f "int main()"
+       puts $f "{ return 0; }"
+       close $f
+
+       set cxxflags_saved $cxxflags
+       set cxxflags "$cxxflags -Werror -O0 -D_GLIBCXX_DEBUG"
+       set lines [v3_target_compile $src $exe executable ""]
+       set cxxflags $cxxflags_saved
+       file delete $src
+
+       if [string match "" $lines] {
+           # No error message, compilation succeeded.
+           set et_debug_mode 1
+       }
+    }
+    verbose "check_v3_target_debug_mode: $et_debug_mode" 2
+    return $et_debug_mode
+}