Hi Rainer, Thank you for the feedback.
As you suggested, I have added a check_gettimeofday_available proc in target-supports.exp and a dg-require-gettimeofday proc in target-supports-dg.exp which check for gettimeofday using the existing check_function_available proc. The test still runs and passes on mips-mti-linux-gnu, which has support for gettimeofday, but it is now skipped for mips-mti-elf, which doesn't support it (in my configuration, at least). I have also removed the dg-skip-if for AVR from the test (haven't tested it on AVR, though). What do you think ? Catherine, would this interfere with the MIPS ELF targets which do support gettimeofday ? Regards, Toma gcc/testsuite/ * gcc.dg/lto/pr60449_0.c: Add dg-require-gettimeofday. Remove dg-skip-if for AVR. * lib/target-supports-dg.exp (dg-require-gettimeofday): New function. * lib/target-supports.exp (check_gettimeofday_available): Likewise. diff --git a/gcc/testsuite/gcc.dg/lto/pr60449_0.c b/gcc/testsuite/gcc.dg/lto/pr60449_0.c index 5b878a6..2d3a900 100644 --- a/gcc/testsuite/gcc.dg/lto/pr60449_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr60449_0.c @@ -1,5 +1,5 @@ /* { dg-lto-do link } */ -/* { dg-skip-if "Needs gettimeofday" { "avr-*-*" } } */ +/* { dg-require-gettimeofday "" } */ extern int printf (const char *__restrict __format, ...); typedef long int __time_t; diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index 6400d64..41369aa 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -236,6 +236,15 @@ proc dg-require-mkfifo { args } { } } +# If this target does not have gettimeofday, skip this test. + +proc dg-require-gettimeofday { args } { + if { ![check_gettimeofday_available] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} + # If this target does not use __cxa_atexit, skip this test. proc dg-require-cxa-atexit { args } { diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 2766af4..9794383 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2287,6 +2287,12 @@ proc check_mkfifo_available {} { return [check_function_available "mkfifo"] } +# Returns true iff "gettimeofday" is available on the target system. + +proc check_gettimeofday_available {} { + return [check_function_available "gettimeofday"] +} + # Returns true iff "__cxa_atexit" is used on the target system. proc check_cxa_atexit_available { } {