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]

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


Hi!

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.
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.
Tested on x86_64-redhat-linux.

Ok to commit?

2004-06-15  Jakub Jelinek  <jakub@redhat.com>

	* gcc.dg/compat/compat-common.h (CINT, CDBL): Define.
	* gcc.dg/compat/scalar-return-3_x.c: Use it.
	* gcc.dg/compat/scalar-return-3_y.c: Use it.
	* gcc.dg/compat/scalar-return-4_x.c: Use it.
	* gcc.dg/compat/scalar-return-4_y.c: Use it.
	* gcc.dg/compat/scalar-by-value-3_x.c: Use it.
	* gcc.dg/compat/scalar-by-value-3_y.c: Use it.
	* gcc.dg/compat/scalar-by-value-4_x.c: Use it.
	* gcc.dg/compat/scalar-by-value-4_y.c: Use it.

--- gcc/testsuite/gcc.dg/compat/compat-common.h.jj	2003-07-08 19:52:00.000000000 +0200
+++ 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
+
 extern void abort (void);
 extern int fails;
--- gcc/testsuite/gcc.dg/compat/scalar-return-3_x.c.jj	2004-01-24 11:59:36.000000000 +0100
+++ gcc/testsuite/gcc.dg/compat/scalar-return-3_x.c	2004-06-15 12:10:34.325421230 +0200
@@ -84,12 +84,12 @@ testit##NAME (void)						\
 }
 
 #ifndef SKIP_COMPLEX_INT
-T(ci, _Complex int, (2,3))
-T(cl, _Complex long, (3,4))
-T(cll, _Complex long long, (4,5))
+T(ci, _Complex int, CINT (2, 3))
+T(cl, _Complex long, CINT (3, 4))
+T(cll, _Complex long long, CINT (4, 5))
 #endif
-T(cd, _Complex double, (2.0,3.0))
-T(cld, _Complex long double, (3.0,4.0))
+T(cd, _Complex double, CDBL (2.0, 3.0))
+T(cld, _Complex long double, CDBL (3.0, 4.0))
 
 #undef T
 
--- gcc/testsuite/gcc.dg/compat/scalar-return-3_y.c.jj	2004-01-24 11:59:36.000000000 +0100
+++ gcc/testsuite/gcc.dg/compat/scalar-return-3_y.c	2004-06-15 12:10:34.326421051 +0200
@@ -63,9 +63,9 @@ testva##NAME (int n, ...)					\
 }
 
 #ifndef SKIP_COMPLEX_INT
-T(ci, _Complex int, (2,3))
-T(cl, _Complex long, (3,4))
-T(cll, _Complex long long, (4,5))
+T(ci, _Complex int, CINT (2, 3))
+T(cl, _Complex long, CINT (3, 4))
+T(cll, _Complex long long, CINT (4, 5))
 #endif
-T(cd, _Complex double, (2.0,3.0))
-T(cld, _Complex long double, (3.0,4.0))
+T(cd, _Complex double, CDBL (2.0, 3.0))
+T(cld, _Complex long double, CDBL (3.0, 4.0))
--- gcc/testsuite/gcc.dg/compat/scalar-by-value-3_y.c.jj	2004-01-24 11:59:36.000000000 +0100
+++ gcc/testsuite/gcc.dg/compat/scalar-by-value-3_y.c	2004-06-15 12:10:34.327420872 +0200
@@ -85,9 +85,9 @@ testva##NAME (int n, ...)					\
 }
 
 #ifndef SKIP_COMPLEX_INT
-T(ci, _Complex int, (2,3))
-T(cl, _Complex long, (3,4))
-T(cll, _Complex long long, (5,6))
+T(ci, _Complex int, CINT (2, 3))
+T(cl, _Complex long, CINT (3, 4))
+T(cll, _Complex long long, CINT (5, 6))
 #endif
