This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Test complex values with non-zero imaginary value in gcc.dg/compat
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Janis Johnson <janis187 at us dot ibm dot com>,gcc-patches at gcc dot gnu dot org
- Date: Sun, 20 Jun 2004 14:19:03 +0200
- Subject: Re: [PATCH] Test complex values with non-zero imaginary value in gcc.dg/compat
- References: <20040615080911.GX5191@sunsite.ms.mff.cuni.cz>
> 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