return exp;
}
\f
-/* Look up COMPONENT in a structure or union TYPE.
+/* Look up COMPONENT in a structure or union DECL.
If the component name is not found, returns NULL_TREE. Otherwise,
the return value is a TREE_LIST, with each TREE_VALUE a FIELD_DECL
unions, the list steps down the chain to the component. */
static tree
-lookup_field (tree type, tree component)
+lookup_field (tree decl, tree component)
{
+ tree type = TREE_TYPE (decl);
tree field;
/* If TYPE_LANG_SPECIFIC is set, then it is a sorted array of pointers
if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
{
- tree anon = lookup_field (TREE_TYPE (field), component);
+ tree anon = lookup_field (field, component);
if (anon)
return tree_cons (NULL_TREE, field, anon);
&& (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
|| TREE_CODE (TREE_TYPE (field)) == UNION_TYPE))
{
- tree anon = lookup_field (TREE_TYPE (field), component);
+ tree anon = lookup_field (field, component);
if (anon)
return tree_cons (NULL_TREE, field, anon);
return error_mark_node;
}
- field = lookup_field (type, component);
+ field = lookup_field (datum, component);
if (!field)
{
void
set_init_label (tree fieldname, struct obstack * braced_init_obstack)
{
- tree field;
+ tree tail;
if (set_designator (0, braced_init_obstack))
return;
return;
}
- field = lookup_field (constructor_type, fieldname);
+ for (tail = TYPE_FIELDS (constructor_type); tail;
+ tail = TREE_CHAIN (tail))
+ {
+ if (DECL_NAME (tail) == fieldname)
+ break;
+ }
- if (field == 0)
+ if (tail == 0)
error ("unknown field %qE specified in initializer", fieldname);
else
- do
- {
- constructor_fields = TREE_VALUE (field);
- designator_depth++;
- designator_erroneous = 0;
- if (constructor_range_stack)
- push_range_stack (NULL_TREE, braced_init_obstack);
- field = TREE_CHAIN (field);
- if (field)
- {
- if (set_designator (0, braced_init_obstack))
- return;
- }
- }
- while (field != NULL_TREE);
+ {
+ constructor_fields = tail;
+ designator_depth++;
+ designator_erroneous = 0;
+ if (constructor_range_stack)
+ push_range_stack (NULL_TREE, braced_init_obstack);
+ }
}
\f
/* Add a new initializer to the tree of pending initializers. PURPOSE
else if (TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE)
pedwarn (location, OPT_pedantic, "ISO C forbids "
"ordered comparisons of pointers to functions");
- else if (null_pointer_constant_p (orig_op0)
- || null_pointer_constant_p (orig_op1))
- warning_at (location, OPT_Wextra,
- "ordered comparison of pointer with null pointer");
-
}
else if (!addr_space_superset (as0, as1, &as_common))
{
"ordered comparison of pointer with integer zero");
else if (extra_warnings)
warning_at (location, OPT_Wextra,
- "ordered comparison of pointer with integer zero");
+ "ordered comparison of pointer with integer zero");
}
else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_op0))
{
result_type = type1;
- if (pedantic)
- pedwarn (location, OPT_pedantic,
- "ordered comparison of pointer with integer zero");
- else if (extra_warnings)
- warning_at (location, OPT_Wextra,
- "ordered comparison of pointer with integer zero");
+ pedwarn (location, OPT_pedantic,
+ "ordered comparison of pointer with integer zero");
}
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{