cwchar (swprintf, vswprintf): Do not use if _GLIBCXX_HAVE_BROKEN_VSWPRINTF.

* include/c_global/cwchar (swprintf, vswprintf): Do not use if
	_GLIBCXX_HAVE_BROKEN_VSWPRINTF.
	* testsuite/lib/libstdc++.exp (check_v3_target_swprintf): New.
	* testsuite/lib/dg-options.exp (dg-require-swprintf): New.
	* testsuite/21_strings/headers/cwchar/functions_std.cc,
	testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc,
	testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc:
	Use dg-require-swprintf.

From-SVN: r150063
This commit is contained in:
Joseph Myers 2009-07-24 21:55:59 +01:00 committed by Joseph Myers
parent 87da38430a
commit 2e0814c8d6
7 changed files with 86 additions and 0 deletions

View File

@ -1,3 +1,14 @@
2009-07-24 Joseph Myers <joseph@codesourcery.com>
* include/c_global/cwchar (swprintf, vswprintf): Do not use if
_GLIBCXX_HAVE_BROKEN_VSWPRINTF.
* testsuite/lib/libstdc++.exp (check_v3_target_swprintf): New.
* testsuite/lib/dg-options.exp (dg-require-swprintf): New.
* testsuite/21_strings/headers/cwchar/functions_std.cc,
testsuite/27_io/basic_ostream/inserters_arithmetic/wchar_t/4402.cc,
testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc:
Use dg-require-swprintf.
2009-07-24 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/26_numerics/valarray/dr630-2.cc: Extend.

View File

@ -156,14 +156,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
using ::mbsrtowcs;
using ::putwc;
using ::putwchar;
#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
using ::swprintf;
#endif
using ::swscanf;
using ::ungetwc;
using ::vfwprintf;
#if _GLIBCXX_HAVE_VFWSCANF
using ::vfwscanf;
#endif
#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
using ::vswprintf;
#endif
#if _GLIBCXX_HAVE_VSWSCANF
using ::vswscanf;
#endif

View File

@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-require-c-std "" }
// { dg-require-swprintf "" }
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
//

View File

@ -1,3 +1,5 @@
// { dg-require-swprintf "" }
// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free

View File

@ -1,4 +1,5 @@
// { dg-options "-std=gnu++0x" }
// { dg-require-swprintf "" }
// Copyright (C) 2007, 2008, 2009 Free Software Foundation
//

View File

@ -142,3 +142,12 @@ proc dg-require-string-conversions { args } {
}
return
}
proc dg-require-swprintf { args } {
if { ![ check_v3_target_swprintf ] } {
upvar dg-do-what dg-do-what
set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
return
}
return
}

View File

@ -1374,3 +1374,61 @@ proc check_v3_target_string_conversions { } {
verbose "check_v3_target_string_conversions: $et_string_conversions" 2
return $et_string_conversions
}
proc check_v3_target_swprintf { } {
global cxxflags
global DEFAULT_CXXFLAGS
global et_swprintf
global tool
if { ![info exists et_swprintf_target_name] } {
set et_swprintf_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_swprintf_target_name } {
verbose "check_v3_target_swprintf: `$et_swprintf_target_name'" 2
set et_swprintf_target_name $current_target
if [info exists et_swprintf] {
verbose "check_v3_target_swprintf: removing cached result" 2
unset et_swprintf
}
}
if [info exists et_swprintf] {
verbose "check_v3_target_swprintf: using cached result" 2
} else {
set et_swprintf 0
# Set up and compile a C++0x test program that depends
# on a standard swprintf function to be available.
set src swprintf[pid].cc
set exe swprintf[pid].exe
set f [open $src "w"]
puts $f "#include <bits/c++config.h>"
puts $f "int main()"
puts $f "#if !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)"
puts $f "{ return 0; }"
puts $f "#endif"
close $f
set cxxflags_saved $cxxflags
set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
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_swprintf 1
} else {
verbose "check_v3_target_swprintf: compilation failed" 2
}
}
verbose "check_v3_target_swprintf: $et_swprintf" 2
return $et_swprintf
}