-T(cd, _Complex double, (7.0,8.0))
-T(cld, _Complex long double, (8.0,9.0))
+T(cd, _Complex double, CDBL (7.0, 8.0))
+T(cld, _Complex long double, CDBL (8.0, 9.0))
--- gcc/testsuite/gcc.dg/compat/scalar-by-value-3_x.c.jj	2004-01-24 11:59:36.000000000 +0100
+++ gcc/testsuite/gcc.dg/compat/scalar-by-value-3_x.c	2004-06-15 12:10:34.328420692 +0200
@@ -145,12 +145,12 @@ testit##NAME (void)						\
 }
 
 #ifndef SKIP_COMPLEX_INT
-T(ci, _Complex int, (2,3))
-T(cl, _Complex long, (3,4))
-T(cll, _Complex long long, (5,6))
+T(ci, _Complex int, CINT (2, 3))
+T(cl, _Complex long, CINT (3, 4))
+T(cll, _Complex long long, CINT (5, 6))
 #endif
-T(cd, _Complex double, (7.0,8.0))
-T(cld, _Complex long double, (8.0,9.0))
+T(cd, _Complex double, CDBL (7.0, 8.0))
+T(cld, _Complex long double, CDBL (8.0, 9.0))
 
 #undef T
 
--- gcc/testsuite/gcc.dg/compat/scalar-by-value-4_x.c.jj	2004-01-24 11:59:36.000000000 +0100
+++ gcc/testsuite/gcc.dg/compat/scalar-by-value-4_x.c	2004-06-15 12:10:34.328420692 +0200
@@ -69,10 +69,10 @@ testit##NAME (void)						\
 }
 
 #ifndef SKIP_COMPLEX_INT
-T(cc, _Complex char, (0,1))
-T(cs, _Complex short, (1,2))
+T(cc, _Complex char, CINT (0, 1))
+T(cs, _Complex short, CINT (1, 2))
 #endif
-T(cf, _Complex float, (6.0,7.0))
+T(cf, _Complex float, CDBL (6.0, 7.0))
 
 #undef T
 
--- gcc/testsuite/gcc.dg/compat/scalar-return-4_x.c.jj	2004-01-24 11:59:36.000000000 +0100
+++ gcc/testsuite/gcc.dg/compat/scalar-return-4_x.c	2004-06-15 12:10:34.329420513 +0200
@@ -37,10 +37,10 @@ testit##NAME (void)						\
 }
 
 #ifndef SKIP_COMPLEX_INT
-T(cc, _Complex char, (0,1))
-T(cs, _Complex short, (1,2))
+T(cc, _Complex char, CINT (0, 1))
+T(cs, _Complex short, CINT (1 + 2))
 #endif
-T(cf, _Complex float, (1.0,2.0))
+T(cf, _Complex float, CDBL (1.0, 2.0))
 
 #undef T
 
--- gcc/testsuite/gcc.dg/compat/scalar-return-4_y.c.jj	2004-01-24 11:59:36.000000000 +0100
+++ gcc/testsuite/gcc.dg/compat/scalar-return-4_y.c	2004-06-15 12:10:34.330420334 +0200
@@ -38,7 +38,7 @@ test1##NAME (TYPE x01)						\
 }
 
 #ifndef SKIP_COMPLEX_INT
-T(cc, _Complex char, (0,1))
-T(cs, _Complex short, (1,2))
+T(cc, _Complex char, CINT (0, 1))
+T(cs, _Complex short, CINT (1, 2))
 #endif
-T(cf, _Complex float, (1.0,2.0))
+T(cf, _Complex float, CDBL (1.0, 2.0))
--- gcc/testsuite/gcc.dg/compat/scalar-by-value-4_y.c.jj	2004-01-24 11:59:36.000000000 +0100
+++ gcc/testsuite/gcc.dg/compat/scalar-by-value-4_y.c	2004-06-15 12:10:34.330420334 +0200
@@ -68,7 +68,7 @@ test##NAME (TYPE x01, TYPE x02, TYPE x03
 }
 
 #ifndef SKIP_COMPLEX_INT
-T(cc, _Complex char, (0,1))
-T(cs, _Complex short, (1,2))
+T(cc, _Complex char, CINT (0, 1))
+T(cs, _Complex short, CINT (1, 2))
 #endif
-T(cf, _Complex float, (6.0,7.0))
+T(cf, _Complex float, CDBL (6.0, 7.0))

	Jakub


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