]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-decl.c (lookup_label): Return NULL_TREE instead of 0.
authorMarek Polacek <polacek@redhat.com>
Tue, 15 Sep 2015 12:48:50 +0000 (12:48 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 15 Sep 2015 12:48:50 +0000 (12:48 +0000)
* 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.

From-SVN: r227791

gcc/c/ChangeLog
gcc/c/c-decl.c

index 289142474244db78b061a4c44e0d72f90c682ec7..37124b3f587cbab7c6e5244ad53f8b4131f54d12 100644 (file)
@@ -1,3 +1,15 @@
+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
index 5e5b6d7dfc2b61e5f98ac4ef4d16314077e50ce2..989ff993223e86774130c57bfa919d5bbe6af173 100644 (file)
@@ -3474,7 +3474,7 @@ lookup_label (tree name)
   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
@@ -3811,14 +3811,14 @@ c_check_switch_jump_warnings (struct c_spot_bindings *switch_bindings,
    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.  */
@@ -3830,11 +3830,11 @@ lookup_tag (enum tree_code code, tree name, int thislevel_only,
         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)
     {
@@ -3885,7 +3885,7 @@ lookup_name (tree name)
       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.  */
@@ -3898,7 +3898,7 @@ lookup_name_in_scope (tree name, struct c_scope *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,
@@ -4138,9 +4138,9 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned)
          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);
@@ -7082,7 +7082,7 @@ parser_xref_tag (location_t loc, enum tree_code code, tree name)
   /* 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
@@ -7186,7 +7186,7 @@ start_struct (location_t loc, enum tree_code code, tree name,
   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))
@@ -7905,9 +7905,9 @@ start_enum (location_t loc, struct c_enum_contents *the_enum, tree name)
      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);