This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Test complex values with non-zero imaginary value in gcc.dg/compat


> I have noticed that gcc.dg/compat uses code like:
> void
> checkcd (_Complex double x, _Complex double v)
> {
>   if (x != v + (7.0,8.0))
>     DEBUG_CHECK
> }
> I believe the intent was to test 7.0 + 8.0i, otherwise it has no
> sense.

Yes, an old oversight.

> As 7.0 + 8.0i is a GNU extension, I think it is better to macroize
> this, so that it can be changed for other compilers in a central location.

Yes, the compat testsuite should be able to run with any C99 compilers, once 
the appropriate COMPAT_SKIPS list is declared (see lib/compat.exp).

> gcc/testsuite/gcc.dg/compat/compat-common.h	2004-06-15 12:14:33.379579612
> +0200 @@ -24,5 +24,14 @@
>  #define DEBUG_FINI
>  #endif
>
> +#ifdef __GNUC__
> +#define CINT(x, y) (x + __extension__ y##i)
> +#define CDBL(x, y) (x + __extension__ y##i)
> +#else
> +#include <complex.h>
> +#define CINT(x, y) ((_Complex int) (x + y * _Complex_I))
> +#define CDBL(x, y) (x + y * _Complex_I)
> +#endif
> +

This is not portable: _Complex int is a GNU extension.  I think the solution 
could be to guard CINT with #ifndef SKIP_COMPLEX_INT.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]