Hi! Just a cleanup patch, most of the FE already uses these macros.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-10-24 Jakub Jelinek <ja...@redhat.com> * cxx-pretty-print.c (pp_cxx_check_constraint): Use VAR_P (x) instead of TREE_CODE (x) == VAR_DECL. * constraint.cc (get_concept_definition): Likewise. (finish_shorthand_constraint): Likewise. * init.c (warn_placement_new_too_small): Likewise. * cp-gimplify.c (cp_genericize_r): Likewise. --- gcc/cp/cxx-pretty-print.c.jj 2016-10-07 21:36:47.000000000 +0200 +++ gcc/cp/cxx-pretty-print.c 2016-10-24 14:09:57.315489702 +0200 @@ -2788,7 +2788,7 @@ pp_cxx_check_constraint (cxx_pretty_prin tree args = CHECK_CONSTR_ARGS (t); tree id = build_nt (TEMPLATE_ID_EXPR, tmpl, args); - if (TREE_CODE (decl) == VAR_DECL) + if (VAR_P (decl)) pp->expression (id); else if (TREE_CODE (decl) == FUNCTION_DECL) { --- gcc/cp/constraint.cc.jj 2016-09-26 12:06:41.000000000 +0200 +++ gcc/cp/constraint.cc 2016-10-24 14:10:41.185936471 +0200 @@ -509,7 +509,7 @@ get_variable_initializer (tree var) tree get_concept_definition (tree decl) { - if (TREE_CODE (decl) == VAR_DECL) + if (VAR_P (decl)) return get_variable_initializer (decl); else if (TREE_CODE (decl) == FUNCTION_DECL) return get_returned_expression (decl); @@ -1286,10 +1286,8 @@ finish_shorthand_constraint (tree decl, the constraint an expansion. */ tree check; tree tmpl = DECL_TI_TEMPLATE (con); - if (TREE_CODE (con) == VAR_DECL) - { - check = build_concept_check (tmpl, arg, args); - } + if (VAR_P (con)) + check = build_concept_check (tmpl, arg, args); else { tree ovl = build_overload (tmpl, NULL_TREE); --- gcc/cp/init.c.jj 2016-10-13 10:25:37.000000000 +0200 +++ gcc/cp/init.c 2016-10-24 14:09:37.470739956 +0200 @@ -2362,7 +2362,7 @@ warn_placement_new_too_small (tree type, to placement new is not checked since it's unknown what it might point to. */ if (TREE_CODE (oper) == PARM_DECL - || TREE_CODE (oper) == VAR_DECL + || VAR_P (oper) || TREE_CODE (oper) == COMPONENT_REF) return; @@ -2435,13 +2435,13 @@ warn_placement_new_too_small (tree type, { tree op0 = oper; while (TREE_CODE (op0 = TREE_OPERAND (op0, 0)) == COMPONENT_REF); - if (TREE_CODE (op0) == VAR_DECL) + if (VAR_P (op0)) var_decl = op0; oper = TREE_OPERAND (oper, 1); } if ((addr_expr || !POINTER_TYPE_P (TREE_TYPE (oper))) - && (TREE_CODE (oper) == VAR_DECL + && (VAR_P (oper) || TREE_CODE (oper) == FIELD_DECL || TREE_CODE (oper) == PARM_DECL)) { @@ -2455,7 +2455,7 @@ warn_placement_new_too_small (tree type, /* Treat members of unions and members of structs uniformly, even though the size of a member of a union may be viewed as extending to the end of the union itself (it is by __builtin_object_size). */ - if ((TREE_CODE (oper) == VAR_DECL || use_obj_size) + if ((VAR_P (oper) || use_obj_size) && DECL_SIZE_UNIT (oper) && tree_fits_uhwi_p (DECL_SIZE_UNIT (oper))) { --- gcc/cp/cp-gimplify.c.jj 2016-10-09 13:17:44.000000000 +0200 +++ gcc/cp/cp-gimplify.c 2016-10-24 14:10:14.110277911 +0200 @@ -1350,7 +1350,7 @@ cp_genericize_r (tree *stmt_p, int *walk else if (TREE_CODE (stmt) == DECL_EXPR) { tree d = DECL_EXPR_DECL (stmt); - if (TREE_CODE (d) == VAR_DECL) + if (VAR_P (d)) gcc_assert (CP_DECL_THREAD_LOCAL_P (d) == DECL_THREAD_LOCAL_P (d)); } else if (TREE_CODE (stmt) == OMP_PARALLEL Jakub