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 for PR 16155


Here is the patch for PR 16155 and a test case.  Okay for mainline?

2004-07-30  Ben Elliston  <bje@au.ibm.com>

	PR target/16155
	* config/rs6000/altivec.h: Replace typeof with __typeof__.

Index: altivec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/altivec.h,v
retrieving revision 1.40
diff -u -p -u -r1.40 altivec.h
--- altivec.h	23 Jul 2004 18:34:36 -0000	1.40
+++ altivec.h	30 Jul 2004 07:26:19 -0000
@@ -311,7 +311,7 @@ struct __vec_step_help<vector float>
   static const int _S_elem = 4;
 };
 
-#define vec_step(t)  __vec_step_help<typeof(t)>::_S_elem
+#define vec_step(t)  __vec_step_help<__typeof__(t)>::_S_elem
 
 /* vec_abs */
 
@@ -8313,31 +8313,31 @@ vec_any_out (vector float a1, vector flo
 /* Helper macros.  */
 
 #define __un_args_eq(xtype, x)						\
-	__builtin_types_compatible_p (xtype, typeof (x))
+	__builtin_types_compatible_p (xtype, __typeof__ (x))
 
 #define __bin_args_eq(xtype, x, ytype, y)				\
-	(__builtin_types_compatible_p (xtype, typeof (x))		\
-	 && __builtin_types_compatible_p (ytype, typeof (y)))
+	(__builtin_types_compatible_p (xtype, __typeof__ (x))		\
+	 && __builtin_types_compatible_p (ytype, __typeof__ (y)))
 
 #define __tern_args_eq(xtype, x, ytype, y, ztype, z)                    \
-        (__builtin_types_compatible_p (xtype, typeof (x))               \
-         && __builtin_types_compatible_p (ytype, typeof (y))		\
-	 && __builtin_types_compatible_p (ztype, typeof (z)))
+        (__builtin_types_compatible_p (xtype, __typeof__ (x))               \
+         && __builtin_types_compatible_p (ytype, __typeof__ (y))		\
+	 && __builtin_types_compatible_p (ztype, __typeof__ (z)))
 
 #define __ch(x, y, z)	__builtin_choose_expr (x, y, z)
 
 #define vec_step(t) \
-  __ch (__builtin_types_compatible_p (typeof (t), vector signed int), 4,      \
-  __ch (__builtin_types_compatible_p (typeof (t), vector unsigned int), 4,    \
-  __ch (__builtin_types_compatible_p (typeof (t), vector bool int), 4,        \
-  __ch (__builtin_types_compatible_p (typeof (t), vector signed short), 8,    \
-  __ch (__builtin_types_compatible_p (typeof (t), vector unsigned short), 8,  \
-  __ch (__builtin_types_compatible_p (typeof (t), vector bool short), 8,      \
-  __ch (__builtin_types_compatible_p (typeof (t), vector pixel), 8,           \
-  __ch (__builtin_types_compatible_p (typeof (t), vector signed char), 16,    \
-  __ch (__builtin_types_compatible_p (typeof (t), vector unsigned char), 16,  \
-  __ch (__builtin_types_compatible_p (typeof (t), vector bool char), 16,      \
-  __ch (__builtin_types_compatible_p (typeof (t), vector float), 4,           \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector signed int), 4,      \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector unsigned int), 4,    \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector bool int), 4,        \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector signed short), 8,    \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector unsigned short), 8,  \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector bool short), 8,      \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector pixel), 8,           \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector signed char), 16,    \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector unsigned char), 16,  \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector bool char), 16,      \
+  __ch (__builtin_types_compatible_p (__typeof__ (t), vector float), 4,           \
   __builtin_altivec_compiletime_error ("vec_step"))))))))))))
 
 #define vec_abs(a) \

2004-07-30  Ben Elliston  <bje@au.ibm.com>

	PR target/16155
	* gcc.dg/pr16155.c: New test.

Index: pr16155.c
===================================================================
RCS file: pr16155.c
diff -N pr16155.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pr16155.c	30 Jul 2004 07:29:55 -0000
@@ -0,0 +1,17 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-maltivec -ansi" } */
+
+/* PR 16155
+ * Compilation of a simple altivec test program fails if the -ansi flag is
+ * given to gcc, when compiling with -maltivec.
+ */
+
+#include <altivec.h>
+
+void foo(void)
+{
+  vector unsigned short a, b;
+  a = vec_splat(b, 0);
+}
+
+/* { dg-bonus "parse error before \"typeof\"" "-maltivec -mansi" { target powerpc*-*-* } 0 } */


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