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] rs6000_macro_to_expand fix


Hi!

While looking at PR39558, I've noticed that the following testcase is
preprocessed incorrectly.  In -E output there is always vectorpixel int ...
or vectorbool int ..., when compiling neither vector nor bool/pixel
are expanded and so it fails to parse.

Fixed thusly, ok for trunk (this is a bug in a new 4.4 feature)?

2009-03-27  Jakub Jelinek  <jakub@redhat.com>

	* config/rs6000/rs6000-c.c (rs6000_macro_to_expand): If macro
	following vector keyword has expansion starting with pixel or bool
	keyword, expand vector to __vector and pixel or bool to __pixel or
	__bool.

	* gcc.target/powerpc/altivec-28.c: New test.

--- gcc/config/rs6000/rs6000-c.c.jj	2008-10-23 13:21:36.000000000 +0200
+++ gcc/config/rs6000/rs6000-c.c	2009-03-27 11:45:50.000000000 +0100
@@ -188,7 +188,19 @@ rs6000_macro_to_expand (cpp_reader *pfil
 		tok = cpp_peek_token (pfile, idx++);
 	      while (tok->type == CPP_PADDING);
 	      ident = altivec_categorize_keyword (tok);
-	      if (ident)
+	      if (ident == C_CPP_HASHNODE (__pixel_keyword))
+		{
+		  expand_this = C_CPP_HASHNODE (__vector_keyword);
+		  expand_bool_pixel = __pixel_keyword;
+		  rid_code = RID_MAX;
+		}
+	      else if (ident == C_CPP_HASHNODE (__bool_keyword))
+		{
+		  expand_this = C_CPP_HASHNODE (__vector_keyword);
+		  expand_bool_pixel = __bool_keyword;
+		  rid_code = RID_MAX;
+		}
+	      else if (ident)
 		rid_code = (enum rid)(ident->rid_code);
 	    }
 
--- gcc/testsuite/gcc.target/powerpc/altivec-28.c.jj	2009-03-27 11:47:23.000000000 +0100
+++ gcc/testsuite/gcc.target/powerpc/altivec-28.c	2009-03-27 11:50:15.000000000 +0100
@@ -0,0 +1,16 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec" } */
+
+#define B bool
+#define P pixel
+#define I int
+#define BI bool int
+#define PI pixel int
+
+vector B int i;
+vector P int j;
+vector B I k;
+vector P I l;
+vector BI m;
+vector PI n;


	Jakub


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