aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-06-05 22:18:55 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-06-05 22:18:55 +0000
commitb4e0fcc38e745465c6a92390b1f86df6167b17a5 (patch)
tree547225b726e2ad55b59073d450463aa182ade18e /gcc/testsuite/lib
parent7786a3e47a6c81971f0eea5b4ebbc0745cdfbcb3 (diff)
downloadgcc-b4e0fcc38e745465c6a92390b1f86df6167b17a5.zip
gcc-b4e0fcc38e745465c6a92390b1f86df6167b17a5.tar.gz
gcc-b4e0fcc38e745465c6a92390b1f86df6167b17a5.tar.bz2
gcc-defs.exp (additional_sources): New variable.
* lib/gcc-defs.exp (additional_sources): New variable. (dg-additional-sources): New function. (additional_files): New variable. (dg-additional-files): New function. (dg-additional-files-options): Likewise. * lib/gcc-dg.exp (dg-require-weak): New function. (dg-require-alias): Likewise. (dg-require-gc-sections): Likewise. * lib/target-supports.exp (check_alias_available): Remove testfile parameter. (check_gc_sections_available): New function. * lib/g++-dg.exp (dg-gpp-additional-sources): Remove. (dg-gpp-additional-files): Likewise. * lib/g++.exp (additional_sources): Remove. (additional_files): Likewise. (g++_target_compile): Use dg-additional-files-options. * gcc.dg/special/special.exp: Add "ecos" tests. Remove complex Tcl logic. * gcc.dg/special/ecos.exp: Remove. * gcc.dg/special/20000419-2.c: Use dg-require-*. * gcc.dg/special/alias-1.c: Likewise. * gcc.dg/special/alias-2.c: Likewise. * gcc.dg/special/gcsec-1.c: Likewise. * gcc.dg/special/weak-1.c: Likewise. * gcc.dg/special/weak-2.c: Likewise. * gcc.dg/special/wkali-1.c: Likewise. * gcc.dg/special/wkali-2.c: Likewise. * g++.dg/special/conpr-2.C: Use dg-additional-*, not dg-gpp-additional-*. * g++.dg/special/conpr-3.C: Likewise. * g++.dg/special/conpr-4.C: Likewise. * g++.old-deja/g++.abi/vtable3a.C: Likewise. * g++.old-deja/g++.abi/vtable3b.C: Likewise. * g++.old-deja/g++.abi/vtable3c.C: Likewise. * g++.old-deja/g++.abi/vtable3d.C: Likewise. * g++.old-deja/g++.abi/vtable3e.C: Likewise. * g++.old-deja/g++.abi/vtable3f.C: Likewise. * g++.old-deja/g++.abi/vtable3g.C: Likewise. * g++.old-deja/g++.abi/vtable3h.C: Likewise. * g++.old-deja/g++.abi/vtable3i.C: Likewise. * g++.old-deja/g++.abi/vtable3j.C: Likewise. * g++.old-deja/g++.oliva/linkage1.C: Likewise. * g++.old-deja/g++.other/comdat1.C: Likewise. * g++.old-deja/g++.other/comdat2.C: Likewise. * g++.old-deja/g++.other/comdat3.C: Likewise. * g++.old-deja/g++.other/ctor1.C: Likewise. * g++.old-deja/g++.pt/instantiate5.C: Likewise. From-SVN: r67514
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r--gcc/testsuite/lib/g++-dg.exp17
-rw-r--r--gcc/testsuite/lib/g++.exp28
-rw-r--r--gcc/testsuite/lib/gcc-defs.exp55
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp44
-rw-r--r--gcc/testsuite/lib/gcc.exp3
-rw-r--r--gcc/testsuite/lib/target-supports.exp52
6 files changed, 138 insertions, 61 deletions
diff --git a/gcc/testsuite/lib/g++-dg.exp b/gcc/testsuite/lib/g++-dg.exp
index 9f63645..1efb93d 100644
--- a/gcc/testsuite/lib/g++-dg.exp
+++ b/gcc/testsuite/lib/g++-dg.exp
@@ -26,20 +26,3 @@ proc g++-dg-test { prog do_what extra_tool_flags } {
proc g++-dg-prune { system text } {
return [gcc-dg-prune $system $text]
}
-
-# Record additional sources files that must be compiled along with the
-# main source file.
-
-proc dg-gpp-additional-sources { args } {
- global additional_sources
- set additional_sources [lindex $args 1]
-}
-
-# Record additional files -- other than source files -- that must be
-# present on the system where the compiler runs.
-
-proc dg-gpp-additional-files { args } {
- global additional_files
- set additional_files [lindex $args 1]
-}
-
diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp
index 68b4d16..821c3d7 100644
--- a/gcc/testsuite/lib/g++.exp
+++ b/gcc/testsuite/lib/g++.exp
@@ -31,8 +31,6 @@ load_lib gcc-defs.exp
set gpp_compile_options ""
-set additional_sources ""
-set additional_files ""
#
# g++_version -- extract and print the version number of the compiler
@@ -306,34 +304,10 @@ proc g++_target_compile { source dest type options } {
exec rm -f $rponame
}
- global additional_sources
- global additional_files
- set to_download ""
- if { $additional_sources != "" } then {
- if [is_remote host] {
- lappend options "additional_flags=$additional_sources"
- }
- regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources
- if ![is_remote host] {
- lappend options "additional_flags=$additional_sources"
- }
- set to_download [concat $to_download $additional_sources]
- }
- if { $additional_files != "" } then {
- regsub -all " " $additional_files " [file dirname $source]/" additional_files
- set to_download [concat $to_download $additional_files]
- }
- if [is_remote host] {
- foreach file $to_download {
- remote_download host $file
- }
- }
+ set options [dg-additional-files-options $options $source]
set result [target_compile $source $dest $type $options]
- set additional_sources ""
- set additional_files ""
-
return $result
}
diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
index 30e4b13..bb2369c 100644
--- a/gcc/testsuite/lib/gcc-defs.exp
+++ b/gcc/testsuite/lib/gcc-defs.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2001 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003 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
@@ -164,3 +164,56 @@ if { [info procs runtest_file_p] == "" } then {
return 1
}
}
+
+# Record additional sources files that must be compiled along with the
+# main source file.
+
+set additional_sources ""
+
+proc dg-additional-sources { args } {
+ global additional_sources
+ set additional_sources [lindex $args 1]
+}
+
+# Record additional files -- other than source files -- that must be
+# present on the system where the compiler runs.
+
+set additional_files ""
+
+proc dg-additional-files { args } {
+ global additional_files
+ set additional_files [lindex $args 1]
+}
+
+# Return an updated version of OPTIONS that mentions any additional
+# source files registered with dg-additional-sources. SOURCE is the
+# name of the test case.
+
+proc dg-additional-files-options { options source } {
+ global additional_sources
+ global additional_files
+ set to_download [list]
+ if { $additional_sources != "" } then {
+ if [is_remote host] {
+ lappend options "additional_flags=$additional_sources"
+ }
+ regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources
+ if ![is_remote host] {
+ lappend options "additional_flags=$additional_sources"
+ }
+ set to_download [concat $to_download $additional_sources]
+ set additional_sources ""
+ }
+ if { $additional_files != "" } then {
+ regsub -all " " $additional_files " [file dirname $source]/" additional_files
+ set to_download [concat $to_download $additional_files]
+ set additional_files ""
+ }
+ if [is_remote host] {
+ foreach file $to_download {
+ remote_download host $file
+ }
+ }
+
+ return $options
+}
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index f01cd8a..09fd618 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -250,3 +250,47 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
}
}
}
+
+# If this target does not support weak symbols, skip this test.
+
+proc dg-require-weak { args } {
+ upvar dg-do-what dg-do-what
+ upvar name name
+
+ set weak_available [ check_weak_available ]
+ if { $weak_available == -1 } {
+ unresolved "$name"
+ }
+ if { $weak_available != 1 } {
+ set dg-do-what [list [lindex $dg_do_what 0] "N" "P"]
+ return
+ }
+}
+
+# If this target does not support the "alias" attribute, skip this
+# test.
+
+proc dg-require-alias { args } {
+ upvar dg-do-what dg-do-what
+ upvar name name
+
+ set alias_available [ check_alias_available ]
+ if { $alias_available == -1 } {
+ unresolved "$name"
+ }
+ if { $alias_available < 2 } {
+ set dg-do-what [list [lindex $dg_do_what 0] "N" "P"]
+ return
+ }
+}
+
+# If this target's linker does not support the --gc-sections flag,
+# skip this test.
+
+proc dg-require-gc-sections { args } {
+ if { ![ check_gc_sections_available ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex $dg_do_what 0] "N" "P"]
+ return
+ }
+}
diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp
index f090cb1..bec0e2e 100644
--- a/gcc/testsuite/lib/gcc.exp
+++ b/gcc/testsuite/lib/gcc.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2003 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
@@ -153,5 +153,6 @@ proc gcc_target_compile { source dest type options } {
lappend options "timeout=[target_info gcc,timeout]"
}
lappend options "compiler=$GCC_UNDER_TEST"
+ set options [dg-additional-files-options $options $source]
return [target_compile $source $dest $type $options]
}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index efcc941..0944777 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2003 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
@@ -67,24 +67,28 @@ proc check_weak_available { } {
###############################
# Determine if the target toolchain supports the alias attribute.
-# Parameter is the pathname of a file that can be used to test the alias support.
-# Returns yes if it does.
-# Returns no if it does not.
-# Returns dontknow if something went wrong
-# For an example of the use of this function, see gcc.dg/special/ecos.exp
-proc check_alias_available { testfile } {
+# Returns 2 if the target supports aliases. Returns 1 if the target
+# only supports weak aliased. Returns 0 if the target does not
+# support aliases at all. Returns -1 if support for aliases could not
+# be determined.
+
+proc check_alias_available { } {
global alias_available_saved
if [info exists alias_available_saved] {
verbose "check_alias_available returning saved $alias_available_saved" 2
} else {
- verbose "check_alias_available compiling testfile $testfile" 2
- set lines [gcc_target_compile $testfile "tmp.o" object ""]
-
+ verbose "check_alias_available compiling testfile" 2
+ set f [open "tmp.c" "w"]
+ puts $f "void f() __attribute__((alias(\"g\")));"
+ close $f
+ set lines [gcc_target_compile "tmp.c" "tmp.o" object ""]
+ file delete "tmp.c"
+
if [string match "" $lines] then {
# No error messages, everything is OK.
- set alias_available_saved yes
+ set alias_available_saved 2
} else {
if [regexp "alias definitions not supported" $lines] {
verbose "check_alias_available target does not support aliases" 2
@@ -93,16 +97,16 @@ proc check_alias_available { testfile } {
if { $objformat == "elf" } {
verbose "check_alias_available but target uses ELF format, so it ought to" 2
- set alias_available_saved dontknow
+ set alias_available_saved -1
} else {
- set alias_available_saved no
+ set alias_available_saved 0
}
} else {
if [regexp "only weak aliases are supported" $lines] {
verbose "check_alias_available target supports only weak aliases" 2
- set alias_available_saved no
+ set alias_available_saved 1
} else {
- set alias_available_saved dontknow
+ set alias_available_saved -1
}
}
}
@@ -112,3 +116,21 @@ proc check_alias_available { testfile } {
return $alias_available_saved
}
+
+# Returns true if --gc-sections is supported on the target.
+
+proc check_gc_sections_available { } {
+ global gc_sections_available_saved
+
+ if {![info exists alias_available_saved]} {
+ # Check if the ld used by gcc supports --gc-sections.
+ set gcc_ld [lindex [gcc_target_compile "-print-prog-name=ld" "" "none" ""] 0]
+ set ld_output [remote_exec host "$gcc_ld" "--help"]
+ if { [ string first "--gc-sections" $ld_output ] >= 0 } {
+ set gc_sections_available_saved 1
+ } else {
+ set gc_sections_available_saved 0
+ }
+ }
+ return $gc_sections_available_saved
+}