Commit 3e636daf by Marek Polacek Committed by Marek Polacek

c-decl.c: Use RECORD_OR_UNION_TYPE_P throughout.

	* c-decl.c: Use RECORD_OR_UNION_TYPE_P throughout.
	* c-typeck.c: Likewise.

From-SVN: r230375
parent 9bd6766d
2015-11-14 Marek Polacek <polacek@redhat.com>
* c-decl.c: Use RECORD_OR_UNION_TYPE_P throughout.
* c-typeck.c: Likewise.
2015-11-13 David Malcolm <dmalcolm@redhat.com> 2015-11-13 David Malcolm <dmalcolm@redhat.com>
* c-decl.c (warn_defaults_to): Pass line_table to * c-decl.c (warn_defaults_to): Pass line_table to
......
...@@ -3048,8 +3048,7 @@ pushdecl (tree x) ...@@ -3048,8 +3048,7 @@ pushdecl (tree x)
element = TREE_TYPE (element); element = TREE_TYPE (element);
element = TYPE_MAIN_VARIANT (element); element = TYPE_MAIN_VARIANT (element);
if ((TREE_CODE (element) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (element)
|| TREE_CODE (element) == UNION_TYPE)
&& (TREE_CODE (x) != TYPE_DECL && (TREE_CODE (x) != TYPE_DECL
|| TREE_CODE (TREE_TYPE (x)) == ARRAY_TYPE) || TREE_CODE (TREE_TYPE (x)) == ARRAY_TYPE)
&& !COMPLETE_TYPE_P (element)) && !COMPLETE_TYPE_P (element))
...@@ -4643,8 +4642,7 @@ diagnose_uninitialized_cst_member (tree decl, tree type) ...@@ -4643,8 +4642,7 @@ diagnose_uninitialized_cst_member (tree decl, tree type)
inform (DECL_SOURCE_LOCATION (field), "%qD should be initialized", field); inform (DECL_SOURCE_LOCATION (field), "%qD should be initialized", field);
} }
if (TREE_CODE (field_type) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (field_type))
|| TREE_CODE (field_type) == UNION_TYPE)
diagnose_uninitialized_cst_member (decl, field_type); diagnose_uninitialized_cst_member (decl, field_type);
} }
} }
...@@ -4966,8 +4964,7 @@ finish_decl (tree decl, location_t init_loc, tree init, ...@@ -4966,8 +4964,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
if (TREE_READONLY (decl)) if (TREE_READONLY (decl))
warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat, warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat,
"uninitialized const %qD is invalid in C++", decl); "uninitialized const %qD is invalid in C++", decl);
else if ((TREE_CODE (type) == RECORD_TYPE else if (RECORD_OR_UNION_TYPE_P (type)
|| TREE_CODE (type) == UNION_TYPE)
&& C_TYPE_FIELDS_READONLY (type)) && C_TYPE_FIELDS_READONLY (type))
diagnose_uninitialized_cst_member (decl, type); diagnose_uninitialized_cst_member (decl, type);
} }
...@@ -6726,8 +6723,7 @@ grokdeclarator (const struct c_declarator *declarator, ...@@ -6726,8 +6723,7 @@ grokdeclarator (const struct c_declarator *declarator,
&& VAR_P (decl) && VAR_P (decl)
&& TREE_PUBLIC (decl) && TREE_PUBLIC (decl)
&& TREE_STATIC (decl) && TREE_STATIC (decl)
&& (TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE && (RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl))
|| TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE) || TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
&& TYPE_NAME (TREE_TYPE (decl)) == NULL_TREE) && TYPE_NAME (TREE_TYPE (decl)) == NULL_TREE)
warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat, warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat,
...@@ -7282,8 +7278,7 @@ grokfield (location_t loc, ...@@ -7282,8 +7278,7 @@ grokfield (location_t loc,
that took root before someone noticed the bug... */ that took root before someone noticed the bug... */
tree type = declspecs->type; tree type = declspecs->type;
bool type_ok = (TREE_CODE (type) == RECORD_TYPE bool type_ok = RECORD_OR_UNION_TYPE_P (type);
|| TREE_CODE (type) == UNION_TYPE);
bool ok = false; bool ok = false;
if (type_ok if (type_ok
...@@ -7359,7 +7354,7 @@ is_duplicate_field (tree x, tree y) ...@@ -7359,7 +7354,7 @@ is_duplicate_field (tree x, tree y)
xt = TREE_TYPE (x); xt = TREE_TYPE (x);
if (DECL_NAME (x) != NULL_TREE) if (DECL_NAME (x) != NULL_TREE)
xn = DECL_NAME (x); xn = DECL_NAME (x);
else if ((TREE_CODE (xt) == RECORD_TYPE || TREE_CODE (xt) == UNION_TYPE) else if (RECORD_OR_UNION_TYPE_P (xt)
&& TYPE_NAME (xt) != NULL_TREE && TYPE_NAME (xt) != NULL_TREE
&& TREE_CODE (TYPE_NAME (xt)) == TYPE_DECL) && TREE_CODE (TYPE_NAME (xt)) == TYPE_DECL)
xn = DECL_NAME (TYPE_NAME (xt)); xn = DECL_NAME (TYPE_NAME (xt));
...@@ -7369,7 +7364,7 @@ is_duplicate_field (tree x, tree y) ...@@ -7369,7 +7364,7 @@ is_duplicate_field (tree x, tree y)
yt = TREE_TYPE (y); yt = TREE_TYPE (y);
if (DECL_NAME (y) != NULL_TREE) if (DECL_NAME (y) != NULL_TREE)
yn = DECL_NAME (y); yn = DECL_NAME (y);
else if ((TREE_CODE (yt) == RECORD_TYPE || TREE_CODE (yt) == UNION_TYPE) else if (RECORD_OR_UNION_TYPE_P (yt)
&& TYPE_NAME (yt) != NULL_TREE && TYPE_NAME (yt) != NULL_TREE
&& TREE_CODE (TYPE_NAME (yt)) == TYPE_DECL) && TREE_CODE (TYPE_NAME (yt)) == TYPE_DECL)
yn = DECL_NAME (TYPE_NAME (yt)); yn = DECL_NAME (TYPE_NAME (yt));
...@@ -7404,8 +7399,7 @@ detect_field_duplicates_hash (tree fieldlist, ...@@ -7404,8 +7399,7 @@ detect_field_duplicates_hash (tree fieldlist,
} }
*slot = y; *slot = y;
} }
else if (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE else if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (x)))
|| TREE_CODE (TREE_TYPE (x)) == UNION_TYPE)
{ {
detect_field_duplicates_hash (TYPE_FIELDS (TREE_TYPE (x)), htab); detect_field_duplicates_hash (TYPE_FIELDS (TREE_TYPE (x)), htab);
...@@ -7456,8 +7450,7 @@ detect_field_duplicates (tree fieldlist) ...@@ -7456,8 +7450,7 @@ detect_field_duplicates (tree fieldlist)
do { do {
timeout--; timeout--;
if (DECL_NAME (x) == NULL_TREE if (DECL_NAME (x) == NULL_TREE
&& (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE && RECORD_OR_UNION_TYPE_P (TREE_TYPE (x)))
|| TREE_CODE (TREE_TYPE (x)) == UNION_TYPE))
timeout = 0; timeout = 0;
x = DECL_CHAIN (x); x = DECL_CHAIN (x);
} while (timeout > 0 && x); } while (timeout > 0 && x);
...@@ -7473,8 +7466,7 @@ detect_field_duplicates (tree fieldlist) ...@@ -7473,8 +7466,7 @@ detect_field_duplicates (tree fieldlist)
if (DECL_NAME (x) if (DECL_NAME (x)
|| (flag_plan9_extensions || (flag_plan9_extensions
&& DECL_NAME (x) == NULL_TREE && DECL_NAME (x) == NULL_TREE
&& (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE && RECORD_OR_UNION_TYPE_P (TREE_TYPE (x))
|| TREE_CODE (TREE_TYPE (x)) == UNION_TYPE)
&& TYPE_NAME (TREE_TYPE (x)) != NULL_TREE && TYPE_NAME (TREE_TYPE (x)) != NULL_TREE
&& TREE_CODE (TYPE_NAME (TREE_TYPE (x))) == TYPE_DECL)) && TREE_CODE (TYPE_NAME (TREE_TYPE (x))) == TYPE_DECL))
{ {
...@@ -7587,9 +7579,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, ...@@ -7587,9 +7579,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
{ {
if (DECL_NAME (x) != 0) if (DECL_NAME (x) != 0)
break; break;
if (flag_isoc11 if (flag_isoc11 && RECORD_OR_UNION_TYPE_P (TREE_TYPE (x)))
&& (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (x)) == UNION_TYPE))
break; break;
} }
...@@ -7634,8 +7624,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, ...@@ -7634,8 +7624,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
{ {
/* A field that is pseudo-const makes the structure likewise. */ /* A field that is pseudo-const makes the structure likewise. */
tree t1 = strip_array_types (TREE_TYPE (x)); tree t1 = strip_array_types (TREE_TYPE (x));
if ((TREE_CODE (t1) == RECORD_TYPE || TREE_CODE (t1) == UNION_TYPE) if (RECORD_OR_UNION_TYPE_P (t1) && C_TYPE_FIELDS_READONLY (t1))
&& C_TYPE_FIELDS_READONLY (t1))
C_TYPE_FIELDS_READONLY (t) = 1; C_TYPE_FIELDS_READONLY (t) = 1;
} }
...@@ -7693,8 +7682,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, ...@@ -7693,8 +7682,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
"invalid use of structure with flexible array member"); "invalid use of structure with flexible array member");
if (DECL_NAME (x) if (DECL_NAME (x)
|| TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE || RECORD_OR_UNION_TYPE_P (TREE_TYPE (x)))
|| TREE_CODE (TREE_TYPE (x)) == UNION_TYPE)
saw_named_field = 1; saw_named_field = 1;
} }
......
...@@ -2166,8 +2166,7 @@ lookup_field (tree type, tree component) ...@@ -2166,8 +2166,7 @@ lookup_field (tree type, tree component)
while (DECL_NAME (field_array[bot]) == NULL_TREE) while (DECL_NAME (field_array[bot]) == NULL_TREE)
{ {
field = field_array[bot++]; field = field_array[bot++];
if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)))
|| TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
{ {
tree anon = lookup_field (TREE_TYPE (field), component); tree anon = lookup_field (TREE_TYPE (field), component);
...@@ -2213,8 +2212,7 @@ lookup_field (tree type, tree component) ...@@ -2213,8 +2212,7 @@ lookup_field (tree type, tree component)
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
{ {
if (DECL_NAME (field) == NULL_TREE if (DECL_NAME (field) == NULL_TREE
&& (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)))
|| TREE_CODE (TREE_TYPE (field)) == UNION_TYPE))
{ {
tree anon = lookup_field (TREE_TYPE (field), component); tree anon = lookup_field (TREE_TYPE (field), component);
...@@ -2253,13 +2251,9 @@ lookup_field_fuzzy_find_candidates (tree type, tree component, ...@@ -2253,13 +2251,9 @@ lookup_field_fuzzy_find_candidates (tree type, tree component,
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
{ {
if (DECL_NAME (field) == NULL_TREE if (DECL_NAME (field) == NULL_TREE
&& (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)))
|| TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)) lookup_field_fuzzy_find_candidates (TREE_TYPE (field), component,
{ candidates);
lookup_field_fuzzy_find_candidates (TREE_TYPE (field),
component,
candidates);
}
if (DECL_NAME (field)) if (DECL_NAME (field))
candidates->safe_push (DECL_NAME (field)); candidates->safe_push (DECL_NAME (field));
...@@ -5131,8 +5125,7 @@ build_c_cast (location_t loc, tree type, tree expr) ...@@ -5131,8 +5125,7 @@ build_c_cast (location_t loc, tree type, tree expr)
if (type == TYPE_MAIN_VARIANT (TREE_TYPE (value))) if (type == TYPE_MAIN_VARIANT (TREE_TYPE (value)))
{ {
if (TREE_CODE (type) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (type))
|| TREE_CODE (type) == UNION_TYPE)
pedwarn (loc, OPT_Wpedantic, pedwarn (loc, OPT_Wpedantic,
"ISO C forbids casting nonscalar to the same type"); "ISO C forbids casting nonscalar to the same type");
...@@ -5224,8 +5217,7 @@ build_c_cast (location_t loc, tree type, tree expr) ...@@ -5224,8 +5217,7 @@ build_c_cast (location_t loc, tree type, tree expr)
&& TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
/* Don't warn about opaque types, where the actual alignment /* Don't warn about opaque types, where the actual alignment
restriction is unknown. */ restriction is unknown. */
&& !((TREE_CODE (TREE_TYPE (otype)) == UNION_TYPE && !(RECORD_OR_UNION_TYPE_P (TREE_TYPE (otype))
|| TREE_CODE (TREE_TYPE (otype)) == RECORD_TYPE)
&& TYPE_MODE (TREE_TYPE (otype)) == VOIDmode) && TYPE_MODE (TREE_TYPE (otype)) == VOIDmode)
&& TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype))) && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
warning_at (loc, OPT_Wcast_align, warning_at (loc, OPT_Wcast_align,
...@@ -5484,8 +5476,7 @@ build_modify_expr (location_t location, tree lhs, tree lhs_origtype, ...@@ -5484,8 +5476,7 @@ build_modify_expr (location_t location, tree lhs, tree lhs_origtype,
/* Give an error for storing in something that is 'const'. */ /* Give an error for storing in something that is 'const'. */
if (TYPE_READONLY (lhstype) if (TYPE_READONLY (lhstype)
|| ((TREE_CODE (lhstype) == RECORD_TYPE || (RECORD_OR_UNION_TYPE_P (lhstype)
|| TREE_CODE (lhstype) == UNION_TYPE)
&& C_TYPE_FIELDS_READONLY (lhstype))) && C_TYPE_FIELDS_READONLY (lhstype)))
{ {
readonly_error (location, lhs, lv_assign); readonly_error (location, lhs, lv_assign);
...@@ -5611,8 +5602,7 @@ find_anonymous_field_with_type (tree struct_type, tree type) ...@@ -5611,8 +5602,7 @@ find_anonymous_field_with_type (tree struct_type, tree type)
tree field; tree field;
bool found; bool found;
gcc_assert (TREE_CODE (struct_type) == RECORD_TYPE gcc_assert (RECORD_OR_UNION_TYPE_P (struct_type));
|| TREE_CODE (struct_type) == UNION_TYPE);
found = false; found = false;
for (field = TYPE_FIELDS (struct_type); for (field = TYPE_FIELDS (struct_type);
field != NULL_TREE; field != NULL_TREE;
...@@ -5630,8 +5620,7 @@ find_anonymous_field_with_type (tree struct_type, tree type) ...@@ -5630,8 +5620,7 @@ find_anonymous_field_with_type (tree struct_type, tree type)
found = true; found = true;
} }
else if (DECL_NAME (field) == NULL else if (DECL_NAME (field) == NULL
&& (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))
|| TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
&& find_anonymous_field_with_type (TREE_TYPE (field), type)) && find_anonymous_field_with_type (TREE_TYPE (field), type))
{ {
if (found) if (found)
...@@ -5657,8 +5646,7 @@ convert_to_anonymous_field (location_t location, tree type, tree rhs) ...@@ -5657,8 +5646,7 @@ convert_to_anonymous_field (location_t location, tree type, tree rhs)
gcc_assert (POINTER_TYPE_P (TREE_TYPE (rhs))); gcc_assert (POINTER_TYPE_P (TREE_TYPE (rhs)));
rhs_struct_type = TREE_TYPE (TREE_TYPE (rhs)); rhs_struct_type = TREE_TYPE (TREE_TYPE (rhs));
gcc_assert (TREE_CODE (rhs_struct_type) == RECORD_TYPE gcc_assert (RECORD_OR_UNION_TYPE_P (rhs_struct_type));
|| TREE_CODE (rhs_struct_type) == UNION_TYPE);
gcc_assert (POINTER_TYPE_P (type)); gcc_assert (POINTER_TYPE_P (type));
lhs_main_type = (TYPE_ATOMIC (TREE_TYPE (type)) lhs_main_type = (TYPE_ATOMIC (TREE_TYPE (type))
...@@ -5673,8 +5661,7 @@ convert_to_anonymous_field (location_t location, tree type, tree rhs) ...@@ -5673,8 +5661,7 @@ convert_to_anonymous_field (location_t location, tree type, tree rhs)
field = TREE_CHAIN (field)) field = TREE_CHAIN (field))
{ {
if (DECL_NAME (field) != NULL_TREE if (DECL_NAME (field) != NULL_TREE
|| (TREE_CODE (TREE_TYPE (field)) != RECORD_TYPE || !RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)))
&& TREE_CODE (TREE_TYPE (field)) != UNION_TYPE))
continue; continue;
tree fieldtype = (TYPE_ATOMIC (TREE_TYPE (field)) tree fieldtype = (TYPE_ATOMIC (TREE_TYPE (field))
? c_build_qualified_type (TREE_TYPE (field), ? c_build_qualified_type (TREE_TYPE (field),
...@@ -6211,8 +6198,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, ...@@ -6211,8 +6198,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
automatically converted into a pointer to an anonymous field automatically converted into a pointer to an anonymous field
within the struct. */ within the struct. */
if (flag_plan9_extensions if (flag_plan9_extensions
&& (TREE_CODE (mvl) == RECORD_TYPE || TREE_CODE(mvl) == UNION_TYPE) && RECORD_OR_UNION_TYPE_P (mvl)
&& (TREE_CODE (mvr) == RECORD_TYPE || TREE_CODE(mvr) == UNION_TYPE) && RECORD_OR_UNION_TYPE_P (mvr)
&& mvl != mvr) && mvl != mvr)
{ {
tree new_rhs = convert_to_anonymous_field (location, type, rhs); tree new_rhs = convert_to_anonymous_field (location, type, rhs);
...@@ -7367,8 +7354,7 @@ really_start_incremental_init (tree type) ...@@ -7367,8 +7354,7 @@ really_start_incremental_init (tree type)
designator_depth = 0; designator_depth = 0;
designator_erroneous = 0; designator_erroneous = 0;
if (TREE_CODE (constructor_type) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (constructor_type))
|| TREE_CODE (constructor_type) == UNION_TYPE)
{ {
constructor_fields = TYPE_FIELDS (constructor_type); constructor_fields = TYPE_FIELDS (constructor_type);
/* Skip any nameless bit fields at the beginning. */ /* Skip any nameless bit fields at the beginning. */
...@@ -7448,8 +7434,7 @@ push_init_level (location_t loc, int implicit, ...@@ -7448,8 +7434,7 @@ push_init_level (location_t loc, int implicit,
{ {
while (constructor_stack->implicit) while (constructor_stack->implicit)
{ {
if ((TREE_CODE (constructor_type) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (constructor_type)
|| TREE_CODE (constructor_type) == UNION_TYPE)
&& constructor_fields == 0) && constructor_fields == 0)
process_init_element (input_location, process_init_element (input_location,
pop_init_level (loc, 1, braced_init_obstack), pop_init_level (loc, 1, braced_init_obstack),
...@@ -7470,9 +7455,7 @@ push_init_level (location_t loc, int implicit, ...@@ -7470,9 +7455,7 @@ push_init_level (location_t loc, int implicit,
content if any. */ content if any. */
if (implicit) if (implicit)
{ {
if ((TREE_CODE (constructor_type) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (constructor_type) && constructor_fields)
|| TREE_CODE (constructor_type) == UNION_TYPE)
&& constructor_fields)
value = find_init_member (constructor_fields, braced_init_obstack); value = find_init_member (constructor_fields, braced_init_obstack);
else if (TREE_CODE (constructor_type) == ARRAY_TYPE) else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
value = find_init_member (constructor_index, braced_init_obstack); value = find_init_member (constructor_index, braced_init_obstack);
...@@ -7525,8 +7508,7 @@ push_init_level (location_t loc, int implicit, ...@@ -7525,8 +7508,7 @@ push_init_level (location_t loc, int implicit,
in the containing level. */ in the containing level. */
if (constructor_type == 0) if (constructor_type == 0)
; ;
else if (TREE_CODE (constructor_type) == RECORD_TYPE else if (RECORD_OR_UNION_TYPE_P (constructor_type))
|| TREE_CODE (constructor_type) == UNION_TYPE)
{ {
/* Don't die if there are extra init elts at the end. */ /* Don't die if there are extra init elts at the end. */
if (constructor_fields == 0) if (constructor_fields == 0)
...@@ -7571,8 +7553,7 @@ push_init_level (location_t loc, int implicit, ...@@ -7571,8 +7553,7 @@ push_init_level (location_t loc, int implicit,
if (implicit == 1) if (implicit == 1)
found_missing_braces = 1; found_missing_braces = 1;
if (TREE_CODE (constructor_type) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (constructor_type))
|| TREE_CODE (constructor_type) == UNION_TYPE)
{ {
constructor_fields = TYPE_FIELDS (constructor_type); constructor_fields = TYPE_FIELDS (constructor_type);
/* Skip any nameless bit fields at the beginning. */ /* Skip any nameless bit fields at the beginning. */
...@@ -7760,8 +7741,7 @@ pop_init_level (location_t loc, int implicit, ...@@ -7760,8 +7741,7 @@ pop_init_level (location_t loc, int implicit,
ret = p->replacement_value; ret = p->replacement_value;
else if (constructor_type == 0) else if (constructor_type == 0)
; ;
else if (TREE_CODE (constructor_type) != RECORD_TYPE else if (!RECORD_OR_UNION_TYPE_P (constructor_type)
&& TREE_CODE (constructor_type) != UNION_TYPE
&& TREE_CODE (constructor_type) != ARRAY_TYPE && TREE_CODE (constructor_type) != ARRAY_TYPE
&& !VECTOR_TYPE_P (constructor_type)) && !VECTOR_TYPE_P (constructor_type))
{ {
...@@ -8028,8 +8008,7 @@ set_init_label (location_t loc, tree fieldname, ...@@ -8028,8 +8008,7 @@ set_init_label (location_t loc, tree fieldname,
designator_erroneous = 1; designator_erroneous = 1;
if (TREE_CODE (constructor_type) != RECORD_TYPE if (!RECORD_OR_UNION_TYPE_P (constructor_type))
&& TREE_CODE (constructor_type) != UNION_TYPE)
{ {
error_init (loc, "field name not in record or union initializer"); error_init (loc, "field name not in record or union initializer");
return; return;
...@@ -8544,8 +8523,7 @@ output_init_element (location_t loc, tree value, tree origtype, ...@@ -8544,8 +8523,7 @@ output_init_element (location_t loc, tree value, tree origtype,
AGGREGATE_TYPE_P (constructor_type) AGGREGATE_TYPE_P (constructor_type)
&& TYPE_REVERSE_STORAGE_ORDER && TYPE_REVERSE_STORAGE_ORDER
(constructor_type)) (constructor_type))
|| ((TREE_CODE (constructor_type) == RECORD_TYPE || (RECORD_OR_UNION_TYPE_P (constructor_type)
|| TREE_CODE (constructor_type) == UNION_TYPE)
&& DECL_C_BIT_FIELD (field) && DECL_C_BIT_FIELD (field)
&& TREE_CODE (value) != INTEGER_CST)) && TREE_CODE (value) != INTEGER_CST))
constructor_simple = 0; constructor_simple = 0;
...@@ -8766,8 +8744,7 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack) ...@@ -8766,8 +8744,7 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack)
} }
} }
} }
else if (TREE_CODE (constructor_type) == RECORD_TYPE else if (RECORD_OR_UNION_TYPE_P (constructor_type))
|| TREE_CODE (constructor_type) == UNION_TYPE)
{ {
tree ctor_unfilled_bitpos, elt_bitpos; tree ctor_unfilled_bitpos, elt_bitpos;
...@@ -8831,8 +8808,7 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack) ...@@ -8831,8 +8808,7 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack)
/* If it's not incremental, just skip over the gap, so that after /* If it's not incremental, just skip over the gap, so that after
jumping to retry we will output the next successive element. */ jumping to retry we will output the next successive element. */
if (TREE_CODE (constructor_type) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (constructor_type))
|| TREE_CODE (constructor_type) == UNION_TYPE)
constructor_unfilled_fields = next; constructor_unfilled_fields = next;
else if (TREE_CODE (constructor_type) == ARRAY_TYPE) else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
constructor_unfilled_index = next; constructor_unfilled_index = next;
...@@ -8909,8 +8885,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, ...@@ -8909,8 +8885,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
pop them now. */ pop them now. */
while (constructor_stack->implicit) while (constructor_stack->implicit)
{ {
if ((TREE_CODE (constructor_type) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (constructor_type)
|| TREE_CODE (constructor_type) == UNION_TYPE)
&& constructor_fields == 0) && constructor_fields == 0)
process_init_element (loc, process_init_element (loc,
pop_init_level (loc, 1, braced_init_obstack), pop_init_level (loc, 1, braced_init_obstack),
...@@ -9357,8 +9332,7 @@ build_asm_expr (location_t loc, tree string, tree outputs, tree inputs, ...@@ -9357,8 +9332,7 @@ build_asm_expr (location_t loc, tree string, tree outputs, tree inputs,
if (output != error_mark_node if (output != error_mark_node
&& (TREE_READONLY (output) && (TREE_READONLY (output)
|| TYPE_READONLY (TREE_TYPE (output)) || TYPE_READONLY (TREE_TYPE (output))
|| ((TREE_CODE (TREE_TYPE (output)) == RECORD_TYPE || (RECORD_OR_UNION_TYPE_P (TREE_TYPE (output))
|| TREE_CODE (TREE_TYPE (output)) == UNION_TYPE)
&& C_TYPE_FIELDS_READONLY (TREE_TYPE (output))))) && C_TYPE_FIELDS_READONLY (TREE_TYPE (output)))))
readonly_error (loc, output, lv_asm); readonly_error (loc, output, lv_asm);
...@@ -13376,8 +13350,7 @@ c_build_qualified_type (tree type, int type_quals) ...@@ -13376,8 +13350,7 @@ c_build_qualified_type (tree type, int type_quals)
tree var_type = build_qualified_type (type, type_quals); tree var_type = build_qualified_type (type, type_quals);
/* A variant type does not inherit the list of incomplete vars from the /* A variant type does not inherit the list of incomplete vars from the
type main variant. */ type main variant. */
if (TREE_CODE (var_type) == RECORD_TYPE if (RECORD_OR_UNION_TYPE_P (var_type))
|| TREE_CODE (var_type) == UNION_TYPE)
C_TYPE_INCOMPLETE_VARS (var_type) = 0; C_TYPE_INCOMPLETE_VARS (var_type) = 0;
return var_type; return var_type;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment