Commit d533f1cb by Andrew Pinski Committed by Andrew Pinski

visibility-[1-9a].c: Change to use scan-hidden instead of scan-assembler.

2004-10-28  Andrew Pinski  <pinskia@physics.uc.edu>

        * gcc.dg/visibility-[1-9a].c: Change to use scan-hidden instead of
        scan-assembler.
        * lib/scanasm.exp (hidden-scan-for): New proc.
        (scan-hidden): Use hidden-scan-for instead of constructing the scan
        string.
        (scan-not-hidden): Likewise.
        * lib/target-supports.exp (check_visibility_available): mach-o is
        support too.

From-SVN: r89793
parent de66168d
2004-10-28 Andrew Pinski <pinskia@physics.uc.edu>
* gcc.dg/visibility-[1-9a].c: Change to use scan-hidden instead of
scan-assembler.
* lib/scanasm.exp (hidden-scan-for): New proc.
(scan-hidden): Use hidden-scan-for instead of constructing the scan
string.
(scan-not-hidden): Likewise.
* lib/target-supports.exp (check_visibility_available): mach-o is
support too.
2004-10-28 Mark Mitchell <mark@codesourcery.com>
PR c++/17132
......
/* Test visibility attribute on function definition. */
/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
/* { dg-final { scan-hidden "foo" } } */
void
__attribute__((visibility ("hidden")))
......
/* Test that visibility attribute on declaration extends to definition. */
/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
/* { dg-final { scan-hidden "foo" } } */
void
__attribute__((visibility ("hidden")))
......
/* Test visibility attribute on forward declaration of global variable */
/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
/* { dg-final { scan-hidden "xyzzy" } } */
int
__attribute__((visibility ("hidden")))
......
/* Test visibility attribute on forward declaration of global variable */
/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
/* { dg-final { scan-hidden "xyzzy" } } */
extern int
__attribute__((visibility ("hidden")))
......
......@@ -2,7 +2,7 @@
already had a forward declaration. */
/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
/* { dg-final { scan-hidden "foo" } } */
void foo();
......
......@@ -2,7 +2,7 @@
already had a forward declaration. */
/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
/* { dg-final { scan-hidden "xyzzy" } } */
extern int xyzzy;
......
/* Test warning from conflicting visibility specifications. */
/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-assembler "\\.hidden.*xyzzy" } } */
/* { dg-final { scan-hidden "xyzzy" } } */
extern int
__attribute__((visibility ("hidden")))
......
......@@ -2,7 +2,7 @@
/* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-assembler "\\.hidden.*__GI_fputs_unlocked" } } */
/* { dg-final { scan-hidden "__GI_fputs_unlocked" } } */
int fputs_unlocked (const char *restrict, int *restrict)
__asm__ ("__GI_fputs_unlocked")
......
......@@ -2,7 +2,7 @@
/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-options "-fvisibility=hidden" } */
/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
/* { dg-final { scan-hidden "foo" } } */
void foo();
......
/* Test that #pragma GCC visibility works. */
/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-assembler "\\.hidden.*foo" } } */
/* { dg-final { scan-hidden "foo" } } */
#pragma GCC visibility push(hidden)
void foo();
......
/* { dg-do assemble { target *-*-darwin* } } */
/* { dg-do compile } */
/* { dg-require-visibility "" } */
/* { dg-final { scan-hidden "n" } } */
#define __private_extern__ extern __attribute__((visibility ("hidden")))
......
......@@ -79,6 +79,21 @@ proc scan-assembler-not { args } {
dg-scan "scan-assembler-not" 0 $testcase $output_file $args
}
# Return the scan for the assembly for hidden visibility.
proc hidden-scan-for { symbol } {
set objformat [gcc_target_object_format]
switch $objformat {
elf { return "hidden\[ \t_\]*$symbol" }
mach-o { return "private_extern\[ \t_\]*_?$symbol" }
default { return "" }
}
}
# Check that a symbol is defined as a hidden symbol in the .s file
# produced by the compiler.
......@@ -87,7 +102,10 @@ proc scan-hidden { args } {
set output_file "[file rootname [file tail $testcase]].s"
set symbol [lindex $args 0]
set args [lreplace $args 0 0 "hidden\[ \t_\]*$symbol"]
set hidden_scan [hidden-scan-for $symbol]
set args [lreplace $args 0 0 "$hidden_scan"]
dg-scan "scan-hidden" 1 $testcase $output_file $args
}
......@@ -100,7 +118,9 @@ proc scan-not-hidden { args } {
set output_file "[file rootname [file tail $testcase]].s"
set symbol [lindex $args 0]
set args [lreplace $args 0 0 "hidden\[ \t_\]*$symbol"]
set hidden_scan [hidden-scan-for symbol]
set args [lreplace $args 0 0 "$hidden_scan"]
dg-scan "scan-not-hidden" 0 $testcase $output_file $args
}
......
......@@ -88,6 +88,7 @@ proc check_visibility_available { } {
switch $objformat {
elf { return 1 }
mach-o { return 1 }
unknown { return -1 }
default { return 0 }
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment