array-notation-common.c: Use VAR_P throughout.
authorMarek Polacek <polacek@redhat.com>
Thu, 25 Jun 2015 16:38:31 +0000 (16:38 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 25 Jun 2015 16:38:31 +0000 (16:38 +0000)
* array-notation-common.c: Use VAR_P throughout.
* c-ada-spec.c: Likewise.
* c-common.c: Likewise.
* c-format.c: Likewise.
* c-gimplify.c: Likewise.
* c-omp.c: Likewise.
* c-pragma.c: Likewise.
* c-pretty-print.c: Likewise.
* cilk.c: Likewise.

* c-array-notation.c: Use VAR_P throughout.
* c-decl.c: Likewise.
* c-objc-common.c: Likewise.
* c-parser.c: Likewise.
* c-typeck.c: Likewise.

From-SVN: r224949

16 files changed:
gcc/c-family/ChangeLog
gcc/c-family/array-notation-common.c
gcc/c-family/c-ada-spec.c
gcc/c-family/c-common.c
gcc/c-family/c-format.c
gcc/c-family/c-gimplify.c
gcc/c-family/c-omp.c
gcc/c-family/c-pragma.c
gcc/c-family/c-pretty-print.c
gcc/c-family/cilk.c
gcc/c/ChangeLog
gcc/c/c-array-notation.c
gcc/c/c-decl.c
gcc/c/c-objc-common.c
gcc/c/c-parser.c
gcc/c/c-typeck.c

index ecfb52c..e2a2d76 100644 (file)
@@ -1,5 +1,17 @@
 2015-06-25  Marek Polacek  <polacek@redhat.com>
 
+       * array-notation-common.c: Use VAR_P throughout.
+       * c-ada-spec.c: Likewise.
+       * c-common.c: Likewise.
+       * c-format.c: Likewise.
+       * c-gimplify.c: Likewise.
+       * c-omp.c: Likewise.
+       * c-pragma.c: Likewise.
+       * c-pretty-print.c: Likewise.
+       * cilk.c: Likewise.
+
+2015-06-25  Marek Polacek  <polacek@redhat.com>
+
        * cilk.c (extract_free_variables): Use is_global_var.
 
 2015-06-23  Richard Sandiford  <richard.sandiford@arm.com>
index d60ec3f..f517424 100644 (file)
@@ -231,7 +231,7 @@ find_rank (location_t loc, tree orig_expr, tree expr, bool ignore_builtin_fn,
                   || TREE_CODE (ii_tree) == INDIRECT_REF)
            ii_tree = TREE_OPERAND (ii_tree, 0);
          else if (TREE_CODE (ii_tree) == PARM_DECL
-                  || TREE_CODE (ii_tree) == VAR_DECL)
+                  || VAR_P (ii_tree))
            break;
          else
            gcc_unreachable ();
