element = TREE_TYPE (element);
element = TYPE_MAIN_VARIANT (element);
- if ((TREE_CODE (element) == RECORD_TYPE
- || TREE_CODE (element) == UNION_TYPE)
+ if (RECORD_OR_UNION_TYPE_P (element)
&& (TREE_CODE (x) != TYPE_DECL
|| TREE_CODE (TREE_TYPE (x)) == ARRAY_TYPE)
&& !COMPLETE_TYPE_P (element))
inform (DECL_SOURCE_LOCATION (field), "%qD should be initialized", field);
}
- if (TREE_CODE (field_type) == RECORD_TYPE
- || TREE_CODE (field_type) == UNION_TYPE)
+ if (RECORD_OR_UNION_TYPE_P (field_type))
diagnose_uninitialized_cst_member (decl, field_type);
}
}
if (TREE_READONLY (decl))
warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat,
"uninitialized const %qD is invalid in C++", decl);
- else if ((TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE)
+ else if (RECORD_OR_UNION_TYPE_P (type)
&& C_TYPE_FIELDS_READONLY (type))
diagnose_uninitialized_cst_member (decl, type);
}
&& VAR_P (decl)
&& TREE_PUBLIC (decl)
&& TREE_STATIC (decl)
- && (TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (decl)) == UNION_TYPE
+ && (RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl))
|| TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE)
&& TYPE_NAME (TREE_TYPE (decl)) == NULL_TREE)
warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat,
that took root before someone noticed the bug... */
tree type = declspecs->type;
- bool type_ok = (TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE);
+ bool type_ok = RECORD_OR_UNION_TYPE_P (type);
bool ok = false;
if (type_ok
xt = TREE_TYPE (x);
if (DECL_NAME (x) != NULL_TREE)
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
&& TREE_CODE (TYPE_NAME (xt)) == TYPE_DECL)
xn = DECL_NAME (TYPE_NAME (xt));
yt = TREE_TYPE (y);
if (DECL_NAME (y) != NULL_TREE)
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
&& TREE_CODE (TYPE_NAME (yt)) == TYPE_DECL)
yn = DECL_NAME (TYPE_NAME (yt));
}
*slot = y;
}
- else if (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE)
+ else if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (x)))
{
detect_field_duplicates_hash (TYPE_FIELDS (TREE_TYPE (x)), htab);
do {
timeout--;
if (DECL_NAME (x) == NULL_TREE
- && (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE))
+ && RECORD_OR_UNION_TYPE_P (TREE_TYPE (x)))
timeout = 0;
x = DECL_CHAIN (x);
} while (timeout > 0 && x);
if (DECL_NAME (x)
|| (flag_plan9_extensions
&& DECL_NAME (x) == NULL_TREE
- && (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE)
+ && RECORD_OR_UNION_TYPE_P (TREE_TYPE (x))
&& TYPE_NAME (TREE_TYPE (x)) != NULL_TREE
&& TREE_CODE (TYPE_NAME (TREE_TYPE (x))) == TYPE_DECL))
{
{
if (DECL_NAME (x) != 0)
break;
- if (flag_isoc11
- && (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE))
+ if (flag_isoc11 && RECORD_OR_UNION_TYPE_P (TREE_TYPE (x)))
break;
}
{
/* A field that is pseudo-const makes the structure likewise. */
tree t1 = strip_array_types (TREE_TYPE (x));
- if ((TREE_CODE (t1) == RECORD_TYPE || TREE_CODE (t1) == UNION_TYPE)
- && C_TYPE_FIELDS_READONLY (t1))
+ if (RECORD_OR_UNION_TYPE_P (t1) && C_TYPE_FIELDS_READONLY (t1))
C_TYPE_FIELDS_READONLY (t) = 1;
}
"invalid use of structure with flexible array member");
if (DECL_NAME (x)
- || TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE)
+ || RECORD_OR_UNION_TYPE_P (TREE_TYPE (x)))
saw_named_field = 1;
}
while (DECL_NAME (field_array[bot]) == NULL_TREE)
{
field = field_array[bot++];
- if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)))
{
tree anon = lookup_field (TREE_TYPE (field), component);
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
{
if (DECL_NAME (field) == NULL_TREE
- && (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE))
+ && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)))
{
tree anon = lookup_field (TREE_TYPE (field), component);
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
{
if (DECL_NAME (field) == NULL_TREE
- && (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE))
- {
- lookup_field_fuzzy_find_candidates (TREE_TYPE (field),
- component,
- candidates);
- }
+ && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)))
+ lookup_field_fuzzy_find_candidates (TREE_TYPE (field), component,
+ candidates);
if (DECL_NAME (field))
candidates->safe_push (DECL_NAME (field));
if (type == TYPE_MAIN_VARIANT (TREE_TYPE (value)))
{
- if (TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE)
+ if (RECORD_OR_UNION_TYPE_P (type))
pedwarn (loc, OPT_Wpedantic,
"ISO C forbids casting nonscalar to the same type");
&& TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
/* Don't warn about opaque types, where the actual alignment
restriction is unknown. */
- && !((TREE_CODE (TREE_TYPE (otype)) == UNION_TYPE
- || TREE_CODE (TREE_TYPE (otype)) == RECORD_TYPE)
+ && !(RECORD_OR_UNION_TYPE_P (TREE_TYPE (otype))
&& TYPE_MODE (TREE_TYPE (otype)) == VOIDmode)
&& TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
warning_at (loc, OPT_Wcast_align,
/* Give an error for storing in something that is 'const'. */
if (TYPE_READONLY (lhstype)
- || ((TREE_CODE (lhstype) == RECORD_TYPE
- || TREE_CODE (lhstype) == UNION_TYPE)
+ || (RECORD_OR_UNION_TYPE_P (lhstype)
&& C_TYPE_FIELDS_READONLY (lhstype)))
{
readonly_error (location, lhs, lv_assign);
tree field;
bool found;
- gcc_assert (TREE_CODE (struct_type) == RECORD_TYPE
- || TREE_CODE (struct_type) == UNION_TYPE);
+ gcc_assert (RECORD_OR_UNION_TYPE_P (struct_type));
found = false;
for (field = TYPE_FIELDS (struct_type);
field != NULL_TREE;
found = true;
}
else if (DECL_NAME (field) == NULL
- && (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))
&& find_anonymous_field_with_type (TREE_TYPE (field), type))
{
if (found)
gcc_assert (POINTER_TYPE_P (TREE_TYPE (rhs)));
rhs_struct_type = TREE_TYPE (TREE_TYPE (rhs));
- gcc_assert (TREE_CODE (rhs_struct_type) == RECORD_TYPE
- || TREE_CODE (rhs_struct_type) == UNION_TYPE);
+ gcc_assert (RECORD_OR_UNION_TYPE_P (rhs_struct_type));
gcc_assert (POINTER_TYPE_P (type));
lhs_main_type = (TYPE_ATOMIC (TREE_TYPE (type))
field = TREE_CHAIN (field))
{
if (DECL_NAME (field) != NULL_TREE
- || (TREE_CODE (TREE_TYPE (field)) != RECORD_TYPE
- && TREE_CODE (TREE_TYPE (field)) != UNION_TYPE))
+ || !RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)))
continue;
tree fieldtype = (TYPE_ATOMIC (TREE_TYPE (field))
? c_build_qualified_type (TREE_TYPE (field),
automatically converted into a pointer to an anonymous field
within the struct. */
if (flag_plan9_extensions
- && (TREE_CODE (mvl) == RECORD_TYPE || TREE_CODE(mvl) == UNION_TYPE)
- && (TREE_CODE (mvr) == RECORD_TYPE || TREE_CODE(mvr) == UNION_TYPE)
+ && RECORD_OR_UNION_TYPE_P (mvl)
+ && RECORD_OR_UNION_TYPE_P (mvr)
&& mvl != mvr)
{
tree new_rhs = convert_to_anonymous_field (location, type, rhs);
designator_depth = 0;
designator_erroneous = 0;
- if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
+ if (RECORD_OR_UNION_TYPE_P (constructor_type))
{
constructor_fields = TYPE_FIELDS (constructor_type);
/* Skip any nameless bit fields at the beginning. */
{
while (constructor_stack->implicit)
{
- if ((TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
+ if (RECORD_OR_UNION_TYPE_P (constructor_type)
&& constructor_fields == 0)
process_init_element (input_location,
pop_init_level (loc, 1, braced_init_obstack),
content if any. */
if (implicit)
{
- if ((TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- && constructor_fields)
+ if (RECORD_OR_UNION_TYPE_P (constructor_type) && constructor_fields)
value = find_init_member (constructor_fields, braced_init_obstack);
else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
value = find_init_member (constructor_index, braced_init_obstack);
in the containing level. */
if (constructor_type == 0)
;
- else if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
+ else if (RECORD_OR_UNION_TYPE_P (constructor_type))
{
/* Don't die if there are extra init elts at the end. */
if (constructor_fields == 0)
if (implicit == 1)
found_missing_braces = 1;
- if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
+ if (RECORD_OR_UNION_TYPE_P (constructor_type))
{
constructor_fields = TYPE_FIELDS (constructor_type);
/* Skip any nameless bit fields at the beginning. */
ret = p->replacement_value;
else if (constructor_type == 0)
;
- else if (TREE_CODE (constructor_type) != RECORD_TYPE
- && TREE_CODE (constructor_type) != UNION_TYPE
+ else if (!RECORD_OR_UNION_TYPE_P (constructor_type)
&& TREE_CODE (constructor_type) != ARRAY_TYPE
&& !VECTOR_TYPE_P (constructor_type))
{
designator_erroneous = 1;
- if (TREE_CODE (constructor_type) != RECORD_TYPE
- && TREE_CODE (constructor_type) != UNION_TYPE)
+ if (!RECORD_OR_UNION_TYPE_P (constructor_type))
{
error_init (loc, "field name not in record or union initializer");
return;
AGGREGATE_TYPE_P (constructor_type)
&& TYPE_REVERSE_STORAGE_ORDER
(constructor_type))
- || ((TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
+ || (RECORD_OR_UNION_TYPE_P (constructor_type)
&& DECL_C_BIT_FIELD (field)
&& TREE_CODE (value) != INTEGER_CST))
constructor_simple = 0;
}
}
}
- else if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
+ else if (RECORD_OR_UNION_TYPE_P (constructor_type))
{
tree ctor_unfilled_bitpos, elt_bitpos;
/* If it's not incremental, just skip over the gap, so that after
jumping to retry we will output the next successive element. */
- if (TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
+ if (RECORD_OR_UNION_TYPE_P (constructor_type))
constructor_unfilled_fields = next;
else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
constructor_unfilled_index = next;
pop them now. */
while (constructor_stack->implicit)
{
- if ((TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
+ if (RECORD_OR_UNION_TYPE_P (constructor_type)
&& constructor_fields == 0)
process_init_element (loc,
pop_init_level (loc, 1, braced_init_obstack),
if (output != error_mark_node
&& (TREE_READONLY (output)
|| TYPE_READONLY (TREE_TYPE (output))
- || ((TREE_CODE (TREE_TYPE (output)) == RECORD_TYPE
- || TREE_CODE (TREE_TYPE (output)) == UNION_TYPE)
+ || (RECORD_OR_UNION_TYPE_P (TREE_TYPE (output))
&& C_TYPE_FIELDS_READONLY (TREE_TYPE (output)))))
readonly_error (loc, output, lv_asm);
tree var_type = build_qualified_type (type, type_quals);
/* A variant type does not inherit the list of incomplete vars from the
type main variant. */
- if (TREE_CODE (var_type) == RECORD_TYPE
- || TREE_CODE (var_type) == UNION_TYPE)
+ if (RECORD_OR_UNION_TYPE_P (var_type))
C_TYPE_INCOMPLETE_VARS (var_type) = 0;
return var_type;
}