From: ebotcazou Date: Sat, 4 Jul 2009 10:51:31 +0000 (+0000) Subject: * ada-tree.h (SET_TYPE_LANG_SPECIFIC): Rewrite. X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=9af94d3d553280107be0b8d08747c48ed35625f5 * ada-tree.h (SET_TYPE_LANG_SPECIFIC): Rewrite. (SET_DECL_LANG_SPECIFIC): Likewise. (TYPE_RM_VALUE): New macro. (SET_TYPE_RM_VALUE): Likewise. (TYPE_RM_SIZE): Rewrite in terms of TYPE_RM_VALUE. (TYPE_RM_MIN_VALUE): Likewise. (TYPE_RM_MAX_VALUE): Likewise. (SET_TYPE_RM_SIZE): Rewrite in terms of SET_TYPE_RM_VALUE. (SET_TYPE_RM_MIN_VALUE): Likewise. (SET_TYPE_RM_MAX_VALUE): Likewise. * decl.c (gnat_to_gnu_entity) : Remove kludge. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149225 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a64ea5149f3..dc1f29a4596 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2009-07-04 Eric Botcazou + + * ada-tree.h (SET_TYPE_LANG_SPECIFIC): Rewrite. + (SET_DECL_LANG_SPECIFIC): Likewise. + (TYPE_RM_VALUE): New macro. + (SET_TYPE_RM_VALUE): Likewise. + (TYPE_RM_SIZE): Rewrite in terms of TYPE_RM_VALUE. + (TYPE_RM_MIN_VALUE): Likewise. + (TYPE_RM_MAX_VALUE): Likewise. + (SET_TYPE_RM_SIZE): Rewrite in terms of SET_TYPE_RM_VALUE. + (SET_TYPE_RM_MIN_VALUE): Likewise. + (SET_TYPE_RM_MAX_VALUE): Likewise. + * decl.c (gnat_to_gnu_entity) : Remove kludge. + 2009-07-04 Laurent GUERBY PR ada/40631 diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h index 38bc8620815..8d157224f29 100644 --- a/gcc/ada/gcc-interface/ada-tree.h +++ b/gcc/ada/gcc-interface/ada-tree.h @@ -40,19 +40,25 @@ struct GTY(()) lang_decl { tree t; }; #define GET_TYPE_LANG_SPECIFIC(NODE) \ (TYPE_LANG_SPECIFIC (NODE) ? TYPE_LANG_SPECIFIC (NODE)->t : NULL_TREE) -#define SET_TYPE_LANG_SPECIFIC(NODE, X) \ - (TYPE_LANG_SPECIFIC (NODE) \ - = (TYPE_LANG_SPECIFIC (NODE) \ - ? TYPE_LANG_SPECIFIC (NODE) : GGC_NEW (struct lang_type)))->t = (X) +#define SET_TYPE_LANG_SPECIFIC(NODE, X) \ +do { \ + tree tmp = (X); \ + if (!TYPE_LANG_SPECIFIC (NODE)) \ + TYPE_LANG_SPECIFIC (NODE) = GGC_NEW (struct lang_type); \ + TYPE_LANG_SPECIFIC (NODE)->t = tmp; \ +} while (0) /* Macros to get and set the tree in DECL_LANG_SPECIFIC. */ #define GET_DECL_LANG_SPECIFIC(NODE) \ (DECL_LANG_SPECIFIC (NODE) ? DECL_LANG_SPECIFIC (NODE)->t : NULL_TREE) -#define SET_DECL_LANG_SPECIFIC(NODE, X) \ - (DECL_LANG_SPECIFIC (NODE) \ - = (DECL_LANG_SPECIFIC (NODE) \ - ? DECL_LANG_SPECIFIC (NODE) : GGC_NEW (struct lang_decl)))->t = (X) +#define SET_DECL_LANG_SPECIFIC(NODE, X) \ +do { \ + tree tmp = (X); \ + if (!DECL_LANG_SPECIFIC (NODE)) \ + DECL_LANG_SPECIFIC (NODE) = GGC_NEW (struct lang_decl); \ + DECL_LANG_SPECIFIC (NODE)->t = tmp; \ +} while (0) /* Flags added to type nodes. */ @@ -184,6 +190,19 @@ struct GTY(()) lang_decl { tree t; }; /* For numerical types, this holds various RM-defined values. */ #define TYPE_RM_VALUES(NODE) TYPE_LANG_SLOT_1 (NUMERICAL_TYPE_CHECK (NODE)) +/* Macros to get and set the individual values in TYPE_RM_VALUES. */ +#define TYPE_RM_VALUE(NODE, N) \ + (TYPE_RM_VALUES (NODE) \ + ? TREE_VEC_ELT (TYPE_RM_VALUES (NODE), (N)) : NULL_TREE) + +#define SET_TYPE_RM_VALUE(NODE, N, X) \ +do { \ + tree tmp = (X); \ + if (!TYPE_RM_VALUES (NODE)) \ + TYPE_RM_VALUES (NODE) = make_tree_vec (3); \ + TREE_VEC_ELT (TYPE_RM_VALUES (NODE), (N)) = tmp; \ +} while (0) + /* For numerical types, this is the RM size of the type, aka its precision. There is a discrepancy between what is called precision here (and more generally throughout gigi) and what is called precision in the GCC type @@ -196,12 +215,8 @@ struct GTY(()) lang_decl { tree t; }; the optimizer can pretend that they simply don't exist. Therefore they must be within the range of values allowed by the precision in the GCC sense, hence TYPE_PRECISION be set to the Esize, not the RM size. */ -#define TYPE_RM_SIZE(NODE) \ - (TYPE_RM_VALUES (NODE) ? TREE_VEC_ELT (TYPE_RM_VALUES (NODE), 0) : NULL_TREE) -#define SET_TYPE_RM_SIZE(NODE, X) \ - TREE_VEC_ELT ((TYPE_RM_VALUES (NODE) \ - = (TYPE_RM_VALUES (NODE) \ - ? TYPE_RM_VALUES (NODE) : make_tree_vec (3))), 0) = (X) +#define TYPE_RM_SIZE(NODE) TYPE_RM_VALUE ((NODE), 0) +#define SET_TYPE_RM_SIZE(NODE, X) SET_TYPE_RM_VALUE ((NODE), 0, (X)) /* For numerical types, this is the RM lower bound of the type. There is again a discrepancy between this lower bound and the GCC lower bound, @@ -212,12 +227,8 @@ struct GTY(()) lang_decl { tree t; }; the optimizer can pretend that they simply don't exist. Therefore they must be within the range of values allowed by the lower bound in the GCC sense, hence the GCC lower bound be set to that of the base type. */ -#define TYPE_RM_MIN_VALUE(NODE) \ - (TYPE_RM_VALUES (NODE) ? TREE_VEC_ELT (TYPE_RM_VALUES (NODE), 1) : NULL_TREE) -#define SET_TYPE_RM_MIN_VALUE(NODE, X) \ - TREE_VEC_ELT ((TYPE_RM_VALUES (NODE) \ - = (TYPE_RM_VALUES (NODE) \ - ? TYPE_RM_VALUES (NODE) : make_tree_vec (3))), 1) = (X) +#define TYPE_RM_MIN_VALUE(NODE) TYPE_RM_VALUE ((NODE), 1) +#define SET_TYPE_RM_MIN_VALUE(NODE, X) SET_TYPE_RM_VALUE ((NODE), 1, (X)) /* For numerical types, this is the RM upper bound of the type. There is again a discrepancy between this upper bound and the GCC upper bound, @@ -228,12 +239,8 @@ struct GTY(()) lang_decl { tree t; }; the optimizer can pretend that they simply don't exist. Therefore they must be within the range of values allowed by the upper bound in the GCC sense, hence the GCC upper bound be set to that of the base type. */ -#define TYPE_RM_MAX_VALUE(NODE) \ - (TYPE_RM_VALUES (NODE) ? TREE_VEC_ELT (TYPE_RM_VALUES (NODE), 2) : NULL_TREE) -#define SET_TYPE_RM_MAX_VALUE(NODE, X) \ - TREE_VEC_ELT ((TYPE_RM_VALUES (NODE) \ - = (TYPE_RM_VALUES (NODE) \ - ? TYPE_RM_VALUES (NODE) : make_tree_vec (3))), 2) = (X) +#define TYPE_RM_MAX_VALUE(NODE) TYPE_RM_VALUE ((NODE), 2) +#define SET_TYPE_RM_MAX_VALUE(NODE, X) SET_TYPE_RM_VALUE ((NODE), 2, (X)) /* For numerical types, this is the lower bound of the type, i.e. the RM lower bound for language-defined types and the GCC lower bound for others. */ diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index f380213c874..42086128cd7 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -2629,12 +2629,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) #endif } - /* ??? This is necessary to make sure that the container is - allocated with a null tree upfront; otherwise, it could - be allocated with an uninitialized tree that is accessed - before being set below. See ada-tree.h for details. */ - SET_TYPE_ACTUAL_BOUNDS (gnu_inner_type, NULL_TREE); - for (gnat_index = First_Index (gnat_entity); Present (gnat_index); gnat_index = Next_Index (gnat_index)) SET_TYPE_ACTUAL_BOUNDS