> From: Catherine Moore > > Hi Toma, > There are some MIPS ELF targets that do support gettimeofday. Perhaps you > could handle this with a dg_require_effective_target entry for gettimeofday. > Thanks, > Catherine >
Hi, Thank you for your quick reply. The patch below adds a dg_require_effective_target for gettimeofday. Does it look good ? I'm having some doubts about the new directive's name. Also, this patch makes the dg-skip-if for AVR redundant. Should I remove it ? Regards, Toma gcc/testsuite/ * gcc.dg/lto/pr60449_0.c: Require gettimeofday support. * lib/target-supports.exp (check_effective_target_gettimeofday): New. diff --git a/gcc/testsuite/gcc.dg/lto/pr60449_0.c b/gcc/testsuite/gcc.dg/lto/pr60449_0.c index 5b878a6..ad83938 100644 --- a/gcc/testsuite/gcc.dg/lto/pr60449_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr60449_0.c @@ -1,5 +1,6 @@ /* { dg-lto-do link } */ /* { dg-skip-if "Needs gettimeofday" { "avr-*-*" } } */ +/* { dg-require-effective-target gettimeofday } */ extern int printf (const char *__restrict __format, ...); typedef long int __time_t; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 2766af4..29d61ca 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -4342,6 +4342,32 @@ proc check_effective_target_mips_nanlegacy { } { } "-mnan=legacy"] } +proc check_effective_target_gettimeofday { } { + return [check_no_compiler_messages gettimeofday executable { + struct timeval + { + long int tv_sec; + long int tv_usec; + }; + + struct timezone + { + int tz_minuteswest; + int tz_dsttime; + }; + + extern int gettimeofday (struct timeval * __tv, struct timezone * __tz); + + int main () + { + struct timeval tv; + struct timezone tz; + gettimeofday (&tv, &tz); + return 0; + } + }] +} + # Return 1 if an MSA program can be compiled to object proc check_effective_target_mips_msa { } {