From patchwork Tue May 22 11:42:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 918212 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-478152-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="qnTVar20"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40qv0h3wdnz9s70 for ; Tue, 22 May 2018 21:43:15 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=xRsJZSGyj6QqZVIWnBK0T/ljxVCwv3gKqonwEBx84qB56berJD jeWnJCbmAfmx37Pzzq9Pw/LJs7JifTThFDqIZXdkCgnNje3UUTXeqkadcnMhM25s A8Vu0Z8SjICkHdRW7oagSY5Xb3LrVKgeR8XHDaH1EHKZ/zs0FAal3SFXA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=o7OYbU9feyHLm+b1ImjIOYoGS5s=; b=qnTVar20HH9dRfcXfghD NDt1TxQwjfk91Jxtbkuo8sBbRc+Q8Fb2d8svCdeh6jnsXCF1XGRWwT+igfNK4LnE +OxqL7Zfu9jS5Rn9q6H4uf7MRGNhK0E1uX/2WfoDXblezoQkq3v6dCEYD/SeS3N9 vrHl1QKfH/hnGrEVBTvYsmo= Received: (qmail 7827 invoked by alias); 22 May 2018 11:43:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 7780 invoked by uid 89); 22 May 2018 11:43:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=massage X-HELO: aserp2120.oracle.com Received: from aserp2120.oracle.com (HELO aserp2120.oracle.com) (141.146.126.78) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 May 2018 11:43:00 +0000 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4MBfOZB191771; Tue, 22 May 2018 11:42:58 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2j2bw88207-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 May 2018 11:42:58 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4MBgvA7030563 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 May 2018 11:42:57 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w4MBguQj002146; Tue, 22 May 2018 11:42:56 GMT Received: from [192.168.1.4] (/95.235.218.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 22 May 2018 04:42:55 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] Add INDIRECT_TYPE_P Message-ID: <8d8ab4dc-cc30-1c4b-0c40-d7a5e578d577@oracle.com> Date: Tue, 22 May 2018 13:42:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8900 signatures=668700 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805220138 X-IsSubscribed: yes Hi, so this is the patch only adding INDIRECT_TYPE_P to the C++ front-end and using it instead of the misleading POINTER_TYPE_P. It also replaces a couple of existing TYPE_PTR_P || TYPE_REF_P. Poisoning at the same time POINTER_TYPE_P in the front-end - via #pragma GCC poison - seems tricky, because we can't just do it in cp-tree.h: tree.c includes at the end the generated gt-cp-tree.h which in turn uses POINTER_TYPE_P. I don't know if we want to try really hard to do that at the same time... Tested x86_64-linux. Thanks, Paolo. ///////////////// 2018-05-22 Paolo Carlini * cp-tree.h (INDIRECT_TYPE_P): New. * call.c (build_trivial_dtor_call, maybe_warn_class_memaccess, joust): Use it instead of POINTER_TYPE_P. * class.c (update_vtable_entry_for_fn, find_flexarrays, * fixed_type_or_null, resolves_to_fixed_type_p): Likewise. * constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref, * cxx_eval_increment_expression, potential_constant_expression_1): Likewise. * cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise. * cp-objcp-common.c (cxx_get_alias_set): Likewise. * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call, cp_ubsan_maybe_instrument_downcast): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert, cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise. * cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator, pp_cxx_offsetof_expression_1): Likewise. * decl.c (grokparms, static_fn_type): Likewise. * decl2.c (grokbitfield): Likewise. * error.c (dump_expr): Likewise. * except.c (initialize_handler_parm, check_noexcept_r): Likewise. * init.c (warn_placement_new_too_small): Likewise. * lambda.c (build_capture_proxy, add_capture): Likewise. * parser.c (cp_parser_omp_for_loop): Likewise. * pt.c (convert_nontype_argument, fn_type_unification, uses_deducible_template_parms, check_cv_quals_for_unify, dependent_type_p_r): Likewise. * search.c (check_final_overrider): Likewise. * semantics.c (handle_omp_array_sections, finish_omp_clauses, finish_omp_for): Likewise. * tree.c (cp_build_qualified_type_real): Likewise. * typeck.c (build_class_member_access_expr, finish_class_member_access_expr, build_x_indirect_ref, cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1): Likewise. Index: call.c =================================================================== --- call.c (revision 260499) +++ call.c (working copy) @@ -7622,7 +7622,7 @@ build_trivial_dtor_call (tree instance) return fold_convert (void_type_node, instance); } - if (POINTER_TYPE_P (TREE_TYPE (instance))) + if (INDIRECT_TYPE_P (TREE_TYPE (instance))) { if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (instance)))) goto no_clobber; @@ -8511,7 +8511,7 @@ maybe_warn_class_memaccess (location_t loc, tree f unsigned srcidx = !dstidx; tree dest = (*args)[dstidx]; - if (!TREE_TYPE (dest) || !POINTER_TYPE_P (TREE_TYPE (dest))) + if (!TREE_TYPE (dest) || !INDIRECT_TYPE_P (TREE_TYPE (dest))) return; tree srctype = NULL_TREE; @@ -8643,7 +8643,7 @@ maybe_warn_class_memaccess (location_t loc, tree f case BUILT_IN_MEMPCPY: /* Determine the type of the source object. */ srctype = TREE_TYPE ((*args)[srcidx]); - if (!srctype || !POINTER_TYPE_P (srctype)) + if (!srctype || !INDIRECT_TYPE_P (srctype)) srctype = void_type_node; else srctype = TREE_TYPE (srctype); @@ -10210,7 +10210,7 @@ joust (struct z_candidate *cand1, struct z_candida tree t = TREE_TYPE (TREE_TYPE (l->fn)); tree f = TREE_TYPE (TREE_TYPE (w->fn)); - if (TREE_CODE (t) == TREE_CODE (f) && POINTER_TYPE_P (t)) + if (TREE_CODE (t) == TREE_CODE (f) && INDIRECT_TYPE_P (t)) { t = TREE_TYPE (t); f = TREE_TYPE (f); @@ -10226,7 +10226,7 @@ joust (struct z_candidate *cand1, struct z_candida else if (warn) { tree source = source_type (w->convs[0]); - if (POINTER_TYPE_P (source)) + if (INDIRECT_TYPE_P (source)) source = TREE_TYPE (source); if (warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn) && warning (OPT_Wconversion, " for conversion from %qH to %qI", Index: class.c =================================================================== --- class.c (revision 260499) +++ class.c (working copy) @@ -2445,7 +2445,7 @@ update_vtable_entry_for_fn (tree t, tree binfo, tr over_return = TREE_TYPE (TREE_TYPE (overrider_target)); base_return = TREE_TYPE (TREE_TYPE (target_fn)); - if (POINTER_TYPE_P (over_return) + if (INDIRECT_TYPE_P (over_return) && TREE_CODE (over_return) == TREE_CODE (base_return) && CLASS_TYPE_P (TREE_TYPE (over_return)) && CLASS_TYPE_P (TREE_TYPE (base_return)) @@ -6481,8 +6481,7 @@ find_flexarrays (tree t, flexmems_t *fmem, bool ba members if it hasn't been yet. */ tree eltype = fldtype; while (TREE_CODE (eltype) == ARRAY_TYPE - || TYPE_PTR_P (eltype) - || TYPE_REF_P (eltype)) + || INDIRECT_TYPE_P (eltype)) eltype = TREE_TYPE (eltype); if (RECORD_OR_UNION_TYPE_P (eltype)) @@ -7144,7 +7143,7 @@ fixed_type_or_null (tree instance, int *nonnull, i switch (TREE_CODE (instance)) { case INDIRECT_REF: - if (POINTER_TYPE_P (TREE_TYPE (instance))) + if (INDIRECT_TYPE_P (TREE_TYPE (instance))) return NULL_TREE; else return RECUR (TREE_OPERAND (instance, 0)); @@ -7314,7 +7313,7 @@ resolves_to_fixed_type_p (tree instance, int* nonn fixed = fixed_type_or_null (instance, nonnull, &cdtorp); if (fixed == NULL_TREE) return 0; - if (POINTER_TYPE_P (t)) + if (INDIRECT_TYPE_P (t)) t = TREE_TYPE (t); if (!same_type_ignoring_top_level_qualifiers_p (t, fixed)) return 0; Index: constexpr.c =================================================================== --- constexpr.c (revision 260499) +++ constexpr.c (working copy) @@ -2088,7 +2088,7 @@ cxx_eval_binary_expression (const constexpr_ctx *c *non_constant_p = true; /* Don't VERIFY_CONSTANT if this might be dealing with a pointer to a local array in a constexpr function. */ - bool ptr = POINTER_TYPE_P (TREE_TYPE (lhs)); + bool ptr = INDIRECT_TYPE_P (TREE_TYPE (lhs)); if (!ptr) VERIFY_CONSTANT (r); return r; @@ -3082,7 +3082,7 @@ cxx_fold_indirect_ref (location_t loc, tree type, STRIP_NOPS (sub); subtype = TREE_TYPE (sub); - if (!POINTER_TYPE_P (subtype)) + if (!INDIRECT_TYPE_P (subtype)) return NULL_TREE; if (TREE_CODE (sub) == ADDR_EXPR) @@ -3784,7 +3784,7 @@ cxx_eval_increment_expression (const constexpr_ctx non_constant_p, overflow_p); /* Don't VERIFY_CONSTANT if this might be dealing with a pointer to a local array in a constexpr function. */ - bool ptr = POINTER_TYPE_P (TREE_TYPE (val)); + bool ptr = INDIRECT_TYPE_P (TREE_TYPE (val)); if (!ptr) VERIFY_CONSTANT (val); @@ -3791,7 +3791,7 @@ cxx_eval_increment_expression (const constexpr_ctx /* The modified value. */ bool inc = (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR); tree mod; - if (POINTER_TYPE_P (type)) + if (INDIRECT_TYPE_P (type)) { /* The middle end requires pointers to use POINTER_PLUS_EXPR. */ offset = convert_to_ptrofftype (offset); @@ -4613,7 +4613,7 @@ cxx_eval_constant_expression (const constexpr_ctx return cp_fold_convert (type, op); } - if (POINTER_TYPE_P (type) && TREE_CODE (op) == INTEGER_CST) + if (INDIRECT_TYPE_P (type) && TREE_CODE (op) == INTEGER_CST) { if (integer_zerop (op)) { @@ -5499,7 +5499,7 @@ potential_constant_expression_1 (tree t, bool want may change to something more specific to type-punning (DR 1312). */ { tree from = TREE_OPERAND (t, 0); - if (POINTER_TYPE_P (TREE_TYPE (t)) + if (INDIRECT_TYPE_P (TREE_TYPE (t)) && TREE_CODE (from) == INTEGER_CST && !integer_zerop (from)) { Index: cp-gimplify.c =================================================================== --- cp-gimplify.c (revision 260499) +++ cp-gimplify.c (working copy) @@ -783,7 +783,7 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, { /* If flag_strong_eval_order, evaluate the object argument first. */ tree fntype = TREE_TYPE (CALL_EXPR_FN (*expr_p)); - if (POINTER_TYPE_P (fntype)) + if (INDIRECT_TYPE_P (fntype)) fntype = TREE_TYPE (fntype); if (TREE_CODE (fntype) == METHOD_TYPE) { @@ -1499,7 +1499,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, tree fn = CALL_EXPR_FN (stmt); if (fn != NULL_TREE && !error_operand_p (fn) - && POINTER_TYPE_P (TREE_TYPE (fn)) + && INDIRECT_TYPE_P (TREE_TYPE (fn)) && TREE_CODE (TREE_TYPE (TREE_TYPE (fn))) == METHOD_TYPE) { bool is_ctor Index: cp-objcp-common.c =================================================================== --- cp-objcp-common.c (revision 260499) +++ cp-objcp-common.c (working copy) @@ -37,7 +37,7 @@ cxx_get_alias_set (tree t) /* Punt on PMFs until we canonicalize functions properly. */ if (TYPE_PTRMEMFUNC_P (t) - || (POINTER_TYPE_P (t) + || (INDIRECT_TYPE_P (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))) return 0; Index: cp-tree.h =================================================================== --- cp-tree.h (revision 260499) +++ cp-tree.h (working copy) @@ -4237,6 +4237,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_a #define TYPE_REF_P(NODE) \ (TREE_CODE (NODE) == REFERENCE_TYPE) +/* Returns true if NODE is a pointer or a reference. */ +#define INDIRECT_TYPE_P(NODE) \ + (TYPE_PTR_P (NODE) || TYPE_REF_P (NODE)) + /* Returns true if NODE is an object type: [basic.types] Index: cp-ubsan.c =================================================================== --- cp-ubsan.c (revision 260499) +++ cp-ubsan.c (working copy) @@ -121,7 +121,7 @@ cp_ubsan_maybe_instrument_member_call (tree stmt) tree *opp = &CALL_EXPR_ARG (stmt, 0); tree op = *opp; if (op == error_mark_node - || !POINTER_TYPE_P (TREE_TYPE (op))) + || !INDIRECT_TYPE_P (TREE_TYPE (op))) return; while (TREE_CODE (op) == COMPOUND_EXPR) { @@ -257,9 +257,9 @@ tree cp_ubsan_maybe_instrument_downcast (location_t loc, tree type, tree intype, tree op) { - if (!POINTER_TYPE_P (type) - || !POINTER_TYPE_P (intype) - || !POINTER_TYPE_P (TREE_TYPE (op)) + if (!INDIRECT_TYPE_P (type) + || !INDIRECT_TYPE_P (intype) + || !INDIRECT_TYPE_P (TREE_TYPE (op)) || !CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (op))) || !is_properly_derived_from (TREE_TYPE (type), TREE_TYPE (intype))) return NULL_TREE; Index: cvt.c =================================================================== --- cvt.c (revision 260499) +++ cvt.c (working copy) @@ -122,7 +122,7 @@ cp_convert_to_pointer (tree type, tree expr, bool form = TREE_CODE (intype); - if (POINTER_TYPE_P (intype)) + if (INDIRECT_TYPE_P (intype)) { intype = TYPE_MAIN_VARIANT (intype); @@ -841,7 +841,7 @@ ocp_convert (tree type, tree expr, int convtype, i /* Ignore any integer overflow caused by the conversion. */ return ignore_overflows (converted, e); } - if (POINTER_TYPE_P (type) || TYPE_PTRMEM_P (type)) + if (INDIRECT_TYPE_P (type) || TYPE_PTRMEM_P (type)) return cp_convert_to_pointer (type, e, dofold, complain); if (code == VECTOR_TYPE) { @@ -961,7 +961,7 @@ cp_get_fndecl_from_callee (tree fn, bool fold /* = tree type = TREE_TYPE (fn); if (type == unknown_type_node) return NULL_TREE; - gcc_assert (POINTER_TYPE_P (type)); + gcc_assert (INDIRECT_TYPE_P (type)); if (fold) fn = maybe_constant_init (fn); STRIP_NOPS (fn); @@ -1008,7 +1008,7 @@ maybe_warn_nodiscard (tree expr, impl_conv_void im tree type = TREE_TYPE (callee); if (TYPE_PTRMEMFUNC_P (type)) type = TYPE_PTRMEMFUNC_FN_TYPE (type); - if (POINTER_TYPE_P (type)) + if (INDIRECT_TYPE_P (type)) type = TREE_TYPE (type); tree rettype = TREE_TYPE (type); @@ -1601,7 +1601,7 @@ convert (tree type, tree expr) intype = TREE_TYPE (expr); - if (POINTER_TYPE_P (type) && POINTER_TYPE_P (intype)) + if (INDIRECT_TYPE_P (type) && INDIRECT_TYPE_P (intype)) return build_nop (type, expr); return ocp_convert (type, expr, CONV_BACKEND_CONVERT, Index: cxx-pretty-print.c =================================================================== --- cxx-pretty-print.c (revision 260499) +++ cxx-pretty-print.c (working copy) @@ -1702,7 +1702,7 @@ cxx_pretty_printer::abstract_declarator (tree t) { if (TYPE_PTRMEM_P (t)) pp_cxx_right_paren (this); - else if (POINTER_TYPE_P (t)) + else if (INDIRECT_TYPE_P (t)) { if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE) @@ -2395,7 +2395,7 @@ pp_cxx_offsetof_expression_1 (cxx_pretty_printer * { case ARROW_EXPR: if (TREE_CODE (TREE_OPERAND (t, 0)) == STATIC_CAST_EXPR - && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (t, 0)))) + && INDIRECT_TYPE_P (TREE_TYPE (TREE_OPERAND (t, 0)))) { pp->type_id (TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 0)))); pp_cxx_separate_with (pp, ','); Index: decl.c =================================================================== --- decl.c (revision 260499) +++ decl.c (working copy) @@ -12783,7 +12783,7 @@ grokparms (tree parmlist, tree *parms) } else if (abstract_virtuals_error (decl, type)) any_error = 1; /* Seems like a good idea. */ - else if (cxx_dialect < cxx17 && POINTER_TYPE_P (type)) + else if (cxx_dialect < cxx17 && INDIRECT_TYPE_P (type)) { /* Before C++17 DR 393: [dcl.fct]/6, parameter types cannot contain pointers @@ -16138,7 +16138,7 @@ static_fn_type (tree memfntype) if (TYPE_PTRMEMFUNC_P (memfntype)) memfntype = TYPE_PTRMEMFUNC_FN_TYPE (memfntype); - if (POINTER_TYPE_P (memfntype) + if (INDIRECT_TYPE_P (memfntype) || TREE_CODE (memfntype) == FUNCTION_DECL) memfntype = TREE_TYPE (memfntype); if (TREE_CODE (memfntype) == FUNCTION_TYPE) Index: decl2.c =================================================================== --- decl2.c (revision 260499) +++ decl2.c (working copy) @@ -1032,7 +1032,7 @@ grokbitfield (const cp_declarator *declarator, return void_type_node; if (!INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (value)) - && (POINTER_TYPE_P (value) + && (INDIRECT_TYPE_P (value) || !dependent_type_p (TREE_TYPE (value)))) { error ("bit-field %qD with non-integral type", value); Index: error.c =================================================================== --- error.c (revision 260499) +++ error.c (working copy) @@ -2412,8 +2412,8 @@ dump_expr (cxx_pretty_printer *pp, tree t, int fla tree optype = TREE_TYPE (op); if (TREE_CODE (ttype) != TREE_CODE (optype) - && POINTER_TYPE_P (ttype) - && POINTER_TYPE_P (optype) + && INDIRECT_TYPE_P (ttype) + && INDIRECT_TYPE_P (optype) && same_type_p (TREE_TYPE (optype), TREE_TYPE (ttype))) { Index: except.c =================================================================== --- except.c (revision 260499) +++ except.c (working copy) @@ -301,7 +301,7 @@ initialize_handler_parm (tree decl, tree exp) adjusted by value from __cxa_begin_catch. Others are returned by reference. */ init_type = TREE_TYPE (decl); - if (!POINTER_TYPE_P (init_type)) + if (!INDIRECT_TYPE_P (init_type)) init_type = build_reference_type (init_type); /* Since pointers are passed by value, initialize a reference to @@ -1024,7 +1024,7 @@ check_noexcept_r (tree *tp, int * /*walk_subtrees* We could use TREE_NOTHROW (t) for !TREE_PUBLIC fns, though... */ tree fn = cp_get_callee (t); tree type = TREE_TYPE (fn); - gcc_assert (POINTER_TYPE_P (type)); + gcc_assert (INDIRECT_TYPE_P (type)); type = TREE_TYPE (type); STRIP_NOPS (fn); Index: init.c =================================================================== --- init.c (revision 260499) +++ init.c (working copy) @@ -2600,7 +2600,7 @@ warn_placement_new_too_small (tree type, tree nelt } tree opertype = TREE_TYPE (oper); - if ((addr_expr || !POINTER_TYPE_P (opertype)) + if ((addr_expr || !INDIRECT_TYPE_P (opertype)) && (VAR_P (oper) || TREE_CODE (oper) == FIELD_DECL || TREE_CODE (oper) == PARM_DECL)) Index: lambda.c =================================================================== --- lambda.c (revision 260499) +++ lambda.c (working copy) @@ -411,7 +411,7 @@ build_capture_proxy (tree member, tree init) type = lambda_proxy_type (object); - if (name == this_identifier && !POINTER_TYPE_P (type)) + if (name == this_identifier && !INDIRECT_TYPE_P (type)) { type = build_pointer_type (type); type = cp_build_qualified_type (type, TYPE_QUAL_CONST); @@ -571,7 +571,7 @@ add_capture (tree lambda, tree id, tree orig_init, if (id == this_identifier && !by_reference_p) { - gcc_assert (POINTER_TYPE_P (type)); + gcc_assert (INDIRECT_TYPE_P (type)); type = TREE_TYPE (type); initializer = cp_build_fold_indirect_ref (initializer); } Index: parser.c =================================================================== --- parser.c (revision 260499) +++ parser.c (working copy) @@ -35280,7 +35280,7 @@ cp_parser_omp_for_loop (cp_parser *parser, enum tr if (real_decl && ((processing_template_decl && (TREE_TYPE (real_decl) == NULL_TREE - || !POINTER_TYPE_P (TREE_TYPE (real_decl)))) + || !INDIRECT_TYPE_P (TREE_TYPE (real_decl)))) || CLASS_TYPE_P (TREE_TYPE (real_decl)))) incr = cp_parser_omp_for_incr (parser, real_decl); else Index: pt.c =================================================================== --- pt.c (revision 260499) +++ pt.c (working copy) @@ -6831,7 +6831,7 @@ convert_nontype_argument (tree type, tree expr, ts "a variable", orig_expr, expr); return NULL_TREE; } - if (POINTER_TYPE_P (expr_type)) + if (INDIRECT_TYPE_P (expr_type)) { if (complain & tf_error) error ("%qE is not a valid template argument for %qT " @@ -19546,7 +19546,7 @@ fn_type_unification (tree fn, { /* We're deducing for a call to the result of a template conversion function. The parms we really want are in return_type. */ - if (POINTER_TYPE_P (return_type)) + if (INDIRECT_TYPE_P (return_type)) return_type = TREE_TYPE (return_type); parms = TYPE_ARG_TYPES (return_type); } @@ -19926,7 +19926,7 @@ uses_deducible_template_parms (tree type) /* T* T& T&& */ - if (POINTER_TYPE_P (type)) + if (INDIRECT_TYPE_P (type)) return uses_deducible_template_parms (TREE_TYPE (type)); /* T[integer-constant ] @@ -20943,7 +20943,7 @@ check_cv_quals_for_unify (int strict, tree arg, tr && (parm_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE))) return 0; - if ((!POINTER_TYPE_P (arg) && TREE_CODE (arg) != TEMPLATE_TYPE_PARM) + if ((!INDIRECT_TYPE_P (arg) && TREE_CODE (arg) != TEMPLATE_TYPE_PARM) && (parm_quals & TYPE_QUAL_RESTRICT)) return 0; } @@ -24469,8 +24469,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 (TYPE_PTR_P (type) - || TYPE_REF_P (type)) + else if (INDIRECT_TYPE_P (type)) return dependent_type_p (TREE_TYPE (type)); else if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE) Index: search.c =================================================================== --- search.c (revision 260499) +++ search.c (working copy) @@ -1868,12 +1868,12 @@ check_final_overrider (tree overrider, tree basefn /* OK */; else if ((CLASS_TYPE_P (over_return) && CLASS_TYPE_P (base_return)) || (TREE_CODE (base_return) == TREE_CODE (over_return) - && POINTER_TYPE_P (base_return))) + && INDIRECT_TYPE_P (base_return))) { /* Potentially covariant. */ unsigned base_quals, over_quals; - fail = !POINTER_TYPE_P (base_return); + fail = !INDIRECT_TYPE_P (base_return); if (!fail) { fail = cp_type_quals (base_return) != cp_type_quals (over_return); Index: semantics.c =================================================================== --- semantics.c (revision 260499) +++ semantics.c (working copy) @@ -4998,7 +4998,7 @@ handle_omp_array_sections (tree c, enum c_omp_regi tree type = build_array_type (eltype, index_type); tree ptype = build_pointer_type (eltype); if (TYPE_REF_P (TREE_TYPE (t)) - && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (t)))) + && INDIRECT_TYPE_P (TREE_TYPE (TREE_TYPE (t)))) t = convert_from_reference (t); else if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE) t = build_fold_addr_expr (t); @@ -5073,7 +5073,7 @@ handle_omp_array_sections (tree c, enum c_omp_regi ptrdiff_type_node, t); tree ptr = OMP_CLAUSE_DECL (c2); ptr = convert_from_reference (ptr); - if (!POINTER_TYPE_P (TREE_TYPE (ptr))) + if (!INDIRECT_TYPE_P (TREE_TYPE (ptr))) ptr = build_fold_addr_expr (ptr); t = fold_build2_loc (OMP_CLAUSE_LOCATION (c), MINUS_EXPR, ptrdiff_type_node, t, @@ -5085,7 +5085,7 @@ handle_omp_array_sections (tree c, enum c_omp_regi ptr = OMP_CLAUSE_DECL (c2); if (OMP_CLAUSE_MAP_KIND (c2) != GOMP_MAP_FIRSTPRIVATE_POINTER && TYPE_REF_P (TREE_TYPE (ptr)) - && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (ptr)))) + && INDIRECT_TYPE_P (TREE_TYPE (TREE_TYPE (ptr)))) { tree c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP); @@ -6534,7 +6534,7 @@ finish_omp_clauses (tree clauses, enum c_omp_regio && !TYPE_PTR_P (TREE_TYPE (t)) && TREE_CODE (TREE_TYPE (t)) != ARRAY_TYPE && (!TYPE_REF_P (TREE_TYPE (t)) - || (!POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (t))) + || (!INDIRECT_TYPE_P (TREE_TYPE (TREE_TYPE (t))) && (TREE_CODE (TREE_TYPE (TREE_TYPE (t))) != ARRAY_TYPE)))) { @@ -6787,7 +6787,7 @@ finish_omp_clauses (tree clauses, enum c_omp_regio else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FORCE_DEVICEPTR && !type_dependent_expression_p (t) - && !POINTER_TYPE_P (TREE_TYPE (t))) + && !INDIRECT_TYPE_P (TREE_TYPE (t))) { error ("%qD is not a pointer variable", t); remove = true; @@ -8280,7 +8280,7 @@ finish_omp_for (location_t locus, enum tree_code c case POSTINCREMENT_EXPR: /* c_omp_for_incr_canonicalize_ptr() should have been called to massage things appropriately. */ - gcc_assert (!POINTER_TYPE_P (TREE_TYPE (decl))); + gcc_assert (!INDIRECT_TYPE_P (TREE_TYPE (decl))); OMP_CLAUSE_LINEAR_STEP (c) = build_int_cst (TREE_TYPE (decl), 1); break; case PREDECREMENT_EXPR: @@ -8287,7 +8287,7 @@ finish_omp_for (location_t locus, enum tree_code c case POSTDECREMENT_EXPR: /* c_omp_for_incr_canonicalize_ptr() should have been called to massage things appropriately. */ - gcc_assert (!POINTER_TYPE_P (TREE_TYPE (decl))); + gcc_assert (!INDIRECT_TYPE_P (TREE_TYPE (decl))); OMP_CLAUSE_LINEAR_STEP (c) = build_int_cst (TREE_TYPE (decl), -1); break; @@ -8311,7 +8311,7 @@ finish_omp_for (location_t locus, enum tree_code c gcc_unreachable (); } stept = TREE_TYPE (decl); - if (POINTER_TYPE_P (stept)) + if (INDIRECT_TYPE_P (stept)) stept = sizetype; step = fold_convert (stept, step); if (TREE_CODE (incr) == MINUS_EXPR) Index: tree.c =================================================================== --- tree.c (revision 260499) +++ tree.c (working copy) @@ -1278,7 +1278,7 @@ cp_build_qualified_type_real (tree type, if ((type_quals & TYPE_QUAL_RESTRICT) && TREE_CODE (type) != TEMPLATE_TYPE_PARM && TREE_CODE (type) != TYPENAME_TYPE - && !POINTER_TYPE_P (type)) + && !INDIRECT_TYPE_P (type)) { bad_quals |= TYPE_QUAL_RESTRICT; type_quals &= ~TYPE_QUAL_RESTRICT; Index: typeck.c =================================================================== --- typeck.c (revision 260499) +++ typeck.c (working copy) @@ -2363,7 +2363,7 @@ build_class_member_access_expr (cp_expr object, tr { if (complain & tf_error) { - if (POINTER_TYPE_P (object_type) + if (INDIRECT_TYPE_P (object_type) && CLASS_TYPE_P (TREE_TYPE (object_type))) error ("request for member %qD in %qE, which is of pointer " "type %qT (maybe you meant to use %<->%> ?)", @@ -2804,7 +2804,7 @@ finish_class_member_access_expr (cp_expr object, t { if (complain & tf_error) { - if (POINTER_TYPE_P (object_type) + if (INDIRECT_TYPE_P (object_type) && CLASS_TYPE_P (TREE_TYPE (object_type))) error ("request for member %qD in %qE, which is of pointer " "type %qT (maybe you meant to use %<->%> ?)", @@ -3079,7 +3079,7 @@ build_x_indirect_ref (location_t loc, tree expr, r if (processing_template_decl) { /* Retain the type if we know the operand is a pointer. */ - if (TREE_TYPE (expr) && POINTER_TYPE_P (TREE_TYPE (expr))) + if (TREE_TYPE (expr) && INDIRECT_TYPE_P (TREE_TYPE (expr))) return build_min (INDIRECT_REF, TREE_TYPE (TREE_TYPE (expr)), expr); if (type_dependent_expression_p (expr)) return build_min_nt_loc (loc, INDIRECT_REF, expr); @@ -3130,7 +3130,7 @@ cp_build_indirect_ref_1 (tree ptr, ref_operator er type = TREE_TYPE (pointer); - if (POINTER_TYPE_P (type)) + if (INDIRECT_TYPE_P (type)) { /* [expr.unary.op] @@ -4456,7 +4456,7 @@ cp_build_binary_op (location_t location, type0 = TREE_TYPE (type0); if (!TYPE_P (type1)) type1 = TREE_TYPE (type1); - if (POINTER_TYPE_P (type0) && same_type_p (TREE_TYPE (type0), type1) + if (INDIRECT_TYPE_P (type0) && same_type_p (TREE_TYPE (type0), type1) && !(TREE_CODE (first_arg) == PARM_DECL && DECL_ARRAY_PARAMETER_P (first_arg) && warn_sizeof_array_argument) @@ -7549,7 +7549,7 @@ build_const_cast_1 (tree dst_type, tree expr, tsub if (valid_p) *valid_p = false; - if (!POINTER_TYPE_P (dst_type) && !TYPE_PTRDATAMEM_P (dst_type)) + if (!INDIRECT_TYPE_P (dst_type) && !TYPE_PTRDATAMEM_P (dst_type)) { if (complain & tf_error) error ("invalid use of const_cast with type %qT, "