re PR testsuite/42348 (Syntax of dg-skip-if in two obj-c++ tests)
2010-03-24 Iain Sandoe <iain.sandoe@sandoe-acoustics.co.uk> PR testsuite/42348 * lib/target-supports.exp: Add support for ObjC/ObjC++ tools in standard tests. (check_effective_target_objc2): New proc. (check_effective_target_next_runtime): New proc. * lib/objc.exp: Determine which runtime is in force and support it. * lib/obj-c++.exp: Ditto. From-SVN: r157715
This commit is contained in:
parent
94ad7adc73
commit
9debda96f5
|
@ -1,3 +1,13 @@
|
|||
2010-03-24 Iain Sandoe <iain.sandoe@sandoe-acoustics.co.uk>
|
||||
|
||||
PR testsuite/42348
|
||||
* lib/target-supports.exp: Add support for ObjC/ObjC++ tools in
|
||||
standard tests.
|
||||
(check_effective_target_objc2): New proc.
|
||||
(check_effective_target_next_runtime): New proc.
|
||||
* lib/objc.exp: Determine which runtime is in force and support it.
|
||||
* lib/obj-c++.exp: Ditto.
|
||||
|
||||
2010-03-24 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/43502
|
||||
|
|
|
@ -42,10 +42,10 @@ proc obj-c++_version { } {
|
|||
|
||||
obj-c++_init
|
||||
|
||||
# ignore any arguments after the command
|
||||
# Ignore any arguments after the command.
|
||||
set compiler [lindex $OBJCXX_UNDER_TEST 0]
|
||||
|
||||
# verify that the compiler exists
|
||||
# Verify that the compiler exists.
|
||||
if { [is_remote host] || [which $compiler] != 0 } then {
|
||||
set tmp [remote_exec host "$compiler -v"]
|
||||
set status [lindex $tmp 0];
|
||||
|
@ -61,7 +61,7 @@ proc obj-c++_version { } {
|
|||
clone_output "Couldn't determine version of [which $compiler]\n"
|
||||
}
|
||||
} else {
|
||||
# compiler does not exist (this should have already been detected)
|
||||
# Compiler does not exist (this should have already been detected)
|
||||
warning "$compiler does not exist"
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ proc obj-c++_include_flags { paths } {
|
|||
|
||||
#
|
||||
# obj-c++_link_flags -- provide new version of obj-c++_link_flags
|
||||
# (originally from libgloss.exp) which knows about the gcc tree structure
|
||||
# (originally from libgloss.exp) which knows about the gcc tree structure.
|
||||
#
|
||||
|
||||
proc obj-c++_link_flags { paths } {
|
||||
|
@ -115,27 +115,31 @@ proc obj-c++_link_flags { paths } {
|
|||
append ld_library_path ":${gccpath}/lib"
|
||||
}
|
||||
if [file exists "${gccpath}/libg++/libg++.a"] {
|
||||
append flags "-L${gccpath}/libg++ "
|
||||
append flags " -L${gccpath}/libg++ "
|
||||
append ld_library_path ":${gccpath}/libg++"
|
||||
}
|
||||
if [file exists "${gccpath}/libstdc++/libstdc++.a"] {
|
||||
append flags "-L${gccpath}/libstdc++ "
|
||||
append flags " -L${gccpath}/libstdc++ "
|
||||
append ld_library_path ":${gccpath}/libstdc++"
|
||||
}
|
||||
if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] {
|
||||
# Allow for %s spec substitutions
|
||||
append flags " -B${gccpath}/libstdc++-v3/src/.libs "
|
||||
append flags " -L${gccpath}/libstdc++-v3/src/.libs "
|
||||
append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
|
||||
}
|
||||
# Look for libstdc++.${shlib_ext}.
|
||||
if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] {
|
||||
# Allow for %s spec substitutions
|
||||
append flags " -B${gccpath}/libstdc++-v3/src/.libs "
|
||||
append flags " -L${gccpath}/libstdc++-v3/src/.libs "
|
||||
append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
|
||||
}
|
||||
if [file exists "${gccpath}/libiberty/libiberty.a"] {
|
||||
append flags "-L${gccpath}/libiberty "
|
||||
append flags " -L${gccpath}/libiberty "
|
||||
}
|
||||
if [file exists "${gccpath}/librx/librx.a"] {
|
||||
append flags "-L${gccpath}/librx "
|
||||
append flags " -L${gccpath}/librx "
|
||||
}
|
||||
|
||||
set objcpath "[get_multilibs]"
|
||||
|
@ -145,24 +149,23 @@ proc obj-c++_link_flags { paths } {
|
|||
}
|
||||
# Now check if we have a shared only build.
|
||||
if { $libobjc_dir == ""} {
|
||||
set libobjc_dir \
|
||||
[lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}]
|
||||
}
|
||||
if { $libobjc_dir == ""} {
|
||||
set libobjc_dir \
|
||||
[lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}]
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}]
|
||||
if { $libobjc_dir == ""} {
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}]
|
||||
}
|
||||
}
|
||||
|
||||
verbose "libobjc_dir: $libobjc_dir"
|
||||
|
||||
if { $libobjc_dir != "" } {
|
||||
set libobjc_dir [file dirname ${libobjc_dir}]
|
||||
append flags "-L${libobjc_dir}"
|
||||
# Allow for %s spec substitutions
|
||||
append flags " -B${libobjc_dir} "
|
||||
append flags " -L${libobjc_dir} "
|
||||
append ld_library_path ":${libobjc_dir}"
|
||||
}
|
||||
append ld_library_path \
|
||||
[gcc-set-multilib-library-path $OBJCXX_UNDER_TEST]
|
||||
|
||||
} else {
|
||||
global tool_root_dir;
|
||||
|
||||
|
@ -264,7 +267,7 @@ proc obj-c++_init { args } {
|
|||
|
||||
if { [string match "*-*-darwin*" $target_triplet] } {
|
||||
lappend ALWAYS_OBJCXXFLAGS "ldflags=-multiply_defined suppress"
|
||||
}
|
||||
}
|
||||
|
||||
verbose -log "ALWAYS_OBJCXXFLAGS set to $ALWAYS_OBJCXXFLAGS"
|
||||
|
||||
|
@ -284,43 +287,74 @@ proc obj-c++_target_compile { source dest type options } {
|
|||
global OBJCXX_UNDER_TEST
|
||||
global shlib_ext
|
||||
|
||||
lappend options "libs=-lobjc"
|
||||
set shlib_ext [get_shlib_extension]
|
||||
verbose "shared lib extension: $shlib_ext"
|
||||
verbose "input-options: $options" 4
|
||||
|
||||
# We have to figure out which runtime will be used on darwin because
|
||||
# we need to add the include path for the gnu runtime if that is in
|
||||
# use.
|
||||
# First, set the default...
|
||||
if { [istarget "*-*-darwin*"] } {
|
||||
set nextruntime 1
|
||||
} else {
|
||||
set nextruntime 0
|
||||
}
|
||||
verbose "initial next runtime state : $nextruntime" 2
|
||||
# Next, see if we define the option in dg-options...
|
||||
foreach opt $options {
|
||||
if [regexp ".*-fnext-runtime.*" $opt] {
|
||||
set nextruntime 1
|
||||
}
|
||||
if [regexp ".*-fgnu-runtime.*" $opt] {
|
||||
set nextruntime 0
|
||||
}
|
||||
}
|
||||
verbose "next runtime state after dg opts: $nextruntime" 2
|
||||
|
||||
set tgt [target_info name]
|
||||
if [board_info $tgt exists multilib_flags] {
|
||||
set lb [board_info $tgt multilib_flags]
|
||||
verbose "board multilib_flags $lb" 2
|
||||
foreach opt $lb {
|
||||
if [regexp ".*-fnext-runtime.*" $opt] {
|
||||
set nextruntime 1
|
||||
}
|
||||
if [regexp ".*-fgnu-runtime.*" $opt] {
|
||||
set nextruntime 0
|
||||
}
|
||||
}
|
||||
}
|
||||
verbose "next runtime state after any multilib opts: $nextruntime" 2
|
||||
|
||||
lappend options "libs=-lobjc"
|
||||
|
||||
if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
|
||||
lappend options "libs=${gluefile}"
|
||||
lappend options "ldflags=${wrap_flags}"
|
||||
}
|
||||
|
||||
# If we have built libobjc along with the compiler (which usually
|
||||
# _is not_ the case on Mac OS X systems), point the test harness
|
||||
# If we have built libobjc along with the compiler, point the test harness
|
||||
# at it (and associated headers).
|
||||
|
||||
set objcpath "[get_multilibs]"
|
||||
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc.a]
|
||||
if { $libobjc_dir == ""} {
|
||||
verbose "see if we have -fgnu-runtime in options"
|
||||
if [regexp ".*-fgnu-runtime.*" "${options}" ] {
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a]
|
||||
}
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a]
|
||||
}
|
||||
if { $libobjc_dir == ""} {
|
||||
set libobjc_dir \
|
||||
[lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}]
|
||||
}
|
||||
if { $libobjc_dir == ""} {
|
||||
verbose "see if we have -fgnu-runtime in options"
|
||||
if [regexp ".*-fgnu-runtime.*" "${options}"] {
|
||||
set libobjc_dir \
|
||||
[lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}]
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}]
|
||||
if { $libobjc_dir == ""} {
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}]
|
||||
}
|
||||
}
|
||||
|
||||
if { $libobjc_dir != "" } {
|
||||
set objc_include_dir "${srcdir}/../../libobjc"
|
||||
lappend options "additional_flags=-I${objc_include_dir}"
|
||||
# If we are using the gnu runtime, add its includes.
|
||||
if { $nextruntime == 0 } {
|
||||
set objc_include_dir "${srcdir}/../../libobjc"
|
||||
lappend options "additional_flags=-I${objc_include_dir}"
|
||||
}
|
||||
}
|
||||
|
||||
lappend options "additional_flags=[libio_include_flags]"
|
||||
|
|
|
@ -44,7 +44,7 @@ proc default_objc_version { } {
|
|||
|
||||
objc_init
|
||||
|
||||
# ignore any arguments after the command
|
||||
# Ignore any arguments after the command.
|
||||
set compiler [lindex $OBJC_UNDER_TEST 0]
|
||||
|
||||
if ![is_remote host] {
|
||||
|
@ -53,7 +53,7 @@ proc default_objc_version { } {
|
|||
set compiler_name $compiler
|
||||
}
|
||||
|
||||
# verify that the compiler exists
|
||||
# Verify that the compiler exists.
|
||||
if { $compiler_name != 0 } then {
|
||||
set tmp [remote_exec host "$compiler -v"]
|
||||
set status [lindex $tmp 0]
|
||||
|
@ -65,7 +65,7 @@ proc default_objc_version { } {
|
|||
clone_output "Couldn't determine version of $compiler_name: $output\n"
|
||||
}
|
||||
} else {
|
||||
# compiler does not exist (this should have already been detected)
|
||||
# Compiler does not exist (this should have already been detected).
|
||||
warning "$compiler does not exist"
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,8 @@ proc objc_init { args } {
|
|||
global gcc_warning_prefix
|
||||
global gcc_error_prefix
|
||||
|
||||
# We set LC_ALL and LANG to C so that we get the same error messages as expected.
|
||||
# We set LC_ALL and LANG to C so that we get the same error messages as
|
||||
# expected.
|
||||
setenv LC_ALL C
|
||||
setenv LANG C
|
||||
|
||||
|
@ -141,11 +142,48 @@ proc objc_target_compile { source dest type options } {
|
|||
global ld_library_path
|
||||
global objc_libgcc_s_path
|
||||
global shlib_ext
|
||||
|
||||
set ld_library_path ".:${objc_libgcc_s_path}"
|
||||
lappend options "libs=-lobjc"
|
||||
|
||||
set shlib_ext [get_shlib_extension]
|
||||
verbose "shared lib extension: $shlib_ext"
|
||||
set ld_library_path ".:${objc_libgcc_s_path}"
|
||||
|
||||
# We have to figure out which runtime will be used on darwin because
|
||||
# we need to add the include path for the gnu runtime if that is in
|
||||
# use.
|
||||
# First set the default...
|
||||
if { [istarget "*-*-darwin*"] } {
|
||||
set nextruntime 1
|
||||
} else {
|
||||
set nextruntime 0
|
||||
}
|
||||
verbose "initial next runtime state : $nextruntime" 2
|
||||
# Next, see if we define the option in dg-options...
|
||||
foreach opt $options {
|
||||
if [regexp ".*-fnext-runtime.*" $opt] {
|
||||
set nextruntime 1
|
||||
}
|
||||
if [regexp ".*-fgnu-runtime.*" $opt] {
|
||||
set nextruntime 0
|
||||
}
|
||||
}
|
||||
verbose "next runtime state after dg opts: $nextruntime" 2
|
||||
|
||||
set tgt [target_info name]
|
||||
if [board_info $tgt exists multilib_flags] {
|
||||
set lb [board_info $tgt multilib_flags]
|
||||
verbose "board multilib_flags $lb" 2
|
||||
foreach opt $lb {
|
||||
if [regexp ".*-fnext-runtime.*" $opt] {
|
||||
set nextruntime 1
|
||||
}
|
||||
if [regexp ".*-fgnu-runtime.*" $opt] {
|
||||
set nextruntime 0
|
||||
}
|
||||
}
|
||||
}
|
||||
verbose "next runtime state after any multilib opts: $nextruntime" 2
|
||||
|
||||
lappend options "libs=-lobjc"
|
||||
verbose "shared lib extension: $shlib_ext" 3
|
||||
|
||||
if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
|
||||
lappend options "libs=${gluefile}"
|
||||
|
@ -167,42 +205,43 @@ proc objc_target_compile { source dest type options } {
|
|||
set options [concat "{additional_flags=$TOOL_OPTIONS}" $options]
|
||||
}
|
||||
|
||||
# If we have built libobjc along with the compiler (which usually
|
||||
# _is not_ the case on Mac OS X systems), point the test harness
|
||||
# If we have built libobjc along with the compiler, point the test harness
|
||||
# at it (and associated headers).
|
||||
|
||||
set objcpath "[get_multilibs]"
|
||||
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc.a]
|
||||
if { $libobjc_dir == ""} {
|
||||
verbose "see if we have -fgnu-runtime in options"
|
||||
if [regexp ".*-fgnu-runtime.*" "${options}"] {
|
||||
if { $libobjc_dir == "" } {
|
||||
# On darwin there is, potentially, a gnu runtime too.
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a]
|
||||
}
|
||||
}
|
||||
# Now check if we have a shared only build.
|
||||
if { $libobjc_dir == ""} {
|
||||
set libobjc_dir \
|
||||
[lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}]
|
||||
}
|
||||
if { $libobjc_dir == ""} {
|
||||
verbose "see if we have -fgnu-runtime in options"
|
||||
if [regexp ".*-fgnu-runtime.*" "${options}"] {
|
||||
set libobjc_dir \
|
||||
[lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}]
|
||||
# Perhaps we didn't build static libs.
|
||||
if { $libobjc_dir == "" } {
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}]
|
||||
# On darwin there is, potentially, a gnu runtime too.
|
||||
if { $libobjc_dir == "" } {
|
||||
set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}]
|
||||
}
|
||||
}
|
||||
|
||||
if { $libobjc_dir != "" } {
|
||||
set objc_include_dir "${srcdir}/../../libobjc"
|
||||
lappend options "additional_flags=-I${objc_include_dir}"
|
||||
# If we are using the gnu runtime, add its includes.
|
||||
if { $nextruntime == 0 } {
|
||||
set objc_include_dir "${srcdir}/../../libobjc"
|
||||
lappend options "additional_flags=-I${objc_include_dir}"
|
||||
verbose "adding gnu runtime include dir: $objc_include_dir "
|
||||
}
|
||||
set libobjc_dir [file dirname ${libobjc_dir}]
|
||||
set objc_link_flags "-L${libobjc_dir}"
|
||||
# Allow for %s spec substitutions..
|
||||
set objc_link_flags " -B${libobjc_dir} "
|
||||
lappend options "additional_flags=${objc_link_flags}"
|
||||
set objc_link_flags " -L${libobjc_dir} "
|
||||
lappend options "additional_flags=${objc_link_flags}"
|
||||
append ld_library_path ":${libobjc_dir}"
|
||||
}
|
||||
if { $type == "precompiled_header" } {
|
||||
# If we generating a precompiled header, we have say this is an
|
||||
# objective-C header
|
||||
# objective-C header.
|
||||
set source [concat "-x objective-c-header" $source]
|
||||
}
|
||||
lappend options "compiler=$OBJC_UNDER_TEST"
|
||||
|
@ -214,7 +253,7 @@ proc objc_target_compile { source dest type options } {
|
|||
}
|
||||
|
||||
#
|
||||
# objc_pass -- utility to record a testcase passed
|
||||
# objc_pass -- utility to record a testcase passed.
|
||||
#
|
||||
|
||||
proc objc_pass { testcase cflags } {
|
||||
|
|
|
@ -29,10 +29,17 @@
|
|||
# If ARGS is not empty, its first element is a string that
|
||||
# should be added to the command line.
|
||||
#
|
||||
# Assume by default that CONTENTS is C code. C++ code should contain
|
||||
# "// C++" and Fortran code should contain "! Fortran".
|
||||
# Assume by default that CONTENTS is C code.
|
||||
# Otherwise, code should contain:
|
||||
# "// C++" for c++,
|
||||
# "! Fortran" for Fortran code,
|
||||
# "/* ObjC", for ObjC
|
||||
# and "// ObjC++" for ObjC++
|
||||
# If the tool is ObjC/ObjC++ then we overide the extension to .m/.mm to
|
||||
# allow for ObjC/ObjC++ specific flags.
|
||||
proc check_compile {basename type contents args} {
|
||||
global tool
|
||||
verbose "check_compile tool: $tool for $basename"
|
||||
|
||||
if { [llength $args] > 0 } {
|
||||
set options [list "additional_flags=[lindex $args 0]"]
|
||||
|
@ -42,8 +49,17 @@ proc check_compile {basename type contents args} {
|
|||
switch -glob -- $contents {
|
||||
"*! Fortran*" { set src ${basename}[pid].f90 }
|
||||
"*// C++*" { set src ${basename}[pid].cc }
|
||||
default { set src ${basename}[pid].c }
|
||||
"*// ObjC++*" { set src ${basename}[pid].mm }
|
||||
"*/* ObjC*" { set src ${basename}[pid].m }
|
||||
default {
|
||||
switch -- $tool {
|
||||
"objc" { set src ${basename}[pid].m }
|
||||
"obj-c++" { set src ${basename}[pid].mm }
|
||||
default { set src ${basename}[pid].c }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set compile_type $type
|
||||
switch -glob $type {
|
||||
assembly { set output ${basename}[pid].s }
|
||||
|
@ -1188,6 +1204,25 @@ proc check_cxa_atexit_available { } {
|
|||
}]
|
||||
}
|
||||
|
||||
proc check_effective_target_objc2 { } {
|
||||
return [check_no_compiler_messages objc2 object {
|
||||
#ifdef __OBJC2__
|
||||
int dummy[1];
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
}]
|
||||
}
|
||||
|
||||
proc check_effective_target_next_runtime { } {
|
||||
return [check_no_compiler_messages objc2 object {
|
||||
#ifdef __NEXT_RUNTIME__
|
||||
int dummy[1];
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
}]
|
||||
}
|
||||
|
||||
# Return 1 if we're generating 32-bit code using default options, 0
|
||||
# otherwise.
|
||||
|
|
Loading…
Reference in New Issue