From 70d3fcabfd2d4446b6ff44454c8f81d51ab92f8b Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Thu, 3 Jul 2008 10:31:03 +0000 Subject: [PATCH] re PR bootstrap/33304 (Bootstrap failure on solaris2 using cc due to empty macro arguments) 2008-07-03 Andrew Haley PR bootstrap/33304 * vec.h (VEC_TA): New. (DEF_VEC_I, DEF_VEC_P, DEF_VEC_ALLOC_I, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O: Use VEC_TA. * c-common.c (C_COMMON_FIXED_TYPES_SAT): New macro. (C_COMMON_FIXED_MODE_TYPES_SAT): New macro. (C_COMMON_FIXED_TYPES): Remove first arg. (C_COMMON_FIXED_MODE_TYPES): Likewise. * tree.c (MAKE_FIXED_TYPE_NODE): Break into two macros, MAKE_FIXED_TYPE_NODE and MAKE_FIXED_TYPE_NODE_WIDTH in order not to use empty macro arguments. From-SVN: r137413 --- gcc/ChangeLog | 14 ++++++ gcc/c-common.c | 118 +++++++++++++++++++++++++++++-------------------- gcc/tree.c | 19 +++++--- gcc/vec.h | 18 +++++--- 4 files changed, 111 insertions(+), 58 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 433157ab870..ad8bbd045b7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2008-07-03 Andrew Haley + + PR bootstrap/33304 + * vec.h (VEC_TA): New. + (DEF_VEC_I, DEF_VEC_P, DEF_VEC_ALLOC_I, DEF_VEC_ALLOC_P, + DEF_VEC_O, DEF_VEC_ALLOC_O: Use VEC_TA. + * c-common.c (C_COMMON_FIXED_TYPES_SAT): New macro. + (C_COMMON_FIXED_MODE_TYPES_SAT): New macro. + (C_COMMON_FIXED_TYPES): Remove first arg. + (C_COMMON_FIXED_MODE_TYPES): Likewise. + * tree.c (MAKE_FIXED_TYPE_NODE): Break into two macros, + MAKE_FIXED_TYPE_NODE and MAKE_FIXED_TYPE_NODE_WIDTH in order + not to use empty macro arguments. + 2008-07-02 Joseph Myers * config/alpha/vms_tramp.asm, config/arm/crti.asm, diff --git a/gcc/c-common.c b/gcc/c-common.c index 31c778c88b4..3a633843f73 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -2281,53 +2281,77 @@ c_common_signed_or_unsigned_type (int unsignedp, tree type) if (type1 == intQI_type_node || type1 == unsigned_intQI_type_node) return unsignedp ? unsigned_intQI_type_node : intQI_type_node; -#define C_COMMON_FIXED_TYPES(SAT,NAME) \ - if (type1 == SAT ## short_ ## NAME ## _type_node \ - || type1 == SAT ## unsigned_short_ ## NAME ## _type_node) \ - return unsignedp ? SAT ## unsigned_short_ ## NAME ## _type_node \ - : SAT ## short_ ## NAME ## _type_node; \ - if (type1 == SAT ## NAME ## _type_node \ - || type1 == SAT ## unsigned_ ## NAME ## _type_node) \ - return unsignedp ? SAT ## unsigned_ ## NAME ## _type_node \ - : SAT ## NAME ## _type_node; \ - if (type1 == SAT ## long_ ## NAME ## _type_node \ - || type1 == SAT ## unsigned_long_ ## NAME ## _type_node) \ - return unsignedp ? SAT ## unsigned_long_ ## NAME ## _type_node \ - : SAT ## long_ ## NAME ## _type_node; \ - if (type1 == SAT ## long_long_ ## NAME ## _type_node \ - || type1 == SAT ## unsigned_long_long_ ## NAME ## _type_node) \ - return unsignedp ? SAT ## unsigned_long_long_ ## NAME ## _type_node \ - : SAT ## long_long_ ## NAME ## _type_node; - -#define C_COMMON_FIXED_MODE_TYPES(SAT,NAME) \ - if (type1 == SAT ## NAME ## _type_node \ - || type1 == SAT ## u ## NAME ## _type_node) \ - return unsignedp ? SAT ## u ## NAME ## _type_node \ - : SAT ## NAME ## _type_node; - - C_COMMON_FIXED_TYPES (, fract); - C_COMMON_FIXED_TYPES (sat_, fract); - C_COMMON_FIXED_TYPES (, accum); - C_COMMON_FIXED_TYPES (sat_, accum); - - C_COMMON_FIXED_MODE_TYPES (, qq); - C_COMMON_FIXED_MODE_TYPES (, hq); - C_COMMON_FIXED_MODE_TYPES (, sq); - C_COMMON_FIXED_MODE_TYPES (, dq); - C_COMMON_FIXED_MODE_TYPES (, tq); - C_COMMON_FIXED_MODE_TYPES (sat_, qq); - C_COMMON_FIXED_MODE_TYPES (sat_, hq); - C_COMMON_FIXED_MODE_TYPES (sat_, sq); - C_COMMON_FIXED_MODE_TYPES (sat_, dq); - C_COMMON_FIXED_MODE_TYPES (sat_, tq); - C_COMMON_FIXED_MODE_TYPES (, ha); - C_COMMON_FIXED_MODE_TYPES (, sa); - C_COMMON_FIXED_MODE_TYPES (, da); - C_COMMON_FIXED_MODE_TYPES (, ta); - C_COMMON_FIXED_MODE_TYPES (sat_, ha); - C_COMMON_FIXED_MODE_TYPES (sat_, sa); - C_COMMON_FIXED_MODE_TYPES (sat_, da); - C_COMMON_FIXED_MODE_TYPES (sat_, ta); +#define C_COMMON_FIXED_TYPES(NAME) \ + if (type1 == short_ ## NAME ## _type_node \ + || type1 == unsigned_short_ ## NAME ## _type_node) \ + return unsignedp ? unsigned_short_ ## NAME ## _type_node \ + : short_ ## NAME ## _type_node; \ + if (type1 == NAME ## _type_node \ + || type1 == unsigned_ ## NAME ## _type_node) \ + return unsignedp ? unsigned_ ## NAME ## _type_node \ + : NAME ## _type_node; \ + if (type1 == long_ ## NAME ## _type_node \ + || type1 == unsigned_long_ ## NAME ## _type_node) \ + return unsignedp ? unsigned_long_ ## NAME ## _type_node \ + : long_ ## NAME ## _type_node; \ + if (type1 == long_long_ ## NAME ## _type_node \ + || type1 == unsigned_long_long_ ## NAME ## _type_node) \ + return unsignedp ? unsigned_long_long_ ## NAME ## _type_node \ + : long_long_ ## NAME ## _type_node; + +#define C_COMMON_FIXED_MODE_TYPES(NAME) \ + if (type1 == NAME ## _type_node \ + || type1 == u ## NAME ## _type_node) \ + return unsignedp ? u ## NAME ## _type_node \ + : NAME ## _type_node; + +#define C_COMMON_FIXED_TYPES_SAT(NAME) \ + if (type1 == sat_ ## short_ ## NAME ## _type_node \ + || type1 == sat_ ## unsigned_short_ ## NAME ## _type_node) \ + return unsignedp ? sat_ ## unsigned_short_ ## NAME ## _type_node \ + : sat_ ## short_ ## NAME ## _type_node; \ + if (type1 == sat_ ## NAME ## _type_node \ + || type1 == sat_ ## unsigned_ ## NAME ## _type_node) \ + return unsignedp ? sat_ ## unsigned_ ## NAME ## _type_node \ + : sat_ ## NAME ## _type_node; \ + if (type1 == sat_ ## long_ ## NAME ## _type_node \ + || type1 == sat_ ## unsigned_long_ ## NAME ## _type_node) \ + return unsignedp ? sat_ ## unsigned_long_ ## NAME ## _type_node \ + : sat_ ## long_ ## NAME ## _type_node; \ + if (type1 == sat_ ## long_long_ ## NAME ## _type_node \ + || type1 == sat_ ## unsigned_long_long_ ## NAME ## _type_node) \ + return unsignedp ? sat_ ## unsigned_long_long_ ## NAME ## _type_node \ + : sat_ ## long_long_ ## NAME ## _type_node; + +#define C_COMMON_FIXED_MODE_TYPES_SAT(NAME) \ + if (type1 == sat_ ## NAME ## _type_node \ + || type1 == sat_ ## u ## NAME ## _type_node) \ + return unsignedp ? sat_ ## u ## NAME ## _type_node \ + : sat_ ## NAME ## _type_node; + + C_COMMON_FIXED_TYPES (fract); + C_COMMON_FIXED_TYPES_SAT (fract); + C_COMMON_FIXED_TYPES (accum); + C_COMMON_FIXED_TYPES_SAT (accum); + + C_COMMON_FIXED_MODE_TYPES (qq); + C_COMMON_FIXED_MODE_TYPES (hq); + C_COMMON_FIXED_MODE_TYPES (sq); + C_COMMON_FIXED_MODE_TYPES (dq); + C_COMMON_FIXED_MODE_TYPES (tq); + C_COMMON_FIXED_MODE_TYPES_SAT (qq); + C_COMMON_FIXED_MODE_TYPES_SAT (hq); + C_COMMON_FIXED_MODE_TYPES_SAT (sq); + C_COMMON_FIXED_MODE_TYPES_SAT (dq); + C_COMMON_FIXED_MODE_TYPES_SAT (tq); + C_COMMON_FIXED_MODE_TYPES (ha); + C_COMMON_FIXED_MODE_TYPES (sa); + C_COMMON_FIXED_MODE_TYPES (da); + C_COMMON_FIXED_MODE_TYPES (ta); + C_COMMON_FIXED_MODE_TYPES_SAT (ha); + C_COMMON_FIXED_MODE_TYPES_SAT (sa); + C_COMMON_FIXED_MODE_TYPES_SAT (da); + C_COMMON_FIXED_MODE_TYPES_SAT (ta); /* For ENUMERAL_TYPEs in C++, must check the mode of the types, not the precision; they have precision set to match their range, but diff --git a/gcc/tree.c b/gcc/tree.c index 491a7b319ee..97b53bd951c 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7395,7 +7395,16 @@ build_common_tree_nodes_2 (int short_double) complex_long_double_type_node = build_complex_type (long_double_type_node); /* Make fixed-point nodes based on sat/non-sat and signed/unsigned. */ -#define MAKE_FIXED_TYPE_NODE(KIND,WIDTH,SIZE) \ +#define MAKE_FIXED_TYPE_NODE(KIND,SIZE) \ + sat_ ## KIND ## _type_node = \ + make_sat_signed_ ## KIND ## _type (SIZE); \ + sat_unsigned_ ## KIND ## _type_node = \ + make_sat_unsigned_ ## KIND ## _type (SIZE); \ + KIND ## _type_node = make_signed_ ## KIND ## _type (SIZE); \ + unsigned_ ## KIND ## _type_node = \ + make_unsigned_ ## KIND ## _type (SIZE); + +#define MAKE_FIXED_TYPE_NODE_WIDTH(KIND,WIDTH,SIZE) \ sat_ ## WIDTH ## KIND ## _type_node = \ make_sat_signed_ ## KIND ## _type (SIZE); \ sat_unsigned_ ## WIDTH ## KIND ## _type_node = \ @@ -7406,10 +7415,10 @@ build_common_tree_nodes_2 (int short_double) /* Make fixed-point type nodes based on four different widths. */ #define MAKE_FIXED_TYPE_NODE_FAMILY(N1,N2) \ - MAKE_FIXED_TYPE_NODE (N1, short_, SHORT_ ## N2 ## _TYPE_SIZE) \ - MAKE_FIXED_TYPE_NODE (N1, , N2 ## _TYPE_SIZE) \ - MAKE_FIXED_TYPE_NODE (N1, long_, LONG_ ## N2 ## _TYPE_SIZE) \ - MAKE_FIXED_TYPE_NODE (N1, long_long_, LONG_LONG_ ## N2 ## _TYPE_SIZE) + MAKE_FIXED_TYPE_NODE_WIDTH (N1, short_, SHORT_ ## N2 ## _TYPE_SIZE) \ + MAKE_FIXED_TYPE_NODE (N1, N2 ## _TYPE_SIZE) \ + MAKE_FIXED_TYPE_NODE_WIDTH (N1, long_, LONG_ ## N2 ## _TYPE_SIZE) \ + MAKE_FIXED_TYPE_NODE_WIDTH (N1, long_long_, LONG_LONG_ ## N2 ## _TYPE_SIZE) /* Make fixed-point mode nodes based on sat/non-sat and signed/unsigned. */ #define MAKE_FIXED_MODE_NODE(KIND,NAME,MODE) \ diff --git a/gcc/vec.h b/gcc/vec.h index 10bdcc5f2e9..c07ee221584 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -480,6 +480,12 @@ typedef struct VEC(T,A) GTY \ VEC(T,B) base; \ } VEC(T,A) +#define VEC_TA(T,B,A) \ +typedef struct VEC(T,A) \ +{ \ + VEC(T,B) base; \ +} VEC(T,A) + /* Convert to base type. */ #define VEC_BASE(P) ((P) ? &(P)->base : 0) @@ -491,11 +497,11 @@ static inline void VEC_OP (T,must_be,integral_type) (void) \ } \ \ VEC_T(T,base); \ -VEC_TA_GTY(T,base,none,); \ +VEC_TA(T,base,none); \ DEF_VEC_FUNC_P(T) \ struct vec_swallow_trailing_semi #define DEF_VEC_ALLOC_I(T,A) \ -VEC_TA_GTY(T,base,A,); \ +VEC_TA(T,base,A); \ DEF_VEC_ALLOC_FUNC_I(T,A) \ struct vec_swallow_trailing_semi @@ -507,11 +513,11 @@ static inline void VEC_OP (T,must_be,pointer_type) (void) \ } \ \ VEC_T_GTY(T,base); \ -VEC_TA_GTY(T,base,none,); \ +VEC_TA(T,base,none); \ DEF_VEC_FUNC_P(T) \ struct vec_swallow_trailing_semi #define DEF_VEC_ALLOC_P(T,A) \ -VEC_TA_GTY(T,base,A,); \ +VEC_TA(T,base,A); \ DEF_VEC_ALLOC_FUNC_P(T,A) \ struct vec_swallow_trailing_semi @@ -797,11 +803,11 @@ static inline T *VEC_OP (T,A,safe_insert) \ /* Vector of object. */ #define DEF_VEC_O(T) \ VEC_T_GTY(T,base); \ -VEC_TA_GTY(T,base,none,); \ +VEC_TA(T,base,none); \ DEF_VEC_FUNC_O(T) \ struct vec_swallow_trailing_semi #define DEF_VEC_ALLOC_O(T,A) \ -VEC_TA_GTY(T,base,A,); \ +VEC_TA(T,base,A); \ DEF_VEC_ALLOC_FUNC_O(T,A) \ struct vec_swallow_trailing_semi -- 2.30.2