index ab29f86..ef3c5e3 100644 (file)
@@ -2826,7 +2826,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
     }
   else
     {
-      if (TREE_CODE (t) == VAR_DECL
+      if (VAR_P (t)
          && decl_name
          && *IDENTIFIER_POINTER (decl_name) == '_')
        return 0;
index dee6550..5ceee5f 100644 (file)
@@ -1620,7 +1620,7 @@ decl_constant_value_for_optimization (tree exp)
     gcc_unreachable ();
 
   if (!optimize
-      || TREE_CODE (exp) != VAR_DECL
+      || !VAR_P (exp)
       || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
       || DECL_MODE (exp) == BLKmode)
     return exp;
@@ -6952,7 +6952,7 @@ handle_nocommon_attribute (tree *node, tree name,
                           tree ARG_UNUSED (args),
                           int ARG_UNUSED (flags), bool *no_add_attrs)
 {
-  if (TREE_CODE (*node) == VAR_DECL)
+  if (VAR_P (*node))
     DECL_COMMON (*node) = 0;
   else
     {
@@ -6970,7 +6970,7 @@ static tree
 handle_common_attribute (tree *node, tree name, tree ARG_UNUSED (args),
                         int ARG_UNUSED (flags), bool *no_add_attrs)
 {
-  if (TREE_CODE (*node) == VAR_DECL)
+  if (VAR_P (*node))
     DECL_COMMON (*node) = 1;
   else
     {
@@ -7349,12 +7349,12 @@ handle_used_attribute (tree *pnode, tree name, tree ARG_UNUSED (args),
   tree node = *pnode;
 
   if (TREE_CODE (node) == FUNCTION_DECL
-      || (TREE_CODE (node) == VAR_DECL && TREE_STATIC (node))
+      || (VAR_P (node) && TREE_STATIC (node))
       || (TREE_CODE (node) == TYPE_DECL))
     {
       TREE_USED (node) = 1;
       DECL_PRESERVE_P (node) = 1;
-      if (TREE_CODE (node) == VAR_DECL)
+      if (VAR_P (node))
        DECL_READ_P (node) = 1;
     }
   else
@@ -7378,14 +7378,13 @@ handle_unused_attribute (tree *node, tree name, tree ARG_UNUSED (args),
       tree decl = *node;
 
       if (TREE_CODE (decl) == PARM_DECL
-         || TREE_CODE (decl) == VAR_DECL
+         || VAR_P (decl)
          || TREE_CODE (decl) == FUNCTION_DECL
          || TREE_CODE (decl) == LABEL_DECL
          || TREE_CODE (decl) == TYPE_DECL)
        {
          TREE_USED (decl) = 1;
-         if (TREE_CODE (decl) == VAR_DECL
-             || TREE_CODE (decl) == PARM_DECL)
+         if (VAR_P (decl) || TREE_CODE (decl) == PARM_DECL)
            DECL_READ_P (decl) = 1;
        }
       else
@@ -7914,7 +7913,7 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
       goto fail;
     }
 
-  if (TREE_CODE (decl) == VAR_DECL
+  if (VAR_P (decl)
       && current_function_decl != NULL_TREE
       && !TREE_STATIC (decl))
     {
@@ -7933,7 +7932,7 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
       goto fail;
     }
 
-  if (TREE_CODE (decl) == VAR_DECL
+  if (VAR_P (decl)
       && !targetm.have_tls && targetm.emutls.tmpl_section
       && DECL_THREAD_LOCAL_P (decl))
     {
@@ -8224,7 +8223,7 @@ handle_alias_ifunc_attribute (bool is_alias, tree *node, tree name, tree args,
   tree decl = *node;
 
   if (TREE_CODE (decl) != FUNCTION_DECL
-      && (!is_alias || TREE_CODE (decl) != VAR_DECL))
+      && (!is_alias || !VAR_P (decl)))
     {
       warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
@@ -8519,7 +8518,7 @@ c_determine_visibility (tree decl)
          DECL_VISIBILITY_SPECIFIED (decl) = visibility_options.inpragma;
          /* If visibility changed and DECL already has DECL_RTL, ensure
             symbol flags are updated.  */
-         if (((TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
+         if (((VAR_P (decl) && TREE_STATIC (decl))
               || TREE_CODE (decl) == FUNCTION_DECL)
              && DECL_RTL_SET_P (decl))
            make_decl_rtl (decl);
@@ -8541,7 +8540,7 @@ handle_tls_model_attribute (tree *node, tree name, tree args,
 
   *no_add_attrs = true;
 
-  if (TREE_CODE (decl) != VAR_DECL || !DECL_THREAD_LOCAL_P (decl))
+  if (!VAR_P (decl) || !DECL_THREAD_LOCAL_P (decl))
     {
       warning (OPT_Wattributes, "%qE attribute ignored", name);
       return NULL_TREE;
@@ -9507,7 +9506,7 @@ handle_cleanup_attribute (tree *node, tree name, tree args,
      for global destructors in C++.  This requires infrastructure that
      we don't have generically at the moment.  It's also not a feature
      we'd be missing too much, since we do have attribute constructor.  */
-  if (TREE_CODE (decl) != VAR_DECL || TREE_STATIC (decl))
+  if (!VAR_P (decl) || TREE_STATIC (decl))
     {
       warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
@@ -10492,7 +10491,7 @@ fold_offsetof_1 (tree expr)
     case COMPOUND_EXPR:
       /* Handle static members of volatile structs.  */
       t = TREE_OPERAND (expr, 1);
-      gcc_assert (TREE_CODE (t) == VAR_DECL);
+      gcc_assert (VAR_P (t));
       return fold_offsetof_1 (t);
 
     default:
@@ -10555,7 +10554,7 @@ readonly_error (location_t loc, tree arg, enum lvalue_use use)
                                     G_("read-only member %qD used as %<asm%> output")),
                  TREE_OPERAND (arg, 1));
     }
-  else if (TREE_CODE (arg) == VAR_DECL)
+  else if (VAR_P (arg))
     error_at (loc, READONLY_MSG (G_("assignment of read-only variable %qD"),
                                 G_("increment of read-only variable %qD"),
                                 G_("decrement of read-only variable %qD"),
@@ -10815,7 +10814,7 @@ c_common_mark_addressable_vec (tree t)
 {   
   while (handled_component_p (t))
     t = TREE_OPERAND (t, 0);
-  if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+  if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
     return;
   TREE_ADDRESSABLE (t) = 1;
 }
index 76dc567..c6e8f5e 100644 (file)
@@ -1514,7 +1514,7 @@ check_format_arg (void *ctx, tree format_tree,
   tree array_size = 0;
   tree array_init;
 
-  if (TREE_CODE (format_tree) == VAR_DECL)
+  if (VAR_P (format_tree))
     {
       /* Pull out a constant value if the front end didn't.  */
       format_tree = decl_constant_value (format_tree);
@@ -1618,7 +1618,7 @@ check_format_arg (void *ctx, tree format_tree,
       res->number_non_literal++;
       return;
     }
-  if (TREE_CODE (format_tree) == VAR_DECL
+  if (VAR_P (format_tree)
       && TREE_CODE (TREE_TYPE (format_tree)) == ARRAY_TYPE
       && (array_init = decl_constant_value (format_tree)) != format_tree
       && TREE_CODE (array_init) == STRING_CST)
index b646a3b..c557f66 100644 (file)
@@ -263,7 +263,7 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
       /* This is handled mostly by gimplify.c, but we have to deal with
         not warning about int x = x; as it is a GCC extension to turn off
         this warning but only if warn_init_self is zero.  */
-      if (TREE_CODE (DECL_EXPR_DECL (*expr_p)) == VAR_DECL
+      if (VAR_P (DECL_EXPR_DECL (*expr_p))
          && !DECL_EXTERNAL (DECL_EXPR_DECL (*expr_p))
          && !TREE_STATIC (DECL_EXPR_DECL (*expr_p))
          && (DECL_INITIAL (DECL_EXPR_DECL (*expr_p)) == DECL_EXPR_DECL (*expr_p))
index 289016d..d164697 100644 (file)
@@ -212,7 +212,7 @@ c_finish_omp_atomic (location_t loc, enum tree_code code,
   addr = save_expr (addr);
   if (TREE_CODE (addr) != SAVE_EXPR
       && (TREE_CODE (addr) != ADDR_EXPR
-         || TREE_CODE (TREE_OPERAND (addr, 0)) != VAR_DECL))
+         || !VAR_P (TREE_OPERAND (addr, 0))))
     {
       /* Make sure LHS is simple enough so that goa_lhs_expr_p can recognize
         it even after unsharing function body.  */
@@ -264,8 +264,8 @@ c_finish_omp_atomic (location_t loc, enum tree_code code,
   /* Generally it is hard to prove lhs1 and lhs are the same memory
      location, just diagnose different variables.  */
   if (rhs1
-      && TREE_CODE (rhs1) == VAR_DECL
-      && TREE_CODE (lhs) == VAR_DECL
+      && VAR_P (rhs1)
+      && VAR_P (lhs)
       && rhs1 != lhs)
     {
       if (code == OMP_ATOMIC)
@@ -279,7 +279,7 @@ c_finish_omp_atomic (location_t loc, enum tree_code code,
     {
       /* Generally it is hard to prove lhs1 and lhs are the same memory
         location, just diagnose different variables.  */
-      if (lhs1 && TREE_CODE (lhs1) == VAR_DECL && TREE_CODE (lhs) == VAR_DECL)
+      if (lhs1 && VAR_P (lhs1) && VAR_P (lhs))
        {
          if (lhs1 != lhs)
            {
index 3cc3603..5987236 100644 (file)
@@ -341,7 +341,7 @@ maybe_apply_pending_pragma_weaks (void)
       DECL_ARTIFICIAL (decl) = 1;
       TREE_PUBLIC (decl) = 1;
       DECL_WEAK (decl) = 1;
-      if (TREE_CODE (decl) == VAR_DECL)
+      if (VAR_P (decl))
        TREE_STATIC (decl) = 1;
       if (!target)
        {
@@ -385,7 +385,7 @@ handle_pragma_weak (cpp_reader * ARG_UNUSED (dummy))
       if (value)
        {
          DECL_EXTERNAL (decl) = 0;
-         if (TREE_CODE (decl) == VAR_DECL)
+         if (VAR_P (decl))
            TREE_STATIC (decl) = 1;
          assemble_alias (decl, value);
        }
index 482509b..a65ff33 100644 (file)
@@ -650,7 +650,7 @@ c_pretty_printer::storage_class_specifier (tree t)
     {
       if (DECL_REGISTER (t))
        pp_c_ws_string (this, "register");
-      else if (TREE_STATIC (t) && TREE_CODE (t) == VAR_DECL)
+      else if (TREE_STATIC (t) && VAR_P (t))
        pp_c_ws_string (this, "static");
     }
 }
index 347e4b9..958df27 100644 (file)
@@ -382,7 +382,7 @@ create_parm_list (struct wrapper_data *wd, tree *val0, tree arg)
         argument list.  Because register variables are
         worker-local we don't need to work hard to support
         them in code that spawns.  */
-      if ((TREE_CODE (arg) == VAR_DECL) && DECL_HARD_REGISTER (arg))
+      if (VAR_P (arg) && DECL_HARD_REGISTER (arg))
        {
          error_at (EXPR_LOCATION (arg),
                    "explicit register variable %qD may not be modified in "
@@ -955,7 +955,7 @@ add_variable (struct wrapper_data *wd, tree var, enum add_variable_type how)
         work anyway.  Warn here.  This misses one case: if the
         register variable is used as the loop bound or increment it
         has already been added to the map.  */
-      if ((how != ADD_BIND) && (TREE_CODE (var) == VAR_DECL)
+      if ((how != ADD_BIND) && VAR_P (var)
          && !DECL_EXTERNAL (var) && DECL_HARD_REGISTER (var))
        warning (0, "register assignment ignored for %qD used in Cilk block",
                 var);
index c8d1c24..6b3deac 100644 (file)
@@ -1,5 +1,13 @@
 2015-06-25  Marek Polacek  <polacek@redhat.com>
 
+       * c-array-notation.c: Use VAR_P throughout.
+       * c-decl.c: Likewise.
+       * c-objc-common.c: Likewise.
+       * c-parser.c: Likewise.
+       * c-typeck.c: Likewise.
+
+2015-06-25  Marek Polacek  <polacek@redhat.com>
+
        * c-decl.c: Use is_global_var throughout.
        * c-parser.c: Likewise.
        * c-typeck.c: Likewise.
index 2816680..0292468 100644 (file)
@@ -87,7 +87,7 @@ make_triplet_val_inv (location_t loc, tree *value)
   tree var, new_exp;
   if (TREE_CODE (*value) != INTEGER_CST
       && TREE_CODE (*value) != PARM_DECL
-      && TREE_CODE (*value) != VAR_DECL)
+      && !VAR_P (*value))
     {
       var = build_decl (loc, VAR_DECL, NULL_TREE, integer_type_node);
       new_exp = build_modify_expr (loc, var, TREE_TYPE (var), NOP_EXPR, loc,
index 1aa2bd4..fb4a83c 100644 (file)
@@ -669,14 +669,14 @@ decl_jump_unsafe (tree decl)
     return false;
 
   /* Always warn about crossing variably modified types.  */
-  if ((TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == TYPE_DECL)
+  if ((VAR_P (decl) || TREE_CODE (decl) == TYPE_DECL)
       && variably_modified_type_p (TREE_TYPE (decl), NULL_TREE))
     return true;
 
   /* Otherwise, only warn if -Wgoto-misses-init and this is an
      initialized automatic decl.  */
   if (warn_jump_misses_init
-      && TREE_CODE (decl) == VAR_DECL
+      && VAR_P (decl)
       && !TREE_STATIC (decl)
       && DECL_INITIAL (decl) != NULL_TREE)
     return true;
@@ -817,7 +817,7 @@ bind_label (tree name, tree label, struct c_scope *scope,
 void
 c_finish_incomplete_decl (tree decl)
 {
-  if (TREE_CODE (decl) == VAR_DECL)
+  if (VAR_P (decl))
     {
       tree type = TREE_TYPE (decl);
       if (type != error_mark_node
@@ -1599,7 +1599,7 @@ c_bind (location_t loc, tree decl, bool is_global)
   struct c_scope *scope;
   bool nested = false;
 
-  if (TREE_CODE (decl) != VAR_DECL || current_function_scope == NULL)
+  if (!VAR_P (decl) || current_function_scope == NULL)
     {
       /* Types and functions are always considered to be global.  */
       scope = file_scope;
@@ -2111,7 +2111,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
            }
        }
     }
-  else if (TREE_CODE (newdecl) == VAR_DECL)
+  else if (VAR_P (newdecl))
     {
       /* Only variables can be thread-local, and all declarations must
         agree on this property.  */
@@ -2306,7 +2306,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
       && !(TREE_CODE (newdecl) == PARM_DECL
           && TREE_ASM_WRITTEN (olddecl) && !TREE_ASM_WRITTEN (newdecl))
       /* Don't warn about a variable definition following a declaration.  */
-      && !(TREE_CODE (newdecl) == VAR_DECL
+      && !(VAR_P (newdecl)
           && DECL_INITIAL (newdecl) && !DECL_INITIAL (olddecl)))
     {
       warned = warning (OPT_Wredundant_decls, "redundant redeclaration of %q+D",
@@ -2427,7 +2427,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
     DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
 
   /* Merge the threadprivate attribute.  */
-  if (TREE_CODE (olddecl) == VAR_DECL && C_DECL_THREADPRIVATE_P (olddecl))
+  if (VAR_P (olddecl) && C_DECL_THREADPRIVATE_P (olddecl))
     C_DECL_THREADPRIVATE_P (newdecl) = 1;
 
   if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS))
@@ -2611,7 +2611,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
     TREE_USED (newdecl) = 1;
   else if (TREE_USED (newdecl))
     TREE_USED (olddecl) = 1;
-  if (TREE_CODE (olddecl) == VAR_DECL || TREE_CODE (olddecl) == PARM_DECL)
+  if (VAR_P (olddecl) || TREE_CODE (olddecl) == PARM_DECL)
     DECL_READ_P (newdecl) |= DECL_READ_P (olddecl);
   if (DECL_PRESERVE_P (olddecl))
     DECL_PRESERVE_P (newdecl) = 1;
@@ -2660,8 +2660,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
                int __thread x attribute ((tls_model ("local-exec")));
                extern int __thread x;
             as we'll lose the "local-exec" model.  */
-         if (TREE_CODE (olddecl) == VAR_DECL
-             && DECL_THREAD_LOCAL_P (newdecl))
+         if (VAR_P (olddecl) && DECL_THREAD_LOCAL_P (newdecl))
            set_decl_tls_model (olddecl, DECL_TLS_MODEL (newdecl));
          break;
        }
@@ -2694,8 +2693,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
      flags and attributes.  */
   if (DECL_RTL_SET_P (olddecl)
       && (TREE_CODE (olddecl) == FUNCTION_DECL
-         || (TREE_CODE (olddecl) == VAR_DECL
-             && TREE_STATIC (olddecl))))
+         || (VAR_P (olddecl) && TREE_STATIC (olddecl))))
     make_decl_rtl (olddecl);
 }
 
@@ -2944,7 +2942,7 @@ pushdecl (tree x)
              type_saved = true;
            }
          if (B_IN_FILE_SCOPE (b)
-             && TREE_CODE (b->decl) == VAR_DECL
+             && VAR_P (b->decl)
              && TREE_STATIC (b->decl)
              && TREE_CODE (TREE_TYPE (b->decl)) == ARRAY_TYPE
              && !TYPE_DOMAIN (TREE_TYPE (b->decl))
@@ -3075,7 +3073,7 @@ pushdecl_top_level (tree x)
 {
   tree name;
   bool nested = false;
-  gcc_assert (TREE_CODE (x) == VAR_DECL || TREE_CODE (x) == CONST_DECL);
+  gcc_assert (VAR_P (x) || TREE_CODE (x) == CONST_DECL);
 
   name = DECL_NAME (x);
 
@@ -4394,17 +4392,16 @@ c_decl_attributes (tree *node, tree attributes, int flags)
 {
   /* Add implicit "omp declare target" attribute if requested.  */
   if (current_omp_declare_target_attribute
-      && ((TREE_CODE (*node) == VAR_DECL
-          && is_global_var (*node))
+      && ((VAR_P (*node) && is_global_var (*node))
          || TREE_CODE (*node) == FUNCTION_DECL))
     {
-      if (TREE_CODE (*node) == VAR_DECL
+      if (VAR_P (*node)
          && ((DECL_CONTEXT (*node)
               && TREE_CODE (DECL_CONTEXT (*node)) == FUNCTION_DECL)
              || (current_function_decl && !DECL_EXTERNAL (*node))))
        error ("%q+D in block scope inside of declare target directive",
               *node);
-      else if (TREE_CODE (*node) == VAR_DECL
+      else if (VAR_P (*node)
               && !lang_hooks.types.omp_mappable_type (TREE_TYPE (*node)))
        error ("%q+D in declare target directive does not have mappable type",
               *node);
@@ -4542,7 +4539,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
      body of code to break, and it allows more efficient variable references
      in the presence of dynamic linking.  */
 
-  if (TREE_CODE (decl) == VAR_DECL
+  if (VAR_P (decl)
       && !initialized
       && TREE_PUBLIC (decl)
       && !DECL_THREAD_LOCAL_P (decl)
@@ -4595,7 +4592,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
   /* C99 6.7.4p3: An inline definition of a function with external
      linkage shall not contain a definition of a modifiable object
      with static storage duration...  */
-  if (TREE_CODE (decl) == VAR_DECL
+  if (VAR_P (decl)
       && current_scope != file_scope
       && TREE_STATIC (decl)
       && !TREE_READONLY (decl)
@@ -4673,7 +4670,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
   if (asmspec_tree)
     asmspec = TREE_STRING_POINTER (asmspec_tree);
 
-  if (TREE_CODE (decl) == VAR_DECL
+  if (VAR_P (decl)
       && TREE_STATIC (decl)
       && global_bindings_p ())
     /* So decl is a global variable. Record the types it uses
@@ -4766,7 +4763,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
       relayout_decl (decl);
     }
 
-  if (TREE_CODE (decl) == VAR_DECL)
+  if (VAR_P (decl))
     {
       if (init && TREE_CODE (init) == CONSTRUCTOR)
        add_flexible_array_elts_to_size (decl, init);
@@ -4847,7 +4844,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
             GCC has accepted -- but ignored -- the ASMSPEC in
             this case.  */
          if (!DECL_FILE_SCOPE_P (decl)
-             && TREE_CODE (decl) == VAR_DECL
+             && VAR_P (decl)
              && !C_DECL_REGISTER (decl)
              && !TREE_STATIC (decl))
            warning (0, "ignoring asm-specifier for non-static local "
@@ -4931,7 +4928,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
     }
 
   /* Install a cleanup (aka destructor) if one was given.  */
-  if (TREE_CODE (decl) == VAR_DECL && !TREE_STATIC (decl))
+  if (VAR_P (decl) && !TREE_STATIC (decl))
     {
       tree attr = lookup_attribute ("cleanup", DECL_ATTRIBUTES (decl));
       if (attr)
@@ -4959,7 +4956,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
     }
 
   if (warn_cxx_compat
-      && TREE_CODE (decl) == VAR_DECL
+      && VAR_P (decl)
       && !DECL_EXTERNAL (decl)
       && DECL_INITIAL (decl) == NULL_TREE)
     {
@@ -6636,7 +6633,7 @@ grokdeclarator (const struct c_declarator *declarator,
 
            if (global_decl
                && global_decl != visible_decl
-               && TREE_CODE (global_decl) == VAR_DECL
+               && VAR_P (global_decl)
                && !TREE_PUBLIC (global_decl))
              error_at (loc, "variable previously declared %<static%> "
                        "redeclared %<extern%>");
@@ -6715,7 +6712,7 @@ grokdeclarator (const struct c_declarator *declarator,
        will be ignored, and would even crash the compiler.
        Of course, this only makes sense on  VAR,PARM, and RESULT decl's.   */
     if (C_TYPE_FIELDS_VOLATILE (TREE_TYPE (decl))
-       && (TREE_CODE (decl) == VAR_DECL ||  TREE_CODE (decl) == PARM_DECL
+       && (VAR_P (decl) ||  TREE_CODE (decl) == PARM_DECL
          || TREE_CODE (decl) == RESULT_DECL))
       {
        /* It is not an error for a structure with volatile fields to
@@ -6733,7 +6730,7 @@ grokdeclarator (const struct c_declarator *declarator,
     gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl));
 
     if (warn_cxx_compat
-       && TREE_CODE (decl) == VAR_DECL
+       && VAR_P (decl)
        && TREE_PUBLIC (decl)
        && TREE_STATIC (decl)
        && (TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
index 0bd3316..a783f80 100644 (file)
@@ -109,7 +109,7 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
   switch (*spec)
     {
     case 'D':
-      if (TREE_CODE (t) == VAR_DECL && DECL_HAS_DEBUG_EXPR_P (t))
+      if (VAR_P (t) && DECL_HAS_DEBUG_EXPR_P (t))
        {
          t = DECL_DEBUG_EXPR (t);
          if (!DECL_P (t))
index f4d18bd..aaf7e32 100644 (file)
@@ -10365,7 +10365,7 @@ c_parser_oacc_data_clause_deviceptr (c_parser *parser, tree list)
         c_parser_omp_var_list_parens() should construct a list of
         locations to go along with the var list.  */
 
-      if (TREE_CODE (v) != VAR_DECL)
+      if (!VAR_P (v))
        error_at (loc, "%qD is not a variable", v);
       else if (TREE_TYPE (v) == error_mark_node)
        ;
@@ -14765,7 +14765,7 @@ c_parser_omp_threadprivate (c_parser *parser)
 
       /* If V had already been marked threadprivate, it doesn't matter
         whether it had been used prior to this point.  */
-      if (TREE_CODE (v) != VAR_DECL)
+      if (!VAR_P (v))
        error_at (loc, "%qD is not a variable", v);
       else if (TREE_USED (v) && !C_DECL_THREADPRIVATE_P (v))
        error_at (loc, "%qE declared %<threadprivate%> after first use", v);
index 7ca6e6a..9caf028 100644 (file)
@@ -219,8 +219,7 @@ c_incomplete_type_error (const_tree value, const_tree type)
   if (TREE_CODE (type) == ERROR_MARK)
     return;
 
-  if (value != 0 && (TREE_CODE (value) == VAR_DECL
-                    || TREE_CODE (value) == PARM_DECL))
+  if (value != 0 && (VAR_P (value) || TREE_CODE (value) == PARM_DECL))
     error ("%qD has an incomplete type %qT", value, type);
   else
     {
@@ -2531,7 +2530,7 @@ build_array_ref (location_t loc, tree array, tree index)
          tree foo = array;
          while (TREE_CODE (foo) == COMPONENT_REF)
            foo = TREE_OPERAND (foo, 0);
-         if (TREE_CODE (foo) == VAR_DECL && C_DECL_REGISTER (foo))
+         if (VAR_P (foo) && C_DECL_REGISTER (foo))
            pedwarn (loc, OPT_Wpedantic,
                     "ISO C forbids subscripting %<register%> array");
          else if (!lvalue_p (foo))
@@ -2673,7 +2672,7 @@ build_external_ref (location_t loc, tree id, int fun, tree *type)
           && DECL_DECLARED_INLINE_P (current_function_decl)
           && DECL_EXTERNAL (current_function_decl)
           && VAR_OR_FUNCTION_DECL_P (ref)
-          && (TREE_CODE (ref) != VAR_DECL || TREE_STATIC (ref))
+          && (!VAR_P (ref) || TREE_STATIC (ref))
           && ! TREE_PUBLIC (ref)
           && DECL_CONTEXT (ref) != current_function_decl)
     record_inline_static (loc, current_function_decl, ref,
@@ -11589,7 +11588,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
     {
       if (error_operand_p (t))
        return error_mark_node;
-      if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+      if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
        {
          if (DECL_P (t))
            error_at (OMP_CLAUSE_LOCATION (c),
@@ -11602,7 +11601,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
          return error_mark_node;
        }
       else if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_DEPEND
-              && TREE_CODE (t) == VAR_DECL && DECL_THREAD_LOCAL_P (t))
+              && VAR_P (t) && DECL_THREAD_LOCAL_P (t))
        {
          error_at (OMP_CLAUSE_LOCATION (c),
                    "%qD is threadprivate variable in %qs clause", t,
@@ -12198,7 +12197,7 @@ c_finish_omp_clauses (tree clauses)
 
        case OMP_CLAUSE_COPYIN:
          t = OMP_CLAUSE_DECL (c);
-         if (TREE_CODE (t) != VAR_DECL || !DECL_THREAD_LOCAL_P (t))
+         if (!VAR_P (t) || !DECL_THREAD_LOCAL_P (t))
            {
              error_at (OMP_CLAUSE_LOCATION (c),
                        "%qE must be %<threadprivate%> for %<copyin%>", t);
@@ -12236,7 +12235,7 @@ c_finish_omp_clauses (tree clauses)
 
        check_dup_generic:
          t = OMP_CLAUSE_DECL (c);
-         if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+         if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
            {
              error_at (OMP_CLAUSE_LOCATION (c),
                        "%qE is not a variable in clause %qs", t,
@@ -12259,7 +12258,7 @@ c_finish_omp_clauses (tree clauses)
          t = OMP_CLAUSE_DECL (c);
          need_complete = true;
          need_implicitly_determined = true;
-         if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+         if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
            {
              error_at (OMP_CLAUSE_LOCATION (c),
                        "%qE is not a variable in clause %<firstprivate%>", t);
@@ -12280,7 +12279,7 @@ c_finish_omp_clauses (tree clauses)
          t = OMP_CLAUSE_DECL (c);
          need_complete = true;
          need_implicitly_determined = true;
-         if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+         if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
            {
              error_at (OMP_CLAUSE_LOCATION (c),
                        "%qE is not a variable in clause %<lastprivate%>", t);
@@ -12299,7 +12298,7 @@ c_finish_omp_clauses (tree clauses)
 
        case OMP_CLAUSE_ALIGNED:
          t = OMP_CLAUSE_DECL (c);
-         if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+         if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
            {
              error_at (OMP_CLAUSE_LOCATION (c),
                        "%qE is not a variable in %<aligned%> clause", t);
@@ -12334,7 +12333,7 @@ c_finish_omp_clauses (tree clauses)
            }
          if (t == error_mark_node)
            remove = true;
-         else if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+         else if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
            {
              error_at (OMP_CLAUSE_LOCATION (c),
                        "%qE is not a variable in %<depend%> clause", t);
@@ -12369,14 +12368,14 @@ c_finish_omp_clauses (tree clauses)
            }
          if (t == error_mark_node)
            remove = true;
-         else if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
+         else if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
            {
              error_at (OMP_CLAUSE_LOCATION (c),
                        "%qE is not a variable in %qs clause", t,
                        omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
              remove = true;
            }
-         else if (TREE_CODE (t) == VAR_DECL && DECL_THREAD_LOCAL_P (t))
+         else if (VAR_P (t) && DECL_THREAD_LOCAL_P (t))
            {
              error_at (OMP_CLAUSE_LOCATION (c),
                        "%qD is threadprivate variable in %qs clause", t,
@@ -12503,7 +12502,7 @@ c_finish_omp_clauses (tree clauses)
            {
              const char *share_name = NULL;
 
-             if (TREE_CODE (t) == VAR_DECL && DECL_THREAD_LOCAL_P (t))
+             if (VAR_P (t) && DECL_THREAD_LOCAL_P (t))
                share_name = "threadprivate";
              else switch (c_omp_predetermined_sharing (t))
                {
@@ -12752,10 +12751,10 @@ c_tree_equal (tree t1, tree t2)
           it means that it's going to be unified with whatever the
           TARGET_EXPR is really supposed to initialize, so treat it
           as being equivalent to anything.  */
-       if (TREE_CODE (o1) == VAR_DECL && DECL_NAME (o1) == NULL_TREE
+       if (VAR_P (o1) && DECL_NAME (o1) == NULL_TREE
            && !DECL_RTL_SET_P (o1))
          /*Nop*/;
-       else if (TREE_CODE (o2) == VAR_DECL && DECL_NAME (o2) == NULL_TREE
+       else if (VAR_P (o2) && DECL_NAME (o2) == NULL_TREE
                 && !DECL_RTL_SET_P (o2))
          /*Nop*/;
        else if (!c_tree_equal (o1, o2))