mirror of git://gcc.gnu.org/git/gcc.git
tree.h (CONSTRUCTOR_NO_CLEARING): Define.
* tree.h (CONSTRUCTOR_NO_CLEARING): Define. * tree-core.h (CONSTRUCTOR_NO_CLEARING): Document it. * tree.def (CONSTRUCTOR): Likewise. * doc/generic.texi (CONSTRUCTOR): Likewise. Update description. * gimplify.c (gimplify_init_constructor): Do not clear the object when the constructor is incomplete and CONSTRUCTOR_NO_CLEARING is set. ada/ * gcc-interface/utils2.c (gnat_build_constructor): Also set the flag CONSTRUCTOR_NO_CLEARING on the constructor. From-SVN: r204677
This commit is contained in:
parent
7008512d47
commit
1448093c32
|
|
@ -1,3 +1,12 @@
|
|||
2013-11-11 Tristan Gingold <gingold@adacore.com>
|
||||
Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* tree.h (CONSTRUCTOR_NO_CLEARING): Define.
|
||||
* tree-core.h (CONSTRUCTOR_NO_CLEARING): Document it.
|
||||
* tree.def (CONSTRUCTOR): Likewise.
|
||||
* doc/generic.texi (CONSTRUCTOR): Likewise. Update description.
|
||||
* gimplify.c (gimplify_init_constructor): Do not clear the object when
|
||||
the constructor is incomplete and CONSTRUCTOR_NO_CLEARING is set.
|
||||
|
||||
2013-11-11 Basile Starynkevitch <basile@starynkevitch.net>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
2013-11-11 Tristan Gingold <gingold@adacore.com>
|
||||
Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/utils2.c (gnat_build_constructor): Also set the flag
|
||||
CONSTRUCTOR_NO_CLEARING on the constructor.
|
||||
|
||||
2013-10-30 Sharad Singhai <singhai@google.com>
|
||||
|
||||
* gnat_ugn.texi: Remove option description for PR middle-end/58134.
|
||||
|
|
|
|||
|
|
@ -1874,6 +1874,7 @@ gnat_build_constructor (tree type, vec<constructor_elt, va_gc> *v)
|
|||
v->qsort (compare_elmt_bitpos);
|
||||
|
||||
result = build_constructor (type, v);
|
||||
CONSTRUCTOR_NO_CLEARING (result) = 1;
|
||||
TREE_CONSTANT (result) = TREE_STATIC (result) = allconstant;
|
||||
TREE_SIDE_EFFECTS (result) = side_effects;
|
||||
TREE_READONLY (result) = TYPE_READONLY (type) || allconstant;
|
||||
|
|
|
|||
|
|
@ -1616,29 +1616,31 @@ of temporaries during the evaluation of that expression should be
|
|||
performed immediately after the expression is evaluated.
|
||||
|
||||
@item CONSTRUCTOR
|
||||
These nodes represent the brace-enclosed initializers for a structure or
|
||||
array. The first operand is reserved for use by the back end. The
|
||||
second operand is a @code{TREE_LIST}. If the @code{TREE_TYPE} of the
|
||||
@code{CONSTRUCTOR} is a @code{RECORD_TYPE} or @code{UNION_TYPE}, then
|
||||
the @code{TREE_PURPOSE} of each node in the @code{TREE_LIST} will be a
|
||||
@code{FIELD_DECL} and the @code{TREE_VALUE} of each node will be the
|
||||
expression used to initialize that field.
|
||||
These nodes represent the brace-enclosed initializers for a structure or an
|
||||
array. They contain a sequence of component values made out of a vector of
|
||||
constructor_elt, which is a (@code{INDEX}, @code{VALUE}) pair.
|
||||
|
||||
If the @code{TREE_TYPE} of the @code{CONSTRUCTOR} is an
|
||||
@code{ARRAY_TYPE}, then the @code{TREE_PURPOSE} of each element in the
|
||||
@code{TREE_LIST} will be an @code{INTEGER_CST} or a @code{RANGE_EXPR} of
|
||||
two @code{INTEGER_CST}s. A single @code{INTEGER_CST} indicates which
|
||||
element of the array (indexed from zero) is being assigned to. A
|
||||
@code{RANGE_EXPR} indicates an inclusive range of elements to
|
||||
initialize. In both cases the @code{TREE_VALUE} is the corresponding
|
||||
If the @code{TREE_TYPE} of the @code{CONSTRUCTOR} is a @code{RECORD_TYPE},
|
||||
@code{UNION_TYPE} or @code{QUAL_UNION_TYPE} then the @code{INDEX} of each
|
||||
node in the sequence will be a @code{FIELD_DECL} and the @code{VALUE} will
|
||||
be the expression used to initialize that field.
|
||||
|
||||
If the @code{TREE_TYPE} of the @code{CONSTRUCTOR} is an @code{ARRAY_TYPE},
|
||||
then the @code{INDEX} of each node in the sequence will be an
|
||||
@code{INTEGER_CST} or a @code{RANGE_EXPR} of two @code{INTEGER_CST}s.
|
||||
A single @code{INTEGER_CST} indicates which element of the array is being
|
||||
assigned to. A @code{RANGE_EXPR} indicates an inclusive range of elements
|
||||
to initialize. In both cases the @code{VALUE} is the corresponding
|
||||
initializer. It is re-evaluated for each element of a
|
||||
@code{RANGE_EXPR}. If the @code{TREE_PURPOSE} is @code{NULL_TREE}, then
|
||||
@code{RANGE_EXPR}. If the @code{INDEX} is @code{NULL_TREE}, then
|
||||
the initializer is for the next available array element.
|
||||
|
||||
In the front end, you should not depend on the fields appearing in any
|
||||
particular order. However, in the middle end, fields must appear in
|
||||
declaration order. You should not assume that all fields will be
|
||||
represented. Unrepresented fields will be set to zero.
|
||||
represented. Unrepresented fields will be cleared (zeroed), unless the
|
||||
CONSTRUCTOR_NO_CLEARING flag is set, in which case their value becomes
|
||||
undefined.
|
||||
|
||||
@item COMPOUND_LITERAL_EXPR
|
||||
@findex COMPOUND_LITERAL_EXPR_DECL_EXPR
|
||||
|
|
|
|||
|
|
@ -831,6 +831,9 @@ struct GTY(()) tree_base {
|
|||
VAR_DECL, FUNCTION_DECL
|
||||
IDENTIFIER_NODE
|
||||
|
||||
CONSTRUCTOR_NO_CLEARING in
|
||||
CONSTRUCTOR
|
||||
|
||||
ASM_VOLATILE_P in
|
||||
ASM_EXPR
|
||||
|
||||
|
|
|
|||
15
gcc/tree.def
15
gcc/tree.def
|
|
@ -445,10 +445,12 @@ DEFTREECODE (INDIRECT_REF, "indirect_ref", tcc_reference, 1)
|
|||
OBJ_TYPE_REF_TOKEN: An integer index to the virtual method table. */
|
||||
DEFTREECODE (OBJ_TYPE_REF, "obj_type_ref", tcc_expression, 3)
|
||||
|
||||
/* Constructor: return an aggregate value made from specified components.
|
||||
In C, this is used only for structure and array initializers.
|
||||
The operand is a sequence of component values made out of a VEC of
|
||||
struct constructor_elt.
|
||||
/* Used to represent the brace-enclosed initializers for a structure or an
|
||||
array. It contains a sequence of component values made out of a VEC of
|
||||
constructor_elt.
|
||||
|
||||
For RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE:
|
||||
The field INDEX of each constructor_elt is a FIELD_DECL.
|
||||
|
||||
For ARRAY_TYPE:
|
||||
The field INDEX of each constructor_elt is the corresponding index.
|
||||
|
|
@ -457,8 +459,9 @@ DEFTREECODE (OBJ_TYPE_REF, "obj_type_ref", tcc_expression, 3)
|
|||
has side-effects, they are evaluated once for each element. Wrap the
|
||||
value in a SAVE_EXPR if you want to evaluate side effects only once.)
|
||||
|
||||
For RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE:
|
||||
The field INDEX of each node is a FIELD_DECL. */
|
||||
Components that aren't present are cleared as per the C semantics,
|
||||
unless the CONSTRUCTOR_NO_CLEARING flag is set, in which case their
|
||||
value becomes undefined. */
|
||||
DEFTREECODE (CONSTRUCTOR, "constructor", tcc_exceptional, 0)
|
||||
|
||||
/* The expression types are mostly straightforward, with the fourth argument
|
||||
|
|
|
|||
|
|
@ -957,6 +957,8 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
|
|||
(&(*CONSTRUCTOR_ELTS (NODE))[IDX])
|
||||
#define CONSTRUCTOR_NELTS(NODE) \
|
||||
(vec_safe_length (CONSTRUCTOR_ELTS (NODE)))
|
||||
#define CONSTRUCTOR_NO_CLEARING(NODE) \
|
||||
(CONSTRUCTOR_CHECK (NODE)->base.public_flag)
|
||||
|
||||
/* Iterate through the vector V of CONSTRUCTOR_ELT elements, yielding the
|
||||
value of each element (stored within VAL). IX must be a scratch variable
|
||||
|
|
|
|||
Loading…
Reference in New Issue