diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-25 22:47:52 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-25 22:47:52 +0000 |
commit | 0cd8cd4b469f601d13c32143b8485cbda63d9fd3 (patch) | |
tree | 689f97a10b524a49f9bb9a883715f27f56e26dc7 /libstdc++-v3 | |
parent | 96e814b87f4e8a68965d43274d3778f2dfd7c927 (diff) | |
download | gcc-0cd8cd4b469f601d13c32143b8485cbda63d9fd3.tar.gz |
2012-04-25 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/52689
* testsuite/17_intro/static.cc: Fix.
* testsuite/lib/dg-options.exp (dg-require-static-libstdcxx): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186845 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/17_intro/static.cc | 6 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/lib/dg-options.exp | 9 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/lib/libstdc++.exp | 44 |
4 files changed, 63 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 678c7a4c572..455931163b9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2012-04-25 Benjamin Kosnik <bkoz@redhat.com> + + PR libstdc++/52689 + * testsuite/17_intro/static.cc: Fix. + * testsuite/lib/dg-options.exp (dg-require-static-libstdcxx): New. + * testsuite/lib/libstdc++.exp (check_v3_target_static_libstdcxx): New. + 2012-04-25 Jonathan Wakely <jwakely.gcc@gmail.com> * include/std/scoped_allocator (scoped_allocator::__outermost): Do diff --git a/libstdc++-v3/testsuite/17_intro/static.cc b/libstdc++-v3/testsuite/17_intro/static.cc index 99362f55a8e..6b1d2c4d5fc 100644 --- a/libstdc++-v3/testsuite/17_intro/static.cc +++ b/libstdc++-v3/testsuite/17_intro/static.cc @@ -1,6 +1,6 @@ // { dg-do link } -// { dg-require-effective-target static } -// { dg-options "-static -std=gnu++11" } +// { dg-require-static-libstdcxx } +// { dg-options "-static-libstdc++ -std=gnu++11" } // Copyright (C) 2012 Free Software Foundation, Inc. // @@ -25,7 +25,7 @@ int main() { - std::locale c = std::locale::global(); + std::locale c __attribute__((unused)) = std::locale::classic(); std::cout << "i am old-skool\n"; return 0; } diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp index d5eb5e827ad..9d5624aedbb 100644 --- a/libstdc++-v3/testsuite/lib/dg-options.exp +++ b/libstdc++-v3/testsuite/lib/dg-options.exp @@ -197,6 +197,15 @@ proc dg-require-nprocs { args } { return } +proc dg-require-static-libstdcxx { args } { + if { ![ check_v3_target_static_libstdcxx ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + return + } + return +} + proc add_options_for_no_pch { flags } { # This forces any generated and possibly included PCH to be invalid. return "-D__GLIBCXX__=99999999" diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index c1ccfa5d132..9a9e0cba625 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -1693,5 +1693,49 @@ proc check_v3_target_nprocs { } { return $et_nprocs } +proc check_v3_target_static_libstdcxx { } { + global cxxflags + global DEFAULT_CXXFLAGS + global et_static_libstdcxx + + global tool + + if [info exists et_static_libstdcxx] { + verbose "check_v3_target_static_libstdcxx: using cached result" 2 + } else { + set et_static_libstdcxx 0 + + # Set up and link a C++0x test program that depends + # on static linking + set src static-maybe[pid].cc + + set f [open $src "w"] + puts $f "#include <iostream>" + puts $f "int main() {" + puts $f "int i(415);" + puts $f "std::cout<< i << std::endl;" + puts $f "return 0; }" + puts $f "" + close $f + + set cxxflags_saved $cxxflags + set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -static-libstdc++" + + set lines [v3_target_compile $src /dev/null executable ""] + set cxxflags $cxxflags_saved + file delete $src + + if [string match "" $lines] { + # No error message, link succeeded. + set et_static_libstdcxx 1 + } else { + verbose "check_v3_target_static_libstdcxx: compilation failed" 2 + } + } + verbose "check_v3_target_static_libstdcxx: $et_static_libstdcxx" 2 + return $et_static_libstdcxx +} + + set additional_prunes "" |