re PR target/40017 (stdbool.h/altivec.h)

PR target/40017
	* config/rs6000/rs6000-c.c (_Bool_keyword): New variable.
	(altivec_categorize_keyword, init_vector_keywords,
	rs6000_cpu_cpp_builtins): Define _Bool as conditional macro
	similar to bool.

	* gcc.target/powerpc/altivec-types-1.c: Don't expect error for
	__vector _Bool.
	* gcc.target/powerpc/altivec-30.c: New test.
	* gcc.target/powerpc/altivec-31.c: New test.

From-SVN: r147971
This commit is contained in:
Jakub Jelinek 2009-05-29 09:14:20 +02:00 committed by Jakub Jelinek
parent 6daf6017a1
commit 201cbfd5ee
6 changed files with 86 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2009-05-29 Jakub Jelinek <jakub@redhat.com>
PR target/40017
* config/rs6000/rs6000-c.c (_Bool_keyword): New variable.
(altivec_categorize_keyword, init_vector_keywords,
rs6000_cpu_cpp_builtins): Define _Bool as conditional macro
similar to bool.
2009-05-28 Alexandre Oliva <aoliva@redhat.com>
* tree-inline.c (remap_decls): Enable nonlocalized variables

View File

@ -91,6 +91,7 @@ static GTY(()) tree __pixel_keyword;
static GTY(()) tree pixel_keyword;
static GTY(()) tree __bool_keyword;
static GTY(()) tree bool_keyword;
static GTY(()) tree _Bool_keyword;
/* Preserved across calls. */
static tree expand_bool_pixel;
@ -111,6 +112,9 @@ altivec_categorize_keyword (const cpp_token *tok)
if (ident == C_CPP_HASHNODE (bool_keyword))
return C_CPP_HASHNODE (__bool_keyword);
if (ident == C_CPP_HASHNODE (_Bool_keyword))
return C_CPP_HASHNODE (__bool_keyword);
return ident;
}
@ -141,6 +145,9 @@ init_vector_keywords (void)
bool_keyword = get_identifier ("bool");
C_CPP_HASHNODE (bool_keyword)->flags |= NODE_CONDITIONAL;
_Bool_keyword = get_identifier ("_Bool");
C_CPP_HASHNODE (_Bool_keyword)->flags |= NODE_CONDITIONAL;
}
/* Called to decide whether a conditional macro should be expanded.
@ -295,6 +302,7 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
builtin_define ("vector=vector");
builtin_define ("pixel=pixel");
builtin_define ("bool=bool");
builtin_define ("_Bool=_Bool");
init_vector_keywords ();
/* Enable context-sensitive macros. */

View File

@ -1,3 +1,11 @@
2009-05-29 Jakub Jelinek <jakub@redhat.com>
PR target/40017
* gcc.target/powerpc/altivec-types-1.c: Don't expect error for
__vector _Bool.
* gcc.target/powerpc/altivec-30.c: New test.
* gcc.target/powerpc/altivec-31.c: New test.
2009-05-27 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/initlist15.C: New.

View File

@ -0,0 +1,32 @@
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */
#include <stdbool.h>
#include <altivec.h>
#define f0(type) void x0##type (vector bool type x) { }
f0 (int)
#define f1(v, type) void x1##type (v bool type x) { }
f1 (vector, int)
#define f2(b, type) void x2##type (vector b type x) { }
f2 (bool, int)
#define f3(v, b, type) void x3##type (v b type x) { }
f3 (vector, bool, int)
#define f4(v, b, type) void x4##type (v type b x) { }
f4 (vector, bool, int)
#define B bool
#define I int
#define BI bool int
#define VBI vector bool int
vector bool int a;
vector B int b;
vector B I c;
vector BI d;
VBI e;

View File

@ -0,0 +1,29 @@
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */
#define f0(type) void x0##type (vector _Bool type x) { }
f0 (int)
#define f1(v, type) void x1##type (v _Bool type x) { }
f1 (vector, int)
#define f2(b, type) void x2##type (vector b type x) { }
f2 (_Bool, int)
#define f3(v, b, type) void x3##type (v b type x) { }
f3 (vector, _Bool, int)
#define f4(v, b, type) void x4##type (v type b x) { }
f4 (vector, _Bool, int)
#define B _Bool
#define I int
#define BI _Bool int
#define VBI vector _Bool int
vector _Bool int a;
vector B int b;
vector B I c;
vector BI d;
VBI e;

View File

@ -24,6 +24,7 @@ __vector unsigned vuj;
__vector signed vsj;
__vector __bool vbj;
__vector float vf;
__vector _Bool vb;
/* These should be rejected as invalid AltiVec types. */
@ -37,7 +38,6 @@ __vector signed long long int vslli; /* { dg-error "AltiVec types" "" } */
__vector __bool long long int vblli; /* { dg-error "AltiVec types" "" } */
__vector double vd1; /* { dg-error "AltiVec types" "" } */
__vector long double vld; /* { dg-error "AltiVec types" "" } */
__vector _Bool vb; /* { dg-error "AltiVec types" "" } */
__vector _Complex float vcf; /* { dg-error "AltiVec types" "" } */
__vector _Complex double vcd; /* { dg-error "AltiVec types" "" } */
__vector _Complex long double vcld; /* { dg-error "AltiVec types" "" } */