From: Ben Elliston Date: Mon, 2 Aug 2004 01:05:47 +0000 (+0000) Subject: Patch for PR target/16155. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a4e41fdeecdeadee4f4b221ef38ab38122d1fc18;p=gcc.git Patch for PR target/16155. 2004-08-02 Ben Elliston PR target/16155 * config/rs6000/altivec.h: Replace typeof with __typeof__. [testsuite] 2004-08-02 Ben Elliston * gcc.dg/pr16155.c: New test. From-SVN: r85418 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 24af3471a4a..52e58e4789f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-08-02 Ben Elliston + + PR target/16155 + * config/rs6000/altivec.h: Replace typeof with __typeof__. + 2004-08-01 Richard Henderson * expr.c (expand_expr_real_1) : Fix crash with diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h index 7d9e62f9368..a103f105568 100644 --- a/gcc/config/rs6000/altivec.h +++ b/gcc/config/rs6000/altivec.h @@ -311,7 +311,7 @@ struct __vec_step_help static const int _S_elem = 4; }; -#define vec_step(t) __vec_step_help::_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 float a2) /* 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) \ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 28d487c4f54..69ef9dc680e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-08-02 Ben Elliston + + PR target/16155 + * gcc.dg/pr16155.c: New test. + 2004-07-31 Joseph S. Myers * gcc.dg/redecl-2.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr16155.c b/gcc/testsuite/gcc.dg/pr16155.c new file mode 100644 index 00000000000..64df264d0b6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr16155.c @@ -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 + +void foo(void) +{ + vector unsigned short a, b; + a = vec_splat(b, 0); +} + +/* { dg-bogus "parse error before \"typeof\"" "-maltivec -mansi" { target powerpc*-*-* } 0 } */