+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
}
#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;
{
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
# 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
}
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
+}