mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-20 19:01:12 +08:00
re PR libstdc++/37522 (Incorrect vswprintf prototype breaks __to_xstring)
2008-10-27 Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/37522 * config/os/mingw32/os_defines.h: Define _GLIBCXX_HAVE_BROKEN_VSWPRINTF * include/bits/basic_string.h: Guard string conversions with !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF) too. * testsuite/lib/libstdc++.exp (check_v3_target_string_conversions): New. * testsuite/lib/dg-options.exp (dg-require-string-conversions): New. * testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc: Use the latter. * testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/ stoull.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/ to_string.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc: Likewise. From-SVN: r141382
This commit is contained in:
parent
c3e39a4729
commit
83b83ae97a
@ -1,3 +1,31 @@
|
||||
2008-10-27 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR libstdc++/37522
|
||||
* config/os/mingw32/os_defines.h: Define _GLIBCXX_HAVE_BROKEN_VSWPRINTF
|
||||
* include/bits/basic_string.h: Guard string conversions with
|
||||
!defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF) too.
|
||||
* testsuite/lib/libstdc++.exp (check_v3_target_string_conversions):
|
||||
New.
|
||||
* testsuite/lib/dg-options.exp (dg-require-string-conversions): New.
|
||||
* testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc:
|
||||
Use the latter.
|
||||
* testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc:
|
||||
Likewise.
|
||||
* testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc:
|
||||
Likewise.
|
||||
* testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc:
|
||||
Likewise.
|
||||
* testsuite/21_strings/basic_string/numeric_conversions/char/
|
||||
stoull.cc: Likewise.
|
||||
* testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc:
|
||||
Likewise.
|
||||
* testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc:
|
||||
Likewise.
|
||||
* testsuite/21_strings/basic_string/numeric_conversions/char/
|
||||
to_string.cc: Likewise.
|
||||
* testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc:
|
||||
Likewise.
|
||||
|
||||
2008-10-24 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* config/os/generic/error_constants.h (enum errc): Remove
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Specific definitions for generic platforms -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
// Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
@ -52,4 +53,7 @@
|
||||
// See libstdc++/20806.
|
||||
#define _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM 1
|
||||
|
||||
// See libstdc++/37522.
|
||||
#define _GLIBCXX_HAVE_BROKEN_VSWPRINTF 1
|
||||
|
||||
#endif
|
||||
|
@ -2562,7 +2562,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
|
||||
_GLIBCXX_END_NAMESPACE
|
||||
|
||||
#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99))
|
||||
#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99) \
|
||||
&& !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
|
||||
|
||||
#include <ext/string_conversions.h>
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-string-conversions "" }
|
||||
|
||||
// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
@ -29,8 +31,6 @@
|
||||
void
|
||||
test01()
|
||||
{
|
||||
#ifdef _GLIBCXX_USE_C99
|
||||
|
||||
bool test __attribute__((unused)) = false;
|
||||
using namespace std;
|
||||
|
||||
@ -129,8 +129,6 @@ test01()
|
||||
VERIFY( test );
|
||||
VERIFY( d1 == -1.0 );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -1,4 +1,6 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-string-conversions "" }
|
||||
|
||||
// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
@ -29,8 +31,6 @@
|
||||
void
|
||||
test01()
|
||||
{
|
||||
#ifdef _GLIBCXX_USE_C99
|
||||
|
||||
bool test __attribute__((unused)) = false;
|
||||
using namespace std;
|
||||
|
||||
@ -129,8 +129,6 @@ test01()
|
||||
VERIFY( test );
|
||||
VERIFY( f1 == -1.0f );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -1,4 +1,6 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-string-conversions "" }
|
||||
|
||||
// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
@ -29,8 +31,6 @@
|
||||
void
|
||||
test01()
|
||||
{
|
||||
#ifdef _GLIBCXX_USE_C99
|
||||
|
||||
bool test __attribute__((unused)) = false;
|
||||
using namespace std;
|
||||
|
||||
@ -194,8 +194,6 @@ test01()
|
||||
}
|
||||
VERIFY( test );
|
||||
VERIFY( i1 == 1 );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -1,4 +1,6 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-string-conversions "" }
|
||||
|
||||
// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
@ -29,8 +31,6 @@
|
||||
void
|
||||
test01()
|
||||
{
|
||||
#ifdef _GLIBCXX_USE_C99
|
||||
|
||||
bool test __attribute__((unused)) = false;
|
||||
using namespace std;
|
||||
|
||||
@ -157,8 +157,6 @@ test01()
|
||||
}
|
||||
VERIFY( test );
|
||||
VERIFY( l1 == numeric_limits<long>::min() );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -1,4 +1,6 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-string-conversions "" }
|
||||
|
||||
// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
@ -29,8 +31,6 @@
|
||||
void
|
||||
test01()
|
||||
{
|
||||
#ifdef _GLIBCXX_USE_C99
|
||||
|
||||
bool test __attribute__((unused)) = false;
|
||||
using namespace std;
|
||||
|
||||
@ -106,8 +106,6 @@ test01()
|
||||
test = false;
|
||||
}
|
||||
VERIFY( test );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -1,4 +1,6 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-string-conversions "" }
|
||||
|
||||
// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
@ -29,8 +31,6 @@
|
||||
void
|
||||
test01()
|
||||
{
|
||||
#ifdef _GLIBCXX_USE_C99
|
||||
|
||||
bool test __attribute__((unused)) = false;
|
||||
using namespace std;
|
||||
|
||||
@ -157,8 +157,6 @@ test01()
|
||||
}
|
||||
VERIFY( test );
|
||||
VERIFY( ll1 == numeric_limits<long long>::min() );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -1,4 +1,6 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-string-conversions "" }
|
||||
|
||||
// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
@ -29,8 +31,6 @@
|
||||
void
|
||||
test01()
|
||||
{
|
||||
#ifdef _GLIBCXX_USE_C99
|
||||
|
||||
bool test __attribute__((unused)) = false;
|
||||
using namespace std;
|
||||
|
||||
@ -144,8 +144,6 @@ test01()
|
||||
}
|
||||
VERIFY( test );
|
||||
VERIFY( ul1 == numeric_limits<unsigned long>::max() );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -1,4 +1,6 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-string-conversions "" }
|
||||
|
||||
// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
@ -29,8 +31,6 @@
|
||||
void
|
||||
test01()
|
||||
{
|
||||
#ifdef _GLIBCXX_USE_C99
|
||||
|
||||
bool test __attribute__((unused)) = false;
|
||||
using namespace std;
|
||||
|
||||
@ -144,8 +144,6 @@ test01()
|
||||
}
|
||||
VERIFY( test );
|
||||
VERIFY( ull1 == numeric_limits<unsigned long long>::max() );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -1,4 +1,6 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-string-conversions "" }
|
||||
|
||||
// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
@ -27,8 +29,6 @@
|
||||
void
|
||||
test01()
|
||||
{
|
||||
#ifdef _GLIBCXX_USE_C99
|
||||
|
||||
bool test __attribute__((unused)) = true;
|
||||
using namespace std;
|
||||
|
||||
@ -55,8 +55,6 @@ test01()
|
||||
long double ld2 = -4.0L;
|
||||
string six(to_string(ld2));
|
||||
VERIFY( six == "-4.000000" );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -124,3 +124,12 @@ proc dg-require-nanosleep { args } {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
proc dg-require-string-conversions { args } {
|
||||
if { ![ check_v3_target_string_conversions ] } {
|
||||
upvar dg-do-what dg-do-what
|
||||
set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -1236,3 +1236,61 @@ proc check_v3_target_nanosleep { } {
|
||||
verbose "check_v3_target_nanosleep: $et_nanosleep" 2
|
||||
return $et_nanosleep
|
||||
}
|
||||
|
||||
proc check_v3_target_string_conversions { } {
|
||||
global cxxflags
|
||||
global DEFAULT_CXXFLAGS
|
||||
global et_string_conversions
|
||||
|
||||
global tool
|
||||
|
||||
if { ![info exists et_string_conversions_target_name] } {
|
||||
set et_string_conversions_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_string_conversions_target_name } {
|
||||
verbose "check_v3_target_string_conversions: `$et_string_conversions_target_name'" 2
|
||||
set et_string_conversions_target_name $current_target
|
||||
if [info exists et_string_conversions] {
|
||||
verbose "check_v3_target_string_conversions: removing cached result" 2
|
||||
unset et_string_conversions
|
||||
}
|
||||
}
|
||||
|
||||
if [info exists et_string_conversions] {
|
||||
verbose "check_v3_target_string_conversions: using cached result" 2
|
||||
} else {
|
||||
set et_string_conversions 0
|
||||
|
||||
# Set up and compile a C++0x test program that depends
|
||||
# on the string_conversions facilities to be available.
|
||||
set src string_conversions[pid].cc
|
||||
set exe string_conversions[pid].exe
|
||||
|
||||
set f [open $src "w"]
|
||||
puts $f "#include <bits/c++config.h>"
|
||||
puts $f "int main()"
|
||||
puts $f "#if defined(_GLIBCXX_USE_C99) && !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_string_conversions 1
|
||||
} else {
|
||||
verbose "check_v3_target_string_conversions: compilation failed" 2
|
||||
}
|
||||
}
|
||||
verbose "check_v3_target_string_conversions: $et_string_conversions" 2
|
||||
return $et_string_conversions
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user