+2015-09-15 Marek Polacek <polacek@redhat.com>
+
+ * c-decl.c (lookup_label): Return NULL_TREE instead of 0.
+ (lookup_tag): Change the type of THISLEVEL_ONLY to bool.
+ Return NULL_TREE instead of 0.
+ (lookup_name): Return NULL_TREE instead of 0.
+ (lookup_name_in_scope): Likewise.
+ (shadow_tag_warned): Use true instead of 1 and NULL_TREE instead of 0.
+ (parser_xref_tag): Use false instead of 0.
+ (start_struct): Use true instead of 1.
+ (start_enum): Use true instead of 1 and NULL_TREE instead of 0.
+
2015-09-14 Marek Polacek <polacek@redhat.com>
* c-typeck.c (set_nonincremental_init_from_string): Use
if (current_function_scope == 0)
{
error ("label %qE referenced outside of any function", name);
- return 0;
+ return NULL_TREE;
}
/* Use a label already defined or ref'd with this name, but not if
If the wrong kind of type is found, an error is reported. */
static tree
-lookup_tag (enum tree_code code, tree name, int thislevel_only,
+lookup_tag (enum tree_code code, tree name, bool thislevel_only,
location_t *ploc)
{
struct c_binding *b = I_TAG_BINDING (name);
- int thislevel = 0;
+ bool thislevel = false;
if (!b || !b->decl)
- return 0;
+ return NULL_TREE;
/* We only care about whether it's in this level if
thislevel_only was set or it might be a type clash. */
file scope is created.) */
if (B_IN_CURRENT_SCOPE (b)
|| (current_scope == file_scope && B_IN_EXTERNAL_SCOPE (b)))
- thislevel = 1;
+ thislevel = true;
}
if (thislevel_only && !thislevel)
- return 0;
+ return NULL_TREE;
if (TREE_CODE (b->decl) != code)
{
maybe_record_typedef_use (b->decl);
return b->decl;
}
- return 0;
+ return NULL_TREE;
}
/* Similar to `lookup_name' but look only at the indicated scope. */
for (b = I_SYMBOL_BINDING (name); b; b = b->shadowed)
if (B_IN_SCOPE (b, scope))
return b->decl;
- return 0;
+ return NULL_TREE;
}
\f
/* Create the predefined scalar types of C,
else
{
pending_invalid_xref = 0;
- t = lookup_tag (code, name, 1, NULL);
+ t = lookup_tag (code, name, true, NULL);
- if (t == 0)
+ if (t == NULL_TREE)
{
t = make_node (code);
pushtag (input_location, name, t);
/* If a cross reference is requested, look up the type
already defined for this tag and return it. */
- ref = lookup_tag (code, name, 0, &refloc);
+ ref = lookup_tag (code, name, false, &refloc);
/* If this is the right type of tag, return what we found.
(This reference will be shadowed by shadow_tag later if appropriate.)
If this is the wrong type of tag, do not return it. If it was the
location_t refloc = UNKNOWN_LOCATION;
if (name != NULL_TREE)
- ref = lookup_tag (code, name, 1, &refloc);
+ ref = lookup_tag (code, name, true, &refloc);
if (ref && TREE_CODE (ref) == code)
{
if (TYPE_SIZE (ref))
forward reference. */
if (name != NULL_TREE)
- enumtype = lookup_tag (ENUMERAL_TYPE, name, 1, &enumloc);
+ enumtype = lookup_tag (ENUMERAL_TYPE, name, true, &enumloc);
- if (enumtype == 0 || TREE_CODE (enumtype) != ENUMERAL_TYPE)
+ if (enumtype == NULL_TREE || TREE_CODE (enumtype) != ENUMERAL_TYPE)
{
enumtype = make_node (ENUMERAL_TYPE);
pushtag (loc, name, enumtype);