Hi Toma,

> 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.

no, this has a couple of problems.  See below.

> Also, this patch makes the dg-skip-if for AVR redundant. Should I remove it ?

Of course: no reason to duplicate this, this would just be confusing.

> 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 { } {

This proc needs a comment like all the others.

> +  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;
> +    }
> +    }]
> +}

This is very wrong: some targets use a void * second arg, and other
types for the struct timeval members.  Better use
check_function_available instead, as in several other examples.  And
please test the testcase on at least one non-mips-elf target that
actually *has* gettimeofday.

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to