re PR libstdc++/21674 (basic_string vs debug_mode)

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
This commit is contained in:
Benjamin Kosnik 2005-09-15 18:58:02 +00:00 committed by Benjamin Kosnik
parent f4ca8e2772
commit 451e92db80
6 changed files with 84 additions and 7 deletions

View 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

View 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

View File

@ -1,3 +1,4 @@
// { dg-require-debug-mode "" }
// { dg-options "-O0 -D_GLIBCXX_DEBUG" }
// { dg-do run { xfail *-*-* } }

View File

@ -1,3 +1,4 @@
// { dg-require-debug-mode "" }
// { dg-options "-O0 -D_GLIBCXX_DEBUG" }
// { dg-do run { xfail *-*-* } }

View 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
}

View 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
}