From d3d9a67f7e1805ab7493498c4baf864c891d513f Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Fri, 25 Mar 2005 02:21:01 +0000 Subject: [PATCH] pragma-override1.C: Mark as requiring 'internal' visibility. * g++.dg/ext/visibility/pragma-override1.C: Mark as requiring 'internal' visibility. * g++.dg/ext/visibility/pragma-override2.C: Likewise. * g++.dg/ext/visibility/visibility-7.C: Mark as requiring 'protected' visibility. * gcc.dg/visibility-7.c: Likewise. * lib/target-supports.exp (check_visibility_available): Take a parameter, the kind of visibility to check for. * lib/target-supports-dg.exp (dg-require-visibility): Pass parameter to check_visibility_available. From-SVN: r97031 --- gcc/testsuite/ChangeLog | 11 ++++++ .../g++.dg/ext/visibility/pragma-override1.C | 2 +- .../g++.dg/ext/visibility/pragma-override2.C | 2 +- .../g++.dg/ext/visibility/visibility-7.C | 2 +- gcc/testsuite/gcc.dg/visibility-7.c | 2 +- gcc/testsuite/lib/target-supports-dg.exp | 2 +- gcc/testsuite/lib/target-supports.exp | 36 ++++++++++++------- 7 files changed, 40 insertions(+), 17 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e07979abb73..985dee530ed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -4,6 +4,17 @@ 2005-03-24 Geoffrey Keating + * g++.dg/ext/visibility/pragma-override1.C: Mark as requiring + 'internal' visibility. + * g++.dg/ext/visibility/pragma-override2.C: Likewise. + * g++.dg/ext/visibility/visibility-7.C: Mark as requiring + 'protected' visibility. + * gcc.dg/visibility-7.c: Likewise. + * lib/target-supports.exp (check_visibility_available): Take + a parameter, the kind of visibility to check for. + * lib/target-supports-dg.exp (dg-require-visibility): Pass parameter + to check_visibility_available. + * g++.dg/expr/cast3.C: New. 2005-03-24 David Edelsohn diff --git a/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C b/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C index a2c93ebb752..e292df41b4c 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C +++ b/gcc/testsuite/g++.dg/ext/visibility/pragma-override1.C @@ -1,6 +1,6 @@ /* Test that #pragma GCC visibility does not override class member specific settings. */ /* { dg-do compile } */ -/* { dg-require-visibility "" } */ +/* { dg-require-visibility "internal" } */ /* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */ #pragma GCC visibility push(hidden) diff --git a/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C b/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C index a4bb42c728a..fe6c47fdbf5 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C +++ b/gcc/testsuite/g++.dg/ext/visibility/pragma-override2.C @@ -1,6 +1,6 @@ /* Test that #pragma GCC visibility does not override class member specific settings. */ /* { dg-do compile } */ -/* { dg-require-visibility "" } */ +/* { dg-require-visibility "internal" } */ /* { dg-final { scan-assembler "\\.internal.*Foo.methodEv" } } */ #pragma GCC visibility push(hidden) diff --git a/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C b/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C index dbd7010d028..ae4589397b6 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C +++ b/gcc/testsuite/g++.dg/ext/visibility/visibility-7.C @@ -1,5 +1,5 @@ /* Test warning from conflicting visibility specifications. */ -/* { dg-require-visibility "" } */ +/* { dg-require-visibility "protected" } */ /* { dg-final { scan-hidden "xyzzy" } } */ extern int diff --git a/gcc/testsuite/gcc.dg/visibility-7.c b/gcc/testsuite/gcc.dg/visibility-7.c index f5e6e9aae5c..aaa8165e3e0 100644 --- a/gcc/testsuite/gcc.dg/visibility-7.c +++ b/gcc/testsuite/gcc.dg/visibility-7.c @@ -1,6 +1,6 @@ /* Test warning from conflicting visibility specifications. */ /* { dg-do compile } */ -/* { dg-require-visibility "" } */ +/* { dg-require-visibility "protected" } */ /* { dg-final { scan-hidden "xyzzy" } } */ extern int diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index e3ad1d540fa..1f2242fdc5d 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -32,7 +32,7 @@ proc dg-require-weak { args } { # test. proc dg-require-visibility { args } { - set visibility_available [ check_visibility_available ] + set visibility_available [ check_visibility_available [lindex $args 1 ] ] if { $visibility_available == -1 } { upvar name name unresolved "$name" diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index d37fd2d6b8f..4b129a870a1 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -110,13 +110,14 @@ proc check_weak_available { } { } ############################### -# proc check_visibility_available { } +# proc check_visibility_available { what_kind } ############################### # The visibility attribute is only support in some object formats # This proc returns 1 if it is supported, 0 if not. +# The argument is the kind of visibility, default/protected/hidden/internal. -proc check_visibility_available { } { +proc check_visibility_available { what_kind } { global visibility_available_saved global tool global target_triplet @@ -126,18 +127,29 @@ proc check_visibility_available { } { return 0 } - if {![info exists visibility_available_saved] } { - set lines [get_compiler_messages visibility object { - void f() __attribute__((visibility("hidden"))); - void f() {} - }] - if [string match "" $lines] then { - set visibility_available_saved 1 - } else { - set visibility_available_saved 0 + if [string match "" $what_kind] { set what_kind "hidden" } + + if { [info exists visibility_available_saved] } { + verbose "Saved result is <$visibility_available_saved>" 1 + if { [ lsearch -exact $visibility_available_saved $what_kind ] != -1 } { + return 1 + } elseif { [ lsearch -exact $visibility_available_saved "!$what_kind" ] != -1 } { + return 0 } } - return $visibility_available_saved + + set lines [get_compiler_messages visibility object " + void f() __attribute__((visibility(\"$what_kind\"))); + void f() {} + "] + if [string match "" $lines] then { + set answer 1 + lappend visibility_available_saved $what_kind + } else { + set answer 0 + lappend visibility_available_saved "!$what_kind" + } + return $answer } ###############################