]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2013-03-29 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Mar 2013 20:29:26 +0000 (20:29 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 Mar 2013 20:29:26 +0000 (20:29 +0000)
* call.c (add_builtin_candidate): Use TYPE_PTR_P and VOID_TYPE_P.
(build_op_call_1): Likewise.
(build_over_call): Likewise.
(compare_ics): Likewise.
* class.c (build_base_path): Likewise.
(resolve_address_of_overloaded_function): Likewise.
* cp-tree.h: Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_reference): Likewise.
(ocp_convert): Likewise.
(convert_force): Likewise, tidy.
* cxx-pretty-print.c (pp_cxx_postfix_expression): Likewise.
(pp_cxx_ptr_operator): Likewise.
* decl.c (duplicate_decls): Likewise.
(start_decl): Likewise.
(grok_op_properties): Likewise.
(start_preparsed_function): Likewise.
(store_parm_decls): Likewise.
(finish_function): Likewise.
* decl2.c (delete_sanity): Likewise.
(acceptable_java_type): Likewise.
(grokbitfield): Likewise.
(cp_reconstruct_complex_type): Likewise.
* error.c (dump_type_prefix): Likewise.
(dump_expr): Likewise.
* except.c (push_eh_cleanup): Likewise.
(complete_ptr_ref_or_void_ptr_p): Likewise.
(can_convert_eh): Likewise.
* init.c (build_new_1): Likewise.
(build_delete): Likewise.
(build_vec_delete): Likewise.
* mangle.c (write_type): Likewise.
* parser.c (lookup_literal_operator): Likewise.
* pt.c (convert_nontype_argument_function): Likewise.
(convert_nontype_argument): Likewise.
(tsubst): Likewise.
(unify): Likewise.
(dependent_type_p_r): Likewise.
* rtti.c (build_headof): Likewise.
(build_typeid): Likewise.
(build_dynamic_cast_1): Likewise.
(target_incomplete_p): Likewise.
(typeinfo_in_lib_p): Likewise.
* semantics.c (finish_omp_for): Likewise.
(cxx_eval_call_expression): Likewise.
(maybe_resolve_dummy): Likewise.
* tree.c (build_target_expr): Likewise.
(cp_build_qualified_type_real): Likewise.
* typeck.c (composite_pointer_type_r): Likewise.
(composite_pointer_type): Likewise.
(comp_except_types): Likewise.
(cxx_sizeof_nowarn): Likewise.
(string_conv_p): Likewise.
(cp_build_array_ref): Likewise.
(cp_build_function_call_vec): Likewise, also use TYPE_PTRFN_P.
(pointer_diff): Likewise.
(cp_build_addr_expr_1): Likewise.
(cp_build_unary_op): Likewise.
(build_static_cast_1): Likewise.
(cp_build_c_cast): Likewise.
(comp_ptr_ttypes_real): Likewise.
(ptr_reasonably_similar): Likewise.
(comp_ptr_ttypes_const): Likewise.
(casts_away_constness): Likewise.
(check_literal_operator_args): Likewise.
* typeck2.c (build_x_arrow): Likewise.
(add_exception_specifier): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197249 138bc75d-0d04-0410-961f-82ee72b054a4

19 files changed:
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/cvt.c
gcc/cp/cxx-pretty-print.c
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/error.c
gcc/cp/except.c
gcc/cp/init.c
gcc/cp/mangle.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/rtti.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/cp/typeck2.c

index 8059562e581b470ba66cec7440c071843798cb1d..16ea0743d6e755fa6829654d73bab7afc9ebcc78 100644 (file)
@@ -1,3 +1,73 @@
+2013-03-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * call.c (add_builtin_candidate): Use TYPE_PTR_P and VOID_TYPE_P.
+       (build_op_call_1): Likewise.
+       (build_over_call): Likewise.
+       (compare_ics): Likewise.
+       * class.c (build_base_path): Likewise.
+       (resolve_address_of_overloaded_function): Likewise.
+       * cp-tree.h: Likewise.
+       * cvt.c (cp_convert_to_pointer): Likewise.
+       (convert_to_reference): Likewise.
+       (ocp_convert): Likewise.
+       (convert_force): Likewise, tidy.
+       * cxx-pretty-print.c (pp_cxx_postfix_expression): Likewise.
+       (pp_cxx_ptr_operator): Likewise.
+       * decl.c (duplicate_decls): Likewise.
+       (start_decl): Likewise.
+       (grok_op_properties): Likewise.
+       (start_preparsed_function): Likewise.
+       (store_parm_decls): Likewise.
+       (finish_function): Likewise.
+       * decl2.c (delete_sanity): Likewise.
+       (acceptable_java_type): Likewise.
+       (grokbitfield): Likewise.
+       (cp_reconstruct_complex_type): Likewise.
+       * error.c (dump_type_prefix): Likewise.
+       (dump_expr): Likewise.
+       * except.c (push_eh_cleanup): Likewise.
+       (complete_ptr_ref_or_void_ptr_p): Likewise.
+       (can_convert_eh): Likewise.
+       * init.c (build_new_1): Likewise.
+       (build_delete): Likewise.
+       (build_vec_delete): Likewise.
+       * mangle.c (write_type): Likewise.
+       * parser.c (lookup_literal_operator): Likewise.
+       * pt.c (convert_nontype_argument_function): Likewise.
+       (convert_nontype_argument): Likewise.
+       (tsubst): Likewise.
+       (unify): Likewise.
+       (dependent_type_p_r): Likewise.
+       * rtti.c (build_headof): Likewise.
+       (build_typeid): Likewise.
+       (build_dynamic_cast_1): Likewise.
+       (target_incomplete_p): Likewise.
+       (typeinfo_in_lib_p): Likewise.
+       * semantics.c (finish_omp_for): Likewise.
+       (cxx_eval_call_expression): Likewise.
+       (maybe_resolve_dummy): Likewise.
+       * tree.c (build_target_expr): Likewise.
+       (cp_build_qualified_type_real): Likewise.
+       * typeck.c (composite_pointer_type_r): Likewise.
+       (composite_pointer_type): Likewise.
+       (comp_except_types): Likewise.
+       (cxx_sizeof_nowarn): Likewise.
+       (string_conv_p): Likewise.
+       (cp_build_array_ref): Likewise.
+       (cp_build_function_call_vec): Likewise, also use TYPE_PTRFN_P.
+       (pointer_diff): Likewise.
+       (cp_build_addr_expr_1): Likewise.
+       (cp_build_unary_op): Likewise.
+       (build_static_cast_1): Likewise.
+       (cp_build_c_cast): Likewise.
+       (comp_ptr_ttypes_real): Likewise.
+       (ptr_reasonably_similar): Likewise.
+       (comp_ptr_ttypes_const): Likewise.
+       (casts_away_constness): Likewise.
+       (check_literal_operator_args): Likewise.
+       * typeck2.c (build_x_arrow): Likewise.
+       (add_exception_specifier): Likewise.
+
 2013-03-29  Jason Merrill  <jason@redhat.com>
 
        N3582
index 62d6e15ff7b059527515f0fc90d968c7230cdb02..1c368ca8ce849b8cd6ad7d3b32767eeb14f3614f 100644 (file)
@@ -2285,7 +2285,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
             T&      operator*(T*);  */
 
     case INDIRECT_REF:
-      if (TREE_CODE (type1) == POINTER_TYPE
+      if (TYPE_PTR_P (type1)
          && !uses_template_parms (TREE_TYPE (type1))
          && (TYPE_PTROB_P (type1)
              || TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE))
@@ -2301,7 +2301,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
             T       operator-(T);  */
 
     case UNARY_PLUS_EXPR: /* unary + */
-      if (TREE_CODE (type1) == POINTER_TYPE)
+      if (TYPE_PTR_P (type1))
        break;
     case NEGATE_EXPR:
       if (ARITHMETIC_TYPE_P (type1))
@@ -2325,8 +2325,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
      where CV12 is the union of CV1 and CV2.  */
 
     case MEMBER_REF:
-      if (TREE_CODE (type1) == POINTER_TYPE
-         && TYPE_PTRMEM_P (type2))
+      if (TYPE_PTR_P (type1) && TYPE_PTRMEM_P (type2))
        {
          tree c1 = TREE_TYPE (type1);
          tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2);
@@ -2546,7 +2545,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
              || (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
              || (TYPE_PTRDATAMEM_P (type1) && TYPE_PTRDATAMEM_P (type2))
              || ((TYPE_PTRMEMFUNC_P (type1)
-                  || TREE_CODE (type1) == POINTER_TYPE)
+                  || TYPE_PTR_P (type1))
                  && null_ptr_cst_p (args[1])))
            {
              type2 = type1;
@@ -4083,12 +4082,12 @@ build_op_call_1 (tree obj, vec<tree, va_gc> **args, tsubst_flags_t complain)
       tree fns = TREE_VALUE (convs);
       tree totype = TREE_TYPE (convs);
 
-      if ((TREE_CODE (totype) == POINTER_TYPE
+      if ((TYPE_PTR_P (totype)
           && TREE_CODE (TREE_TYPE (totype)) == FUNCTION_TYPE)
          || (TREE_CODE (totype) == REFERENCE_TYPE
              && TREE_CODE (TREE_TYPE (totype)) == FUNCTION_TYPE)
          || (TREE_CODE (totype) == REFERENCE_TYPE
-             && TREE_CODE (TREE_TYPE (totype)) == POINTER_TYPE
+             && TYPE_PTR_P (TREE_TYPE (totype))
              && TREE_CODE (TREE_TYPE (TREE_TYPE (totype))) == FUNCTION_TYPE))
        for (; fns; fns = OVL_NEXT (fns))
          {
@@ -6766,7 +6765,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
 
         So we can assume that anything passed as 'this' is non-null, and
         optimize accordingly.  */
-      gcc_assert (TREE_CODE (parmtype) == POINTER_TYPE);
+      gcc_assert (TYPE_PTR_P (parmtype));
       /* Convert to the base in which the function was declared.  */
       gcc_assert (cand->conversion_path != NULL_TREE);
       converted_arg = build_base_path (PLUS_EXPR,
@@ -8136,8 +8135,8 @@ compare_ics (conversion *ics1, conversion *ics2)
           conversion of B* to A* is better than conversion of B* to
           void*, and conversion of A* to void* is better than
           conversion of B* to void*.  */
-      if (TREE_CODE (deref_to_type1) == VOID_TYPE
-         && TREE_CODE (deref_to_type2) == VOID_TYPE)
+      if (VOID_TYPE_P (deref_to_type1)
+         && VOID_TYPE_P (deref_to_type2))
        {
          if (is_properly_derived_from (deref_from_type1,
                                        deref_from_type2))
@@ -8146,12 +8145,12 @@ compare_ics (conversion *ics1, conversion *ics2)
                                             deref_from_type1))
            return 1;
        }
-      else if (TREE_CODE (deref_to_type1) == VOID_TYPE
-              || TREE_CODE (deref_to_type2) == VOID_TYPE)
+      else if (VOID_TYPE_P (deref_to_type1)
+              || VOID_TYPE_P (deref_to_type2))
        {
          if (same_type_p (deref_from_type1, deref_from_type2))
            {
-             if (TREE_CODE (deref_to_type2) == VOID_TYPE)
+             if (VOID_TYPE_P (deref_to_type2))
                {
                  if (is_properly_derived_from (deref_from_type1,
                                                deref_to_type1))
index e9f8bbac3a594b1db65c8767df5950bcbe013e3e..cea8a512cd35aa928135fa27f245cc51b9822774 100644 (file)
@@ -244,7 +244,7 @@ build_base_path (enum tree_code code,
   tree null_test = NULL;
   tree ptr_target_type;
   int fixed_type_p;
-  int want_pointer = TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE;
+  int want_pointer = TYPE_PTR_P (TREE_TYPE (expr));
   bool has_empty = false;
   bool virtual_access;
 
@@ -7142,7 +7142,7 @@ resolve_address_of_overloaded_function (tree target_type,
   /* By the time we get here, we should be seeing only real
      pointer-to-member types, not the internal POINTER_TYPE to
      METHOD_TYPE representation.  */
-  gcc_assert (TREE_CODE (target_type) != POINTER_TYPE
+  gcc_assert (!TYPE_PTR_P (target_type)
              || TREE_CODE (TREE_TYPE (target_type)) != METHOD_TYPE);
 
   gcc_assert (is_overloaded_fn (overload));
index 521da0054abfc48fe38a66fc6a58c401f03602c9..eef60a23cb90732fe76d4c146c0a3065646a48eb 100644 (file)
@@ -3450,7 +3450,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
    Keep these checks in ascending order, for speed.  */
 #define TYPE_OBJ_P(NODE)                       \
   (TREE_CODE (NODE) != REFERENCE_TYPE          \
-   && TREE_CODE (NODE) != VOID_TYPE            \
+   && !VOID_TYPE_P (NODE)                      \
    && TREE_CODE (NODE) != FUNCTION_TYPE                \
    && TREE_CODE (NODE) != METHOD_TYPE)
 
@@ -3473,7 +3473,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
 
 /* Returns true if NODE is a pointer to function.  */
 #define TYPE_PTRFN_P(NODE)                             \
-  (TREE_CODE (NODE) == POINTER_TYPE                    \
+  (TYPE_PTR_P (NODE)                                   \
    && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
 
 /* Returns true if NODE is a reference to function.  */
index 2cb858b91e0724fd26d09b23d26b5888a55ce34b..866396c5b4073dfc79e134dd9565fb83608d7ebe 100644 (file)
@@ -105,14 +105,14 @@ cp_convert_to_pointer (tree type, tree expr, tsubst_flags_t complain)
     }
 
   /* Handle anachronistic conversions from (::*)() to cv void* or (*)().  */
-  if (TREE_CODE (type) == POINTER_TYPE
+  if (TYPE_PTR_P (type)
       && (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
          || VOID_TYPE_P (TREE_TYPE (type))))
     {
       if (TYPE_PTRMEMFUNC_P (intype)
          || TREE_CODE (intype) == METHOD_TYPE)
        return convert_member_func_to_ptr (type, expr, complain);
-      if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
+      if (TYPE_PTR_P (TREE_TYPE (expr)))
        return build_nop (type, expr);
       intype = TREE_TYPE (expr);
     }
@@ -127,7 +127,7 @@ cp_convert_to_pointer (tree type, tree expr, tsubst_flags_t complain)
       intype = TYPE_MAIN_VARIANT (intype);
 
       if (TYPE_MAIN_VARIANT (type) != intype
-         && TREE_CODE (type) == POINTER_TYPE
+         && TYPE_PTR_P (type)
          && TREE_CODE (TREE_TYPE (type)) == RECORD_TYPE
          && MAYBE_CLASS_TYPE_P (TREE_TYPE (type))
          && MAYBE_CLASS_TYPE_P (TREE_TYPE (intype))
@@ -483,7 +483,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
       /* B* bp; A& ar = (A&)bp; is valid, but it's probably not what they
         meant.  */
       if ((complain & tf_warning)
-         && TREE_CODE (intype) == POINTER_TYPE
+         && TYPE_PTR_P (intype)
          && (comptypes (TREE_TYPE (intype), type,
                         COMPARE_BASE | COMPARE_DERIVED)))
        warning_at (loc, 0, "casting %qT to %qT does not dereference pointer",
@@ -723,7 +723,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
          if (((INTEGRAL_OR_ENUMERATION_TYPE_P (intype)
                || TREE_CODE (intype) == REAL_TYPE)
               && ! (convtype & CONV_STATIC))
-             || TREE_CODE (intype) == POINTER_TYPE)
+             || TYPE_PTR_P (intype))
            {
              if (complain & tf_error)
                permerror (loc, "conversion from %q#T to %q#T", intype, type);
@@ -758,7 +758,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
        }
       if (code == BOOLEAN_TYPE)
        {
-         if (TREE_CODE (intype) == VOID_TYPE)
+         if (VOID_TYPE_P (intype))
            {
              if (complain & tf_error)
                error_at (loc,
@@ -1457,8 +1457,7 @@ convert_force (tree type, tree expr, int convtype, tsubst_flags_t complain)
                                                              complain));
 
   /* From typeck.c convert_for_assignment */
-  if (((TREE_CODE (TREE_TYPE (e)) == POINTER_TYPE && TREE_CODE (e) == ADDR_EXPR
-       && TREE_CODE (TREE_TYPE (e)) == POINTER_TYPE
+  if (((TYPE_PTR_P (TREE_TYPE (e)) && TREE_CODE (e) == ADDR_EXPR
        && TREE_CODE (TREE_TYPE (TREE_TYPE (e))) == METHOD_TYPE)
        || integer_zerop (e)
        || TYPE_PTRMEMFUNC_P (TREE_TYPE (e)))
index 4275b45c1e75c5d73392f05dd062b9e1b92a2d8c..0b707fbde2d250ccb8502813f6bde2346320cea5 100644 (file)
@@ -530,7 +530,7 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
            if (TREE_CODE (object) == ADDR_EXPR)
              object = TREE_OPERAND (object, 0);
 
-           if (TREE_CODE (TREE_TYPE (object)) != POINTER_TYPE)
+           if (!TYPE_PTR_P (TREE_TYPE (object)))
              {
                pp_cxx_postfix_expression (pp, object);
                pp_cxx_dot (pp);
@@ -1364,7 +1364,7 @@ pp_cxx_ptr_operator (cxx_pretty_printer *pp, tree t)
        pp_cxx_ptr_operator (pp, TREE_TYPE (t));
       pp_c_attributes_display (pp_c_base (pp),
                               TYPE_ATTRIBUTES (TREE_TYPE (t)));
-      if (TREE_CODE (t) == POINTER_TYPE)
+      if (TYPE_PTR_P (t))
        {
          pp_star (pp);
          pp_cxx_cv_qualifier_seq (pp, t);
index 25fa34b21492c5df712a83c54259cbae62360798..ae4c5b4714841caa38e15f6666fd492254e0712f 100644 (file)
@@ -1348,7 +1348,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
                  {
                    tree t = TREE_VALUE (t1);
 
-                   if (TREE_CODE (t) == POINTER_TYPE
+                   if (TYPE_PTR_P (t)
                        && TYPE_NAME (TREE_TYPE (t))
                        && DECL_NAME (TYPE_NAME (TREE_TYPE (t)))
                           == get_identifier ("FILE")
@@ -4451,7 +4451,7 @@ start_decl (const cp_declarator *declarator,
 
   deprecated_state = DEPRECATED_NORMAL;
 
-  if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE
+  if (decl == NULL_TREE || VOID_TYPE_P (decl)
       || decl == error_mark_node)
     return error_mark_node;
 
@@ -11487,7 +11487,7 @@ grok_op_properties (tree decl, bool complain)
          if (ref)
            t = TYPE_MAIN_VARIANT (TREE_TYPE (t));
 
-         if (TREE_CODE (t) == VOID_TYPE)
+         if (VOID_TYPE_P (t))
             warning (OPT_Wconversion,
                      ref
                      ? G_("conversion to a reference to void "
@@ -12951,7 +12951,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
   bool honor_interface;
 
   /* Sanity check.  */
-  gcc_assert (TREE_CODE (TREE_VALUE (void_list_node)) == VOID_TYPE);
+  gcc_assert (VOID_TYPE_P (TREE_VALUE (void_list_node)));
   gcc_assert (TREE_CHAIN (void_list_node) == NULL_TREE);
 
   fntype = TREE_TYPE (decl1);
@@ -13016,7 +13016,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
   /* Effective C++ rule 15.  */
   if (warn_ecpp
       && DECL_OVERLOADED_OPERATOR_P (decl1) == NOP_EXPR
-      && TREE_CODE (TREE_TYPE (fntype)) == VOID_TYPE)
+      && VOID_TYPE_P (TREE_TYPE (fntype)))
     warning (OPT_Weffc__, "%<operator=%> should return a reference to %<*this%>");
 
   /* Make the init_value nonzero so pushdecl knows this is not tentative.
@@ -13187,7 +13187,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
       tree t = DECL_ARGUMENTS (decl1);
 
       gcc_assert (t != NULL_TREE && TREE_CODE (t) == PARM_DECL);
-      gcc_assert (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE);
+      gcc_assert (TYPE_PTR_P (TREE_TYPE (t)));
 
       cp_function_chain->x_current_class_ref
        = cp_build_indirect_ref (t, RO_NULL, tf_warning_or_error);
@@ -13415,7 +13415,7 @@ store_parm_decls (tree current_function_parms)
          if (TREE_CODE (parm) == PARM_DECL)
            {
              if (DECL_NAME (parm) == NULL_TREE
-                 || TREE_CODE (parm) != VOID_TYPE)
+                 || !VOID_TYPE_P (parm))
                pushdecl (parm);
              else
                error ("parameter %qD declared void", parm);
@@ -13838,7 +13838,7 @@ finish_function (int flags)
 
   /* Complain if there's just no return statement.  */
   if (warn_return_type
-      && TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE
+      && !VOID_TYPE_P (TREE_TYPE (fntype))
       && !dependent_type_p (TREE_TYPE (fntype))
       && !current_function_returns_value && !current_function_returns_null
       /* Don't complain if we abort or throw.  */
index ea290b9e6f4f705de6ba0a4aecfac9a2b2a0a549..09fd86464b0ddf6d36d5a165ca291cc9b48f51ec 100644 (file)
@@ -460,7 +460,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete,
     }
 
   /* Deleting ptr to void is undefined behavior [expr.delete/3].  */
-  if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
+  if (VOID_TYPE_P (TREE_TYPE (type)))
     {
       warning (0, "deleting %qT is undefined", type);
       doing_vec = 0;
@@ -518,9 +518,9 @@ acceptable_java_type (tree type)
   if (type == error_mark_node)
     return false;
 
-  if (TREE_CODE (type) == VOID_TYPE || TYPE_FOR_JAVA (type))
+  if (VOID_TYPE_P (type) || TYPE_FOR_JAVA (type))
     return true;
-  if (TREE_CODE (type) == POINTER_TYPE || TREE_CODE (type) == REFERENCE_TYPE)
+  if (TYPE_PTR_P (type) || TREE_CODE (type) == REFERENCE_TYPE)
     {
       type = TREE_TYPE (type);
       if (TREE_CODE (type) == RECORD_TYPE)
@@ -535,7 +535,7 @@ acceptable_java_type (tree type)
          while (--i >= 0)
            {
              type = TREE_VEC_ELT (args, i);
-             if (TREE_CODE (type) == POINTER_TYPE)
+             if (TYPE_PTR_P (type))
                type = TREE_TYPE (type);
              if (! TYPE_FOR_JAVA (type))
                return false;
@@ -1024,7 +1024,7 @@ grokbitfield (const cp_declarator *declarator,
     return NULL_TREE; /* friends went bad.  */
 
   /* Pass friendly classes back.  */
-  if (TREE_CODE (value) == VOID_TYPE)
+  if (VOID_TYPE_P (value))
     return void_type_node;
 
   if (!INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value))
@@ -1234,7 +1234,7 @@ cp_reconstruct_complex_type (tree type, tree bottom)
 {
   tree inner, outer;
 
-  if (TREE_CODE (type) == POINTER_TYPE)
+  if (TYPE_PTR_P (type))
     {
       inner = cp_reconstruct_complex_type (TREE_TYPE (type), bottom);
       outer = build_pointer_type_for_mode (inner, TYPE_MODE (type),
index dd27e6cc2f3a34597b172425793bd58269bad573..38da24304e01aaeb43cfd11ccfd29286d8cb40d0 100644 (file)
@@ -708,7 +708,7 @@ dump_type_prefix (tree t, int flags)
            pp_c_attributes_display (pp_c_base (cxx_pp),
                                     TYPE_ATTRIBUTES (sub));
          }
-       if (TREE_CODE (t) == POINTER_TYPE)
+       if (TYPE_PTR_P (t))
          pp_character(cxx_pp, '*');
        else if (TREE_CODE (t) == REFERENCE_TYPE)
        {
@@ -2108,7 +2108,7 @@ dump_expr (tree t, int flags)
        {
          tree next = TREE_TYPE (TREE_TYPE (t));
 
-         while (TREE_CODE (next) == POINTER_TYPE)
+         while (TYPE_PTR_P (next))
            next = TREE_TYPE (next);
 
          if (TREE_CODE (next) == FUNCTION_TYPE)
index 0f295b006bc3d1af2475f59988ed007fd83c94de..b762a51c67a02796cf0c4068ae0afba15f6aa59d 100644 (file)
@@ -277,7 +277,7 @@ push_eh_cleanup (tree type)
 static bool
 decl_is_java_type (tree decl, int err)
 {
-  bool r = (TREE_CODE (decl) == POINTER_TYPE
+  bool r = (TYPE_PTR_P (decl)
            && TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE
            && TYPE_FOR_JAVA (TREE_TYPE (decl)));
 
@@ -930,7 +930,7 @@ complete_ptr_ref_or_void_ptr_p (tree type, tree from)
     return 0;
 
   /* Or a pointer or ref to one, or cv void *.  */
-  is_ptr = TREE_CODE (type) == POINTER_TYPE;
+  is_ptr = TYPE_PTR_P (type);
   if (is_ptr || TREE_CODE (type) == REFERENCE_TYPE)
     {
       tree core = TREE_TYPE (type);
@@ -1026,7 +1026,7 @@ can_convert_eh (tree to, tree from)
   to = non_reference (to);
   from = non_reference (from);
 
-  if (TREE_CODE (to) == POINTER_TYPE && TREE_CODE (from) == POINTER_TYPE)
+  if (TYPE_PTR_P (to) && TYPE_PTR_P (from))
     {
       to = TREE_TYPE (to);
       from = TREE_TYPE (from);
@@ -1034,7 +1034,7 @@ can_convert_eh (tree to, tree from)
       if (! at_least_as_qualified_p (to, from))
        return 0;
 
-      if (TREE_CODE (to) == VOID_TYPE)
+      if (VOID_TYPE_P (to))
        return 1;
 
       /* Else fall through.  */
index 000f514a43cf345268ff0d9b5d2d27dec3c67083..ab6af1411a6119da38c94d96a15efd5a79908911 100644 (file)
@@ -2294,7 +2294,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
        return error_mark_node;
     }
 
-  if (TREE_CODE (elt_type) == VOID_TYPE)
+  if (VOID_TYPE_P (elt_type))
     {
       if (complain & tf_error)
         error ("invalid type %<void%> for new");
@@ -2399,7 +2399,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
      this now, since PLACEMENT will change in the calls below.  */
   placement_first = NULL_TREE;
   if (vec_safe_length (*placement) == 1
-      && (TREE_CODE (TREE_TYPE ((**placement)[0])) == POINTER_TYPE))
+      && (TYPE_PTR_P (TREE_TYPE ((**placement)[0]))))
     placement_first = (**placement)[0];
 
   /* Allocate the object.  */
@@ -2523,7 +2523,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
       && TREE_CODE (alloc_call) == CALL_EXPR
       && call_expr_nargs (alloc_call) == 2
       && TREE_CODE (TREE_TYPE (CALL_EXPR_ARG (alloc_call, 0))) == INTEGER_TYPE
-      && TREE_CODE (TREE_TYPE (CALL_EXPR_ARG (alloc_call, 1))) == POINTER_TYPE)
+      && TYPE_PTR_P (TREE_TYPE (CALL_EXPR_ARG (alloc_call, 1))))
     {
       tree placement_arg = CALL_EXPR_ARG (alloc_call, 1);
 
@@ -3742,7 +3742,7 @@ build_delete (tree type, tree addr, special_function_kind auto_delete,
 
   addr = mark_rvalue_use (addr);
 
-  if (TREE_CODE (type) == POINTER_TYPE)
+  if (TYPE_PTR_P (type))
     {
       bool complete_p = true;
 
@@ -4045,7 +4045,7 @@ build_vec_delete (tree base, tree maxindex,
 
   type = TREE_TYPE (base);
 
-  if (TREE_CODE (type) == POINTER_TYPE)
+  if (TYPE_PTR_P (type))
     {
       /* Step back one from start of vector, and read dimension.  */
       tree cookie_addr;
index e303ea245b1cff038603c1598d58516a369a145c..5fe3bf5dfda7671feb746a243b39823557f12be8 100644 (file)
@@ -1912,7 +1912,7 @@ write_type (tree type)
              write_string (target_mangling);
              /* Add substitutions for types other than fundamental
                 types.  */
-             if (TREE_CODE (type) != VOID_TYPE
+             if (!VOID_TYPE_P (type)
                  && TREE_CODE (type) != INTEGER_TYPE
                  && TREE_CODE (type) != REAL_TYPE
                  && TREE_CODE (type) != BOOLEAN_TYPE)
@@ -1966,7 +1966,7 @@ write_type (tree type)
 
            case POINTER_TYPE:
            case REFERENCE_TYPE:
-             if (TREE_CODE (type) == POINTER_TYPE)
+             if (TYPE_PTR_P (type))
                write_char ('P');
              else if (TYPE_REF_IS_RVALUE (type))
                write_char ('O');
index 8ad877ef82bb6a95aae9b25fe47cb73f9f73dab9..78b13c3f7fb503dbac332a4822298523fac1fd3c 100644 (file)
@@ -3615,7 +3615,7 @@ lookup_literal_operator (tree name, vec<tree, va_gc> *args)
            {
              tree tparm = TREE_VALUE (parmtypes);
              tree targ = TREE_TYPE ((*args)[ix]);
-             bool ptr = TREE_CODE (tparm) == POINTER_TYPE;
+             bool ptr = TYPE_PTR_P (tparm);
              bool arr = TREE_CODE (targ) == ARRAY_TYPE;
              if ((ptr || arr || !same_type_p (tparm, targ))
                  && (!ptr || !arr
index 2fc282e91121a7c4b4a92e70f5216f603c5ed847..532e761f17c1a797b4a05850e474cc01e62da88d 100644 (file)
@@ -5140,7 +5140,7 @@ convert_nontype_argument_function (tree type, tree expr)
   if (TREE_CODE (fn_no_ptr) != FUNCTION_DECL)
     {
       error ("%qE is not a valid template argument for type %qT", expr, type);
-      if (TREE_CODE (type) == POINTER_TYPE)
+      if (TYPE_PTR_P (type))
        error ("it must be the address of a function with external linkage");
       else
        error ("it must be the name of a function with external linkage");
@@ -5547,7 +5547,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
          tree addr = TREE_OPERAND (probe, 0);
          if (TREE_CODE (probe_type) == REFERENCE_TYPE
              && TREE_CODE (addr) == ADDR_EXPR
-             && TREE_CODE (TREE_TYPE (addr)) == POINTER_TYPE
+             && TYPE_PTR_P (TREE_TYPE (addr))
              && (same_type_ignoring_top_level_qualifiers_p
                  (TREE_TYPE (probe_type),
                   TREE_TYPE (TREE_TYPE (addr)))))
@@ -5566,7 +5566,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
       tree probe = expr;
       STRIP_NOPS (probe);
       if (TREE_CODE (probe) == ADDR_EXPR
-         && TREE_CODE (TREE_TYPE (probe)) == POINTER_TYPE)
+         && TYPE_PTR_P (TREE_TYPE (probe)))
        {
          /* Skip the ADDR_EXPR only if it is part of the decay for
             an array. Otherwise, it is part of the original argument
@@ -11527,7 +11527,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
          only enforce this check in strict C++98 mode.  */
        if ((TREE_CODE (type) == REFERENCE_TYPE
             && (((cxx_dialect == cxx98) && flag_iso) || code != REFERENCE_TYPE))
-           || (code == REFERENCE_TYPE && TREE_CODE (type) == VOID_TYPE))
+           || (code == REFERENCE_TYPE && VOID_TYPE_P (type)))
          {
            static location_t last_loc;
 
@@ -11537,7 +11537,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
            if (complain & tf_error
                && last_loc != input_location)
              {
-               if (TREE_CODE (type) == VOID_TYPE)
+               if (VOID_TYPE_P (type))
                  error ("forming reference to void");
                else if (code == POINTER_TYPE)
                  error ("forming pointer to reference type %qT", type);
@@ -11600,7 +11600,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
              error ("creating pointer to member reference type %qT", type);
            return error_mark_node;
          }
-       if (TREE_CODE (type) == VOID_TYPE)
+       if (VOID_TYPE_P (type))
          {
            if (complain & tf_error)
              error ("creating pointer to member of type void");
@@ -11660,7 +11660,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
           -- Attempting to create an array with an element type that
              is void, a function type, or a reference type, or [DR337]
              an abstract class type.  */
-       if (TREE_CODE (type) == VOID_TYPE
+       if (VOID_TYPE_P (type)
            || TREE_CODE (type) == FUNCTION_TYPE
            || TREE_CODE (type) == REFERENCE_TYPE)
          {
@@ -16797,7 +16797,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
 
     case POINTER_TYPE:
       {
-       if (TREE_CODE (arg) != POINTER_TYPE)
+       if (!TYPE_PTR_P (arg))
          return unify_type_mismatch (explain_p, parm, arg);
 
        /* [temp.deduct.call]
@@ -19382,7 +19382,7 @@ dependent_type_p_r (tree type)
     return (dependent_type_p (TYPE_PTRMEM_CLASS_TYPE (type))
            || dependent_type_p (TYPE_PTRMEM_POINTED_TO_TYPE
                                           (type)));
-  else if (TREE_CODE (type) == POINTER_TYPE
+  else if (TYPE_PTR_P (type)
           || TREE_CODE (type) == REFERENCE_TYPE)
     return dependent_type_p (TREE_TYPE (type));
   else if (TREE_CODE (type) == FUNCTION_TYPE
index b6a9a2edb4a8e13bd9b513183db5dda04461cc53..e83d6666d9b14c373fe1634d2a3534da5b9646aa 100644 (file)
@@ -173,7 +173,7 @@ build_headof (tree exp)
   tree offset;
   tree index;
 
-  gcc_assert (TREE_CODE (type) == POINTER_TYPE);
+  gcc_assert (TYPE_PTR_P (type));
   type = TREE_TYPE (type);
 
   if (!TYPE_POLYMORPHIC_P (type))
@@ -327,7 +327,7 @@ build_typeid (tree exp, tsubst_flags_t complain)
   /* FIXME when integrating with c_fully_fold, mark
      resolves_to_fixed_type_p case as a non-constant expression.  */
   if (INDIRECT_REF_P (exp)
-      && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE
+      && TYPE_PTR_P (TREE_TYPE (TREE_OPERAND (exp, 0)))
       && TYPE_POLYMORPHIC_P (TREE_TYPE (exp))
       && ! resolves_to_fixed_type_p (exp, &nonnull)
       && ! nonnull)
@@ -528,7 +528,7 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain)
   switch (tc)
     {
     case POINTER_TYPE:
-      if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
+      if (VOID_TYPE_P (TREE_TYPE (type)))
        break;
       /* Fall through.  */
     case REFERENCE_TYPE:
@@ -559,7 +559,7 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain)
 
       expr = mark_rvalue_use (expr);
 
-      if (TREE_CODE (exprtype) != POINTER_TYPE)
+      if (!TYPE_PTR_P (exprtype))
        {
          errstr = _("source is not a pointer");
          goto fail;
@@ -620,7 +620,7 @@ build_dynamic_cast_1 (tree type, tree expr, tsubst_flags_t complain)
       {
        expr = build_base_path (PLUS_EXPR, convert_from_reference (expr),
                                binfo, 0, complain);
-       if (TREE_CODE (exprtype) == POINTER_TYPE)
+       if (TYPE_PTR_P (exprtype))
          expr = rvalue (expr);
        return expr;
       }
@@ -822,7 +822,7 @@ target_incomplete_p (tree type)
          return true;
        type = TYPE_PTRMEM_POINTED_TO_TYPE (type);
       }
-    else if (TREE_CODE (type) == POINTER_TYPE)
+    else if (TYPE_PTR_P (type))
       type = TREE_TYPE (type);
     else
       return !COMPLETE_OR_VOID_TYPE_P (type);
@@ -1053,7 +1053,7 @@ typeinfo_in_lib_p (tree type)
 {
   /* The typeinfo objects for `T*' and `const T*' are in the runtime
      library for simple types T.  */
-  if (TREE_CODE (type) == POINTER_TYPE
+  if (TYPE_PTR_P (type)
       && (cp_type_quals (TREE_TYPE (type)) == TYPE_QUAL_CONST
          || cp_type_quals (TREE_TYPE (type)) == TYPE_UNQUALIFIED))
     type = TREE_TYPE (type);
index 63f18d022f910054e06364ead0bfba4bb0644b10..1821ff4217e9d8a329a673371230529e4b6dc04b 100644 (file)
@@ -4915,7 +4915,7 @@ finish_omp_for (location_t locus, tree declv, tree initv, tree condv,
        }
 
       if (!INTEGRAL_TYPE_P (TREE_TYPE (decl))
-         && TREE_CODE (TREE_TYPE (decl)) != POINTER_TYPE)
+         && !TYPE_PTR_P (TREE_TYPE (decl)))
        {
          error_at (elocus, "invalid type for iteration variable %qE", decl);
          return NULL;
@@ -6859,7 +6859,7 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t,
            {
              tree ob_arg = get_nth_callarg (t, 0);
              STRIP_NOPS (ob_arg);
-             gcc_assert (TREE_CODE (TREE_TYPE (ob_arg)) == POINTER_TYPE
+             gcc_assert (TYPE_PTR_P (TREE_TYPE (ob_arg))
                          && CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (ob_arg))));
              result = adjust_temp_type (TREE_TYPE (TREE_TYPE (ob_arg)),
                                         result);
@@ -9623,7 +9623,7 @@ maybe_resolve_dummy (tree object)
     return object;
 
   tree type = TYPE_MAIN_VARIANT (TREE_TYPE (object));
-  gcc_assert (TREE_CODE (type) != POINTER_TYPE);
+  gcc_assert (!TYPE_PTR_P (type));
 
   if (type != current_class_type
       && current_class_type
index 8faf566c3f3191582ae333896206c186b0c8630a..7fb8698ecfc33ac24bc8b5882d8016bf9ad7c413 100644 (file)
@@ -309,7 +309,7 @@ build_target_expr (tree decl, tree value, tsubst_flags_t complain)
   gcc_assert (VOID_TYPE_P (TREE_TYPE (value))
              || TREE_TYPE (decl) == TREE_TYPE (value)
              /* On ARM ctors return 'this'.  */
-             || (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
+             || (TYPE_PTR_P (TREE_TYPE (value))
                  && TREE_CODE (value) == CALL_EXPR)
              || useless_type_conversion_p (TREE_TYPE (decl),
                                            TREE_TYPE (value)));
@@ -1086,7 +1086,7 @@ cp_build_qualified_type_real (tree type,
      pointer-to-member-function type, because these will be distinct
      between the unqualified and qualified types.  */
   if (result != type
-      && TREE_CODE (type) == POINTER_TYPE
+      && TYPE_PTR_P (type)
       && TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE
       && TYPE_LANG_SPECIFIC (result) == TYPE_LANG_SPECIFIC (type))
     TYPE_LANG_SPECIFIC (result) = NULL;
@@ -1095,7 +1095,7 @@ cp_build_qualified_type_real (tree type,
      type of a pointer-to-method type, which could have the same
      sharing problem described above.  */
   if (TYPE_CANONICAL (result) != TYPE_CANONICAL (type)
-      && TREE_CODE (type) == POINTER_TYPE
+      && TYPE_PTR_P (type)
       && TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE
       && (TYPE_LANG_SPECIFIC (TYPE_CANONICAL (result)) 
           == TYPE_LANG_SPECIFIC (TYPE_CANONICAL (type))))
index 34263b716dda532649f2dd85cf66ba969792f765..7e2dcccac6b998052f793349dc33558201870078 100644 (file)
@@ -483,7 +483,7 @@ composite_pointer_type_r (tree t1, tree t2,
   tree attributes;
 
   /* Determine the types pointed to by T1 and T2.  */
-  if (TREE_CODE (t1) == POINTER_TYPE)
+  if (TYPE_PTR_P (t1))
     {
       pointee1 = TREE_TYPE (t1);
       pointee2 = TREE_TYPE (t2);
@@ -503,8 +503,7 @@ composite_pointer_type_r (tree t1, tree t2,
      types.  */
   if (same_type_ignoring_top_level_qualifiers_p (pointee1, pointee2))
     result_type = pointee1;
-  else if ((TREE_CODE (pointee1) == POINTER_TYPE
-           && TREE_CODE (pointee2) == POINTER_TYPE)
+  else if ((TYPE_PTR_P (pointee1) && TYPE_PTR_P (pointee2))
           || (TYPE_PTRMEM_P (pointee1) && TYPE_PTRMEM_P (pointee2)))
     {
       result_type = composite_pointer_type_r (pointee1, pointee2, operation,
@@ -581,7 +580,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
        and cv2.
 
     If either type is a pointer to void, make sure it is T1.  */
-  if (TREE_CODE (t2) == POINTER_TYPE && VOID_TYPE_P (TREE_TYPE (t2)))
+  if (TYPE_PTR_P (t2) && VOID_TYPE_P (TREE_TYPE (t2)))
     {
       tree t;
       t = t1;
@@ -590,7 +589,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
     }
 
   /* Now, if T1 is a pointer to void, merge the qualifiers.  */
-  if (TREE_CODE (t1) == POINTER_TYPE && VOID_TYPE_P (TREE_TYPE (t1)))
+  if (TYPE_PTR_P (t1) && VOID_TYPE_P (TREE_TYPE (t1)))
     {
       tree attributes;
       tree result_type;
@@ -628,8 +627,8 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
       return build_type_attribute_variant (result_type, attributes);
     }
 
-  if (c_dialect_objc () && TREE_CODE (t1) == POINTER_TYPE
-      && TREE_CODE (t2) == POINTER_TYPE)
+  if (c_dialect_objc () && TYPE_PTR_P (t1)
+      && TYPE_PTR_P (t2))
     {
       if (objc_have_common_type (t1, t2, -3, NULL_TREE))
        return objc_common_type (t1, t2);
@@ -637,7 +636,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
 
   /* [expr.eq] permits the application of a pointer conversion to
      bring the pointers to a common type.  */
-  if (TREE_CODE (t1) == POINTER_TYPE && TREE_CODE (t2) == POINTER_TYPE
+  if (TYPE_PTR_P (t1) && TYPE_PTR_P (t2)
       && CLASS_TYPE_P (TREE_TYPE (t1))
       && CLASS_TYPE_P (TREE_TYPE (t2))
       && !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (t1),
@@ -959,8 +958,7 @@ comp_except_types (tree a, tree b, bool exact)
       if (cp_type_quals (a) || cp_type_quals (b))
        return false;
 
-      if (TREE_CODE (a) == POINTER_TYPE
-         && TREE_CODE (b) == POINTER_TYPE)
+      if (TYPE_PTR_P (a) && TYPE_PTR_P (b))
        {
          a = TREE_TYPE (a);
          b = TREE_TYPE (b);
@@ -1553,7 +1551,7 @@ tree
 cxx_sizeof_nowarn (tree type)
 {
   if (TREE_CODE (type) == FUNCTION_TYPE
-      || TREE_CODE (type) == VOID_TYPE
+      || VOID_TYPE_P (type)
       || TREE_CODE (type) == ERROR_MARK)
     return size_one_node;
   else if (!COMPLETE_TYPE_P (type))
@@ -2069,7 +2067,7 @@ string_conv_p (const_tree totype, const_tree exp, int warn)
 {
   tree t;
 
-  if (TREE_CODE (totype) != POINTER_TYPE)
+  if (!TYPE_PTR_P (totype))
     return 0;
 
   t = TREE_TYPE (totype);
@@ -3091,7 +3089,7 @@ cp_build_array_ref (location_t loc, tree array, tree idx,
     if (ar == error_mark_node || ind == error_mark_node)
       return error_mark_node;
 
-    if (TREE_CODE (TREE_TYPE (ar)) != POINTER_TYPE)
+    if (!TYPE_PTR_P (TREE_TYPE (ar)))
       {
        if (complain & tf_error)
          error_at (loc, "subscripted value is neither array nor pointer");
@@ -3401,11 +3399,10 @@ cp_build_function_call_vec (tree function, vec<tree, va_gc> **params,
       return error_mark_node;
     }
 
-  is_method = (TREE_CODE (fntype) == POINTER_TYPE
+  is_method = (TYPE_PTR_P (fntype)
               && TREE_CODE (TREE_TYPE (fntype)) == METHOD_TYPE);
 
-  if (!((TREE_CODE (fntype) == POINTER_TYPE
-        && TREE_CODE (TREE_TYPE (fntype)) == FUNCTION_TYPE)
+  if (!(TYPE_PTRFN_P (fntype)
        || is_method
        || TREE_CODE (function) == TEMPLATE_ID_EXPR))
     {
@@ -4823,7 +4820,7 @@ pointer_diff (tree op0, tree op1, tree ptrtype, tsubst_flags_t complain)
   if (!complete_type_or_else (target_type, NULL_TREE))
     return error_mark_node;
 
-  if (TREE_CODE (target_type) == VOID_TYPE)
+  if (VOID_TYPE_P (target_type))
     {
       if (complain & tf_error)
        permerror (input_location, "ISO C++ forbids using pointer of "
@@ -5308,7 +5305,7 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain)
       val = build_address (arg);
     }
 
-  if (TREE_CODE (argtype) == POINTER_TYPE
+  if (TYPE_PTR_P (argtype)
       && TREE_CODE (TREE_TYPE (argtype)) == METHOD_TYPE)
     {
       build_ptrmemfunc_type (argtype);
@@ -5536,7 +5533,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
 
        /* Compute the increment.  */
 
-       if (TREE_CODE (argtype) == POINTER_TYPE)
+       if (TYPE_PTR_P (argtype))
          {
            tree type = complete_type (TREE_TYPE (argtype));
 
@@ -6244,7 +6241,7 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p,
   /* [expr.static.cast]
 
      Any expression can be explicitly converted to type cv void.  */
-  if (TREE_CODE (type) == VOID_TYPE)
+  if (VOID_TYPE_P (type))
     return convert_to_void (expr, ICV_CAST, complain);
 
   /* [class.abstract]
@@ -6366,7 +6363,7 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p,
      converted to a pointer to object type.  A value of type pointer
      to object converted to "pointer to cv void" and back to the
      original pointer type will have its original value.  */
-  if (TREE_CODE (intype) == POINTER_TYPE
+  if (TYPE_PTR_P (intype)
       && VOID_TYPE_P (TREE_TYPE (intype))
       && TYPE_PTROB_P (type))
     {
@@ -6886,7 +6883,7 @@ cp_build_c_cast (tree type, tree expr, tsubst_flags_t complain)
     {
       /* Allow casting from T1* to T2[] because Cfront allows it.
         NIHCL uses it. It is not valid ISO C++ however.  */
-      if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
+      if (TYPE_PTR_P (TREE_TYPE (expr)))
        {
           if (complain & tf_error)
             permerror (input_location, "ISO C++ forbids casting to an array type %qT", type);
@@ -6910,7 +6907,7 @@ cp_build_c_cast (tree type, tree expr, tsubst_flags_t complain)
       return error_mark_node;
     }
 
-  if (TREE_CODE (type) == POINTER_TYPE
+  if (TYPE_PTR_P (type)
       && TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE
       /* Casting to an integer of smaller size is an error detected elsewhere.  */
       && TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (value))
@@ -8420,7 +8417,7 @@ comp_ptr_ttypes_real (tree to, tree from, int constp)
       if (TREE_CODE (to) == VECTOR_TYPE)
        is_opaque_pointer = vector_targets_convertible_p (to, from);
 
-      if (TREE_CODE (to) != POINTER_TYPE && !TYPE_PTRDATAMEM_P (to))
+      if (!TYPE_PTR_P (to) && !TYPE_PTRDATAMEM_P (to))
        return ((constp >= 0 || to_more_cv_qualified)
                && (is_opaque_pointer
                    || same_type_ignoring_top_level_qualifiers_p (to, from)));
@@ -8484,9 +8481,9 @@ ptr_reasonably_similar (const_tree to, const_tree from)
   for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
     {
       /* Any target type is similar enough to void.  */
-      if (TREE_CODE (to) == VOID_TYPE)
+      if (VOID_TYPE_P (to))
        return !error_type_p (from);
-      if (TREE_CODE (from) == VOID_TYPE)
+      if (VOID_TYPE_P (from))
        return !error_type_p (to);
 
       if (TREE_CODE (to) != TREE_CODE (from))
@@ -8509,7 +8506,7 @@ ptr_reasonably_similar (const_tree to, const_tree from)
       if (TREE_CODE (to) == FUNCTION_TYPE)
        return !error_type_p (to) && !error_type_p (from);
 
-      if (TREE_CODE (to) != POINTER_TYPE)
+      if (!TYPE_PTR_P (to))
        return comptypes
          (TYPE_MAIN_VARIANT (to), TYPE_MAIN_VARIANT (from),
           COMPARE_BASE | COMPARE_DERIVED);
@@ -8538,7 +8535,7 @@ comp_ptr_ttypes_const (tree to, tree from)
       if (TREE_CODE (to) == VECTOR_TYPE)
        is_opaque_pointer = vector_targets_convertible_p (to, from);
 
-      if (TREE_CODE (to) != POINTER_TYPE)
+      if (!TYPE_PTR_P (to))
        return (is_opaque_pointer
                || same_type_ignoring_top_level_qualifiers_p (to, from));
     }
@@ -8758,8 +8755,7 @@ casts_away_constness (tree t1, tree t2, tsubst_flags_t complain)
 
   /* Casting away constness is only something that makes sense for
      pointer or reference types.  */
-  if (TREE_CODE (t1) != POINTER_TYPE
-      || TREE_CODE (t2) != POINTER_TYPE)
+  if (!TYPE_PTR_P (t1) || !TYPE_PTR_P (t2))
     return false;
 
   /* Top-level qualifiers don't matter.  */
@@ -8869,7 +8865,7 @@ check_literal_operator_args (const_tree decl,
          tree t = TREE_VALUE (argtype);
          ++arity;
 
-         if (TREE_CODE (t) == POINTER_TYPE)
+         if (TYPE_PTR_P (t))
            {
              bool maybe_raw_p = false;
              t = TREE_TYPE (t);
index e97bb3aee6cd851e3bcd1c1a148cd20858c53609..61ec4b58f64c1c8347745db2081cebf3f19816c6 100644 (file)
@@ -1585,7 +1585,7 @@ build_x_arrow (location_t loc, tree expr, tsubst_flags_t complain)
   else
     last_rval = decay_conversion (expr, complain);
 
-  if (TREE_CODE (TREE_TYPE (last_rval)) == POINTER_TYPE)
+  if (TYPE_PTR_P (TREE_TYPE (last_rval)))
     {
       if (processing_template_decl)
        {
@@ -1851,7 +1851,7 @@ add_exception_specifier (tree list, tree spec, int complain)
   /* [except.spec] 1, type in an exception specifier shall not be
      incomplete, or pointer or ref to incomplete other than pointer
      to cv void.  */
-  is_ptr = TREE_CODE (core) == POINTER_TYPE;
+  is_ptr = TYPE_PTR_P (core);
   if (is_ptr || TREE_CODE (core) == REFERENCE_TYPE)
     core = TREE_TYPE (core);
   if (complain < 0)