From 556d006c025885af824930d84776ec7119590850 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Fri, 6 Sep 2002 13:00:39 +0000 Subject: [PATCH] weak: New directory. 2002-09-06 Stan Shebs David Edelsohn * gcc.dg/weak: New directory. * gcc.dg/weak-[1-9].c: Move to new directory, remove all target-specific xfail bits. * gcc.dg/typeof-2.c: Move to new directory. * gcc.dg/weak.exp: New expect script. Co-Authored-By: David Edelsohn From-SVN: r56882 --- gcc/testsuite/ChangeLog | 9 +++++ gcc/testsuite/gcc.dg/weak-7.c | 8 ----- gcc/testsuite/gcc.dg/weak-8.c | 10 ------ gcc/testsuite/gcc.dg/{ => weak}/typeof-2.c | 0 gcc/testsuite/gcc.dg/{ => weak}/weak-1.c | 8 ----- gcc/testsuite/gcc.dg/{ => weak}/weak-2.c | 10 +----- gcc/testsuite/gcc.dg/{ => weak}/weak-3.c | 10 ------ gcc/testsuite/gcc.dg/{ => weak}/weak-4.c | 12 ++----- gcc/testsuite/gcc.dg/{ => weak}/weak-5.c | 10 ------ gcc/testsuite/gcc.dg/{ => weak}/weak-6.c | 2 +- gcc/testsuite/gcc.dg/weak/weak-7.c | 6 ++++ gcc/testsuite/gcc.dg/weak/weak-8.c | 7 ++++ gcc/testsuite/gcc.dg/{ => weak}/weak-9.c | 8 ----- gcc/testsuite/gcc.dg/weak/weak.exp | 41 ++++++++++++++++++++++ 14 files changed, 67 insertions(+), 74 deletions(-) delete mode 100644 gcc/testsuite/gcc.dg/weak-7.c delete mode 100644 gcc/testsuite/gcc.dg/weak-8.c rename gcc/testsuite/gcc.dg/{ => weak}/typeof-2.c (100%) rename gcc/testsuite/gcc.dg/{ => weak}/weak-1.c (66%) rename gcc/testsuite/gcc.dg/{ => weak}/weak-2.c (60%) rename gcc/testsuite/gcc.dg/{ => weak}/weak-3.c (70%) rename gcc/testsuite/gcc.dg/{ => weak}/weak-4.c (73%) rename gcc/testsuite/gcc.dg/{ => weak}/weak-5.c (77%) rename gcc/testsuite/gcc.dg/{ => weak}/weak-6.c (66%) create mode 100644 gcc/testsuite/gcc.dg/weak/weak-7.c create mode 100644 gcc/testsuite/gcc.dg/weak/weak-8.c rename gcc/testsuite/gcc.dg/{ => weak}/weak-9.c (56%) create mode 100644 gcc/testsuite/gcc.dg/weak/weak.exp diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index adc9f532c9b..578b9b5b63f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2002-09-06 Stan Shebs + David Edelsohn + + * gcc.dg/weak: New directory. + * gcc.dg/weak-[1-9].c: Move to new directory, remove all + target-specific xfail bits. + * gcc.dg/typeof-2.c: Move to new directory. + * gcc.dg/weak.exp: New expect script. + 2002-09-06 Alan Modra * gcc.c-torture/execute/extzvsi.c: New test. diff --git a/gcc/testsuite/gcc.dg/weak-7.c b/gcc/testsuite/gcc.dg/weak-7.c deleted file mode 100644 index 77a231d88c0..00000000000 --- a/gcc/testsuite/gcc.dg/weak-7.c +++ /dev/null @@ -1,8 +0,0 @@ -/* { dg-do compile } */ -/* { dg-excess-errors "COFF does not support weak symbols" { target *-*-coff i?86-pc-cygwin h8300-*-hms } } */ -/* { dg-excess-errors "Darwin does not support weak symbols" { target *-*-darwin* } } */ - -extern void * foo (void); -void * foo (void) { return (void *)foo; } /* { dg-error "precede" } */ - -extern void * foo (void) __attribute__((weak)); diff --git a/gcc/testsuite/gcc.dg/weak-8.c b/gcc/testsuite/gcc.dg/weak-8.c deleted file mode 100644 index b5bb120a87b..00000000000 --- a/gcc/testsuite/gcc.dg/weak-8.c +++ /dev/null @@ -1,10 +0,0 @@ -/* { dg-do assemble } */ - -/* COFF does not support weak, and dg doesn't support UNSUPPORTED. */ -/* { dg-do assemble { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ - -__attribute__ ((weak)) int i; - -int f() { - return i; -} diff --git a/gcc/testsuite/gcc.dg/typeof-2.c b/gcc/testsuite/gcc.dg/weak/typeof-2.c similarity index 100% rename from gcc/testsuite/gcc.dg/typeof-2.c rename to gcc/testsuite/gcc.dg/weak/typeof-2.c diff --git a/gcc/testsuite/gcc.dg/weak-1.c b/gcc/testsuite/gcc.dg/weak/weak-1.c similarity index 66% rename from gcc/testsuite/gcc.dg/weak-1.c rename to gcc/testsuite/gcc.dg/weak/weak-1.c index 6cedfeabeda..52d7230ed04 100644 --- a/gcc/testsuite/gcc.dg/weak-1.c +++ b/gcc/testsuite/gcc.dg/weak/weak-1.c @@ -1,14 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fno-common" } */ -/* COFF does not support weak, and dg doesn't support UNSUPPORTED. */ -/* { dg-do compile { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ - -/* { dg-final { global target_triplet } } */ -/* { dg-final { if [string match *-*-darwin* $target_triplet ] {return} } } */ -/* { dg-final { if [string match h8300-*-hms $target_triplet ] {return} } } */ -/* { dg-final { if [string match i?86-pc-cygwin $target_triplet ] {return} } } */ -/* { dg-final { if [string match *-*-coff $target_triplet ] {return} } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?b" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?c" } } */ diff --git a/gcc/testsuite/gcc.dg/weak-2.c b/gcc/testsuite/gcc.dg/weak/weak-2.c similarity index 60% rename from gcc/testsuite/gcc.dg/weak-2.c rename to gcc/testsuite/gcc.dg/weak/weak-2.c index 5310faa0c6f..37fa19a1a65 100644 --- a/gcc/testsuite/gcc.dg/weak-2.c +++ b/gcc/testsuite/gcc.dg/weak/weak-2.c @@ -1,14 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fno-common" } */ -/* COFF does not support weak, and dg doesn't support UNSUPPORTED. */ -/* { dg-do compile { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ - -/* { dg-final { global target_triplet } } */ -/* { dg-final { if [string match *-*-darwin* $target_triplet ] {return} } } */ -/* { dg-final { if [string match h8300-*-hms $target_triplet ] {return} } } */ -/* { dg-final { if [string match i?86-pc-cygwin $target_triplet ] {return} } } */ -/* { dg-final { if [string match *-*-coff $target_triplet ] {return} } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1b" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1c" } } */ @@ -31,7 +23,7 @@ void * foo1b (void) return (void *)ffoo1b; } -extern void * ffoo1c (void); /* { dg-warning "applying #pragma weak" "applying #pragma weak" { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ +extern void * ffoo1c (void); /* { dg-warning "applying #pragma weak" "applying #pragma weak" } */ void * foo1c (void) { return (void *)ffoo1c; diff --git a/gcc/testsuite/gcc.dg/weak-3.c b/gcc/testsuite/gcc.dg/weak/weak-3.c similarity index 70% rename from gcc/testsuite/gcc.dg/weak-3.c rename to gcc/testsuite/gcc.dg/weak/weak-3.c index 26061c2bebc..47359edcd09 100644 --- a/gcc/testsuite/gcc.dg/weak-3.c +++ b/gcc/testsuite/gcc.dg/weak/weak-3.c @@ -1,16 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fno-common" } */ -/* COFF does not support weak, and dg doesn't support UNSUPPORTED. */ -/* { dg-do compile { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ -/* { dg-excess-errors "COFF does not support weak symbols" { target *-*-coff i?86-pc-cygwin h8300-*-hms } } */ -/* { dg-excess-errors "Darwin does not support weak symbols" { target *-*-darwin* } } */ - -/* { dg-final { global target_triplet } } */ -/* { dg-final { if [string match *-*-darwin* $target_triplet ] {return} } } */ -/* { dg-final { if [string match h8300-*-hms $target_triplet ] {return} } } */ -/* { dg-final { if [string match i?86-pc-cygwin $target_triplet ] {return} } } */ -/* { dg-final { if [string match *-*-coff $target_triplet ] {return} } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1b" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1c" } } */ diff --git a/gcc/testsuite/gcc.dg/weak-4.c b/gcc/testsuite/gcc.dg/weak/weak-4.c similarity index 73% rename from gcc/testsuite/gcc.dg/weak-4.c rename to gcc/testsuite/gcc.dg/weak/weak-4.c index f371586be79..bd530ab5940 100644 --- a/gcc/testsuite/gcc.dg/weak-4.c +++ b/gcc/testsuite/gcc.dg/weak/weak-4.c @@ -1,14 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fno-common" } */ -/* COFF does not support weak, and dg doesn't support UNSUPPORTED. */ -/* { dg-do compile { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ - -/* { dg-final { global target_triplet } } */ -/* { dg-final { if [string match *-*-darwin* $target_triplet ] {return} } } */ -/* { dg-final { if [string match h8300-*-hms $target_triplet ] {return} } } */ -/* { dg-final { if [string match i?86-pc-cygwin $target_triplet ] {return} } } */ -/* { dg-final { if [string match *-*-coff $target_triplet ] {return} } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1b" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1c" } } */ @@ -39,7 +31,7 @@ void * foo1b (void) } -extern int vfoo1c; /* { dg-warning "applying #pragma weak" "applying #pragma weak" { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ +extern int vfoo1c; /* { dg-warning "applying #pragma weak" "applying #pragma weak" } */ void * foo1c (void) { return (void *)&vfoo1c; @@ -71,7 +63,7 @@ void * foo1f (void) #pragma weak vfoo1f -extern int vfoo1g; /* { dg-warning "applying #pragma weak" "applying #pragma weak" { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ +extern int vfoo1g; /* { dg-warning "applying #pragma weak" "applying #pragma weak" } */ void * foo1g (void) { return (void *)&vfoo1g; diff --git a/gcc/testsuite/gcc.dg/weak-5.c b/gcc/testsuite/gcc.dg/weak/weak-5.c similarity index 77% rename from gcc/testsuite/gcc.dg/weak-5.c rename to gcc/testsuite/gcc.dg/weak/weak-5.c index 383e36d8597..c4f67e59c76 100644 --- a/gcc/testsuite/gcc.dg/weak-5.c +++ b/gcc/testsuite/gcc.dg/weak/weak-5.c @@ -1,16 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fno-common" } */ -/* COFF does not support weak, and dg doesn't support UNSUPPORTED. */ -/* { dg-do compile { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ -/* { dg-excess-errors "COFF does not support weak symbols" { target *-*-coff i?86-pc-cygwin h8300-*-hms } } */ -/* { dg-excess-errors "Darwin does not support weak symbols" { target *-*-darwin* } } */ - -/* { dg-final { global target_triplet } } */ -/* { dg-final { if [string match *-*-darwin* $target_triplet ] {return} } } */ -/* { dg-final { if [string match h8300-*-hms $target_triplet ] {return} } } */ -/* { dg-final { if [string match i?86-pc-cygwin $target_triplet ] {return} } } */ -/* { dg-final { if [string match *-*-coff $target_triplet ] {return} } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1b" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1c" } } */ diff --git a/gcc/testsuite/gcc.dg/weak-6.c b/gcc/testsuite/gcc.dg/weak/weak-6.c similarity index 66% rename from gcc/testsuite/gcc.dg/weak-6.c rename to gcc/testsuite/gcc.dg/weak/weak-6.c index a6e49c83717..8f88a675d31 100644 --- a/gcc/testsuite/gcc.dg/weak-6.c +++ b/gcc/testsuite/gcc.dg/weak/weak-6.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ extern void * foo (void); -void * foo (void) { return (void *)foo; } /* { dg-error "precede" "" { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ +void * foo (void) { return (void *)foo; } /* { dg-error "precede" } */ #pragma weak foo diff --git a/gcc/testsuite/gcc.dg/weak/weak-7.c b/gcc/testsuite/gcc.dg/weak/weak-7.c new file mode 100644 index 00000000000..64d6155a890 --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak/weak-7.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ + +extern void * foo (void); +void * foo (void) { return (void *)foo; } /* { dg-error "precede" } */ + +extern void * foo (void) __attribute__((weak)); diff --git a/gcc/testsuite/gcc.dg/weak/weak-8.c b/gcc/testsuite/gcc.dg/weak/weak-8.c new file mode 100644 index 00000000000..6e9c267bd21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak/weak-8.c @@ -0,0 +1,7 @@ +/* { dg-do assemble } */ + +__attribute__ ((weak)) int i; + +int f() { + return i; +} diff --git a/gcc/testsuite/gcc.dg/weak-9.c b/gcc/testsuite/gcc.dg/weak/weak-9.c similarity index 56% rename from gcc/testsuite/gcc.dg/weak-9.c rename to gcc/testsuite/gcc.dg/weak/weak-9.c index ee919b590ab..e5cbdb8bc87 100644 --- a/gcc/testsuite/gcc.dg/weak-9.c +++ b/gcc/testsuite/gcc.dg/weak/weak-9.c @@ -1,14 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fno-common" } */ -/* COFF does not support weak, and dg doesn't support UNSUPPORTED. */ -/* { dg-do compile { xfail *-*-coff i?86-pc-cygwin h8300-*-hms *-*-darwin* } } */ - -/* { dg-final { global target_triplet } } */ -/* { dg-final { if [string match *-*-darwin* $target_triplet ] {return} } } */ -/* { dg-final { if [string match h8300-*-hms $target_triplet ] {return} } } */ -/* { dg-final { if [string match i?86-pc-cygwin $target_triplet ] {return} } } */ -/* { dg-final { if [string match *-*-coff $target_triplet ] {return} } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?f1" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?f2" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?f3" } } */ diff --git a/gcc/testsuite/gcc.dg/weak/weak.exp b/gcc/testsuite/gcc.dg/weak/weak.exp new file mode 100644 index 00000000000..595ca92c005 --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak/weak.exp @@ -0,0 +1,41 @@ +# Copyright (C) 1997 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +if { [ check_weak_available ] == 1 } { + + dg-init + + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_CFLAGS + + dg-finish + +} elseif { [ check_weak_available ] == 0 } { + unsupported "gcc.dg/weak" +} else { + unresolved "gcc.dg/weak" +} -- 2.30.2