From patchwork Sat May 13 23:23:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 93629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6016658vqo; Sat, 13 May 2023 16:30:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6MX6usRallmMnlw/WRCd3GFTyo339r10rTa485IRavq/hi7RDkd45bcYjRlfydDQ+G5Vr/ X-Received: by 2002:a17:907:701:b0:96a:26d2:53db with SMTP id xb1-20020a170907070100b0096a26d253dbmr11578239ejb.15.1684020623233; Sat, 13 May 2023 16:30:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684020623; cv=none; d=google.com; s=arc-20160816; b=HA8loo2DzHKoRlyJv6zMUVKcG2RuOyQth5p9TZQXE16W6oZcEnc5zy5IxhXMGRnD3h bkCyb+wYdDpcV+PAwucU9nRCIJdpst007wMXuJfm6+cBuUGZEWvEclSC0drwPu1+lIGZ JeR3VvxC44Xg1ODlyVI5ajO/uZ0Tjo8axz3XKWUvZnX0j+2CbonZ4ft58ooZyOz6WjeM FX0RC+41ZPteTdEmBTuCknlF5FELwRfDR8S/Z84hEQ2Y+cEwYoTMpFURnJnJvIygupq7 4bAcFkw6qTO9d3g9lLChW3LNRkOFVMWvSGreFXJ88mCVlZ9+jJfiUgEn6kKcScQO34pz 4wxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=yLu0kXyAOJJ1pQ25ErBb/1cLOiZ7g6j2yLFhlKUKbdw=; b=ikrUP/yY8kub282sU9+YAbpQRkaLaG/3uC3pdlUPm1pySF9rmeKM9zs4G0u23xn/Jx /tFeLDyBvXOoUPmmIOXyB4W9mkfHo6H0FoTNDB4XMZ5mo7sx/RQW/LY3wmFek+rq1Gb7 4r11Cqsg+Np9wWe1oPR2s+HQRecTL73kBOtdIDArPqItYbSVwz9IfkMg/bCnoTcO5531 lqbuWHLPo9McB+3JORqYjmPkv5LV/pE5G792j6e3iakbNesyp/Aj67oXwTuKhFCNnNa8 0QMUQzQJqzZC4hQMOUm/ch6Fvx2audt5WZv2a9tzG1gLwxIHDAEe61kQKPJhHT6EXUAM T3VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=y45stgHt; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e5-20020a170906844500b00969ffde8db7si9135836ejy.278.2023.05.13.16.30.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:30:23 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=y45stgHt; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9F3583888C45 for ; Sat, 13 May 2023 23:26:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F3583888C45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020410; bh=yLu0kXyAOJJ1pQ25ErBb/1cLOiZ7g6j2yLFhlKUKbdw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=y45stgHthIKf8HciiGVsua/4TyD/DXG07NKdanj0RUI4rvz9JdosAHux+DLXxB53F lnkmnm7s3WxDhsEr+gJiGZrXjEpUL4N8WAWSV+UM2rQkAFd3yIPSIuAHZY6XugBAWb CyUxTbif9WdvednstlJGWkAfos0PzcgKGBKf5KpI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id ACB5E3858416; Sat, 13 May 2023 23:23:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ACB5E3858416 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-50bcae898b2so20000775a12.0; Sat, 13 May 2023 16:23:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020235; x=1686612235; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yLu0kXyAOJJ1pQ25ErBb/1cLOiZ7g6j2yLFhlKUKbdw=; b=X+1z65aWdJoxIlUsn5X0sKwyhUJTk2mMsbhQz0BM4mEaYc7MMXGz39bwad7IAVklqA 8GAhrGb5T1uu5rE0X9trDzmQJkzgJEUW2h7ji0bC5VzcDx1HIqPjSS3udbWGd6xgxMUw yEfpsZojmc9LVijBRkpVem0+Im18Iyhx4UWg2FIuWChd01uh3oWB7rFgr2fl5sJ6mdI1 XeXoCsA4BQYgScuerq3AdNnU691D4mg0JavXI2sAr2F7OCSBr7v4ZPhCYEBx+JyKihZ7 Z3qk9O/waWcGBPwf8dYpB7zCEU4RBWThrdxTn+Rag4VekhBsLen5iEdCc4Y3tTY39afp OZ7g== X-Gm-Message-State: AC+VfDwyQUxe4rSGKfFaJrjeE0OyF//HzVBxtJp30EZ5em51PqQB2ALW al5RtKMnxx/Z/83wauYqbiCmwYmugPM= X-Received: by 2002:a17:907:789:b0:965:fd71:f1d6 with SMTP id xd9-20020a170907078900b00965fd71f1d6mr24138547ejb.16.1684020234637; Sat, 13 May 2023 16:23:54 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id la17-20020a170907781100b00957dad777c1sm7311606ejc.107.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001AmT-00; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 04/14] c++: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:11 +0200 Message-Id: <20230513232321.279733-5-rep.dot.nop@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230513232321.279733-1-rep.dot.nop@gmail.com> References: <20230513232321.279733-1-rep.dot.nop@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Bernhard Reutner-Fischer via Gcc-patches From: Bernhard Reutner-Fischer Reply-To: Bernhard Reutner-Fischer Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765823608877903113?= X-GMAIL-MSGID: =?utf-8?q?1765823608877903113?= From: Bernhard Reutner-Fischer gcc/cp/ChangeLog: * call.cc (promoted_arithmetic_type_p): Use _P defines from tree.h. (build_conditional_expr): Ditto. (convert_like_internal): Ditto. (convert_arg_to_ellipsis): Ditto. (build_over_call): Ditto. (compare_ics): Ditto. * class.cc (is_empty_base_ref): Ditto. * coroutines.cc (rewrite_param_uses): Ditto. * cp-tree.h (DECL_DISCRIMINATOR_P): Ditto. (ARITHMETIC_TYPE_P): Ditto. * cvt.cc (ocp_convert): Ditto. * cxx-pretty-print.cc (pp_cxx_template_argument_list): Ditto. * decl.cc (layout_var_decl): Ditto. (get_tuple_size): Ditto. * error.cc (dump_simple_decl): Ditto. * lambda.cc (start_lambda_scope): Ditto. * mangle.cc (write_template_arg): Ditto. * method.cc (spaceship_comp_cat): Ditto. * module.cc (node_template_info): Ditto. (trees_out::start): Ditto. (trees_out::decl_node): Ditto. (trees_in::read_var_def): Ditto. (set_instantiating_module): Ditto. * name-lookup.cc (maybe_record_mergeable_decl): Ditto. (consider_decl): Ditto. (maybe_add_fuzzy_decl): Ditto. * pt.cc (convert_nontype_argument): Ditto. * semantics.cc (handle_omp_array_sections_1): Ditto. (finish_omp_clauses): Ditto. (finish_omp_target_clauses_r): Ditto. (is_this_parameter): Ditto. * tree.cc (build_cplus_array_type): Ditto. (is_this_expression): Ditto. * typeck.cc (do_warn_enum_conversions): Ditto. * typeck2.cc (store_init_value): Ditto. (check_narrowing): Ditto. --- gcc/cp/call.cc | 42 +++++++++++++++++++------------------- gcc/cp/class.cc | 2 +- gcc/cp/coroutines.cc | 2 +- gcc/cp/cp-tree.h | 4 ++-- gcc/cp/cvt.cc | 2 +- gcc/cp/cxx-pretty-print.cc | 2 +- gcc/cp/decl.cc | 4 ++-- gcc/cp/error.cc | 2 +- gcc/cp/lambda.cc | 2 +- gcc/cp/mangle.cc | 2 +- gcc/cp/method.cc | 2 +- gcc/cp/module.cc | 12 +++++------ gcc/cp/name-lookup.cc | 6 +++--- gcc/cp/pt.cc | 2 +- gcc/cp/semantics.cc | 24 +++++++++++----------- gcc/cp/tree.cc | 4 ++-- gcc/cp/typeck.cc | 4 ++-- gcc/cp/typeck2.cc | 10 ++++----- 18 files changed, 64 insertions(+), 64 deletions(-) diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 2a06520c0c1..6e13d17f6b8 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -2746,7 +2746,7 @@ promoted_arithmetic_type_p (tree type) integral types plus floating types. */ return ((CP_INTEGRAL_TYPE_P (type) && same_type_p (type_promotes_to (type), type)) - || TREE_CODE (type) == REAL_TYPE); + || SCALAR_FLOAT_TYPE_P (type)); } /* Create any builtin operator overload candidates for the operator in @@ -5759,10 +5759,10 @@ build_conditional_expr (const op_location_t &loc, if ((TREE_CODE (arg2) == EXCESS_PRECISION_EXPR || TREE_CODE (arg3) == EXCESS_PRECISION_EXPR) && (TREE_CODE (arg2_type) == INTEGER_TYPE - || TREE_CODE (arg2_type) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (arg2_type) || TREE_CODE (arg2_type) == COMPLEX_TYPE) && (TREE_CODE (arg3_type) == INTEGER_TYPE - || TREE_CODE (arg3_type) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (arg3_type) || TREE_CODE (arg3_type) == COMPLEX_TYPE)) { semantic_result_type @@ -5775,8 +5775,8 @@ build_conditional_expr (const op_location_t &loc, t1 = TREE_TYPE (t1); if (TREE_CODE (t2) == COMPLEX_TYPE) t2 = TREE_TYPE (t2); - gcc_checking_assert (TREE_CODE (t1) == REAL_TYPE - && TREE_CODE (t2) == REAL_TYPE + gcc_checking_assert (SCALAR_FLOAT_TYPE_P (t1) + && SCALAR_FLOAT_TYPE_P (t2) && (extended_float_type_p (t1) || extended_float_type_p (t2)) && cp_compare_floating_point_conversion_ranks @@ -6127,8 +6127,8 @@ build_conditional_expr (const op_location_t &loc, t1 = TREE_TYPE (t1); if (TREE_CODE (t2) == COMPLEX_TYPE) t2 = TREE_TYPE (t2); - gcc_checking_assert (TREE_CODE (t1) == REAL_TYPE - && TREE_CODE (t2) == REAL_TYPE + gcc_checking_assert (SCALAR_FLOAT_TYPE_P (t1) + && SCALAR_FLOAT_TYPE_P (t2) && (extended_float_type_p (t1) || extended_float_type_p (t2)) && cp_compare_floating_point_conversion_ranks @@ -6147,8 +6147,8 @@ build_conditional_expr (const op_location_t &loc, t1 = TREE_TYPE (t1); if (TREE_CODE (t2) == COMPLEX_TYPE) t2 = TREE_TYPE (t2); - gcc_checking_assert (TREE_CODE (t1) == REAL_TYPE - && TREE_CODE (t2) == REAL_TYPE + gcc_checking_assert (SCALAR_FLOAT_TYPE_P (t1) + && SCALAR_FLOAT_TYPE_P (t2) && (extended_float_type_p (t1) || extended_float_type_p (t2)) && cp_compare_floating_point_conversion_ranks @@ -6185,8 +6185,8 @@ build_conditional_expr (const op_location_t &loc, else if ((complain & tf_warning) && warn_deprecated_enum_float_conv && ((TREE_CODE (arg2_type) == ENUMERAL_TYPE - && TREE_CODE (arg3_type) == REAL_TYPE) - || (TREE_CODE (arg2_type) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (arg3_type)) + || (SCALAR_FLOAT_TYPE_P (arg2_type) && TREE_CODE (arg3_type) == ENUMERAL_TYPE))) { if (TREE_CODE (arg2_type) == ENUMERAL_TYPE) @@ -8321,8 +8321,8 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum, "direct-initialization", totype, TREE_TYPE (expr)); - if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE - && TREE_CODE (totype) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (expr)) + && SCALAR_FLOAT_TYPE_P (totype) && (extended_float_type_p (TREE_TYPE (expr)) || extended_float_type_p (totype))) switch (cp_compare_floating_point_conversion_ranks (TREE_TYPE (expr), @@ -8976,7 +8976,7 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain) type that is subject to the floating-point promotion (_conv.fpprom_), the value of the argument is converted to the promoted type before the call. */ - if (TREE_CODE (arg_type) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (arg_type) && (TYPE_PRECISION (arg_type) < TYPE_PRECISION (double_type_node)) && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (arg_type)) @@ -9798,7 +9798,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) obj_arg = NULL_TREE; } /* Look through *(const T *)&obj. */ - else if (obj_arg && TREE_CODE (obj_arg) == INDIRECT_REF) + else if (obj_arg && INDIRECT_REF_P (obj_arg)) { tree addr = TREE_OPERAND (obj_arg, 0); STRIP_NOPS (addr); @@ -10462,7 +10462,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) obj_arg = NULL_TREE; } /* Look through *(const T *)&obj. */ - else if (obj_arg && TREE_CODE (obj_arg) == INDIRECT_REF) + else if (obj_arg && INDIRECT_REF_P (obj_arg)) { tree addr = TREE_OPERAND (obj_arg, 0); STRIP_NOPS (addr); @@ -12199,7 +12199,7 @@ compare_ics (conversion *ics1, conversion *ics2) std::swap (fp3, t3); } if (TYPE_MAIN_VARIANT (fp1) == TYPE_MAIN_VARIANT (fp3) - && TREE_CODE (fp1) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (fp1) /* Only apply this rule if at least one of the 3 types is extended floating-point type, otherwise keep them as before for compatibility reasons with types like __float128. @@ -12207,15 +12207,15 @@ compare_ics (conversion *ics1, conversion *ics2) ranks and so when just those 3 types are involved, this rule doesn't trigger. */ && (extended_float_type_p (fp1) - || (TREE_CODE (fp2) == REAL_TYPE && extended_float_type_p (fp2)) - || (TREE_CODE (t3) == REAL_TYPE && extended_float_type_p (t3)))) + || (SCALAR_FLOAT_TYPE_P (fp2) && extended_float_type_p (fp2)) + || (SCALAR_FLOAT_TYPE_P (t3) && extended_float_type_p (t3)))) { if (TREE_CODE (fp2) != REAL_TYPE) { ret = -ret; std::swap (fp2, t3); } - if (TREE_CODE (fp2) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (fp2)) { /* cp_compare_floating_point_conversion_ranks returns -1, 0 or 1 if the conversion rank is equal (-1 or 1 if the subrank is @@ -12242,7 +12242,7 @@ compare_ics (conversion *ics1, conversion *ics2) FP1 <-> T3 conversion is better. */ return -ret; } - else if (TREE_CODE (t3) == REAL_TYPE + else if (SCALAR_FLOAT_TYPE_P (t3) && IN_RANGE (cp_compare_floating_point_conversion_ranks (fp1, t3), -1, 1)) diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc index 68b62086340..bc84f4f731a 100644 --- a/gcc/cp/class.cc +++ b/gcc/cp/class.cc @@ -673,7 +673,7 @@ convert_to_base_statically (tree expr, tree base) bool is_empty_base_ref (tree expr) { - if (TREE_CODE (expr) == INDIRECT_REF) + if (INDIRECT_REF_P (expr)) expr = TREE_OPERAND (expr, 0); if (TREE_CODE (expr) != NOP_EXPR) return false; diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index 59a240ebd40..3493d3c6ed3 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -3780,7 +3780,7 @@ rewrite_param_uses (tree *stmt, int *do_subtree ATTRIBUTE_UNUSED, void *d) param_frame_data *data = (param_frame_data *) d; /* For lambda closure content, we have to look specifically. */ - if (TREE_CODE (*stmt) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*stmt)) + if (VAR_P (*stmt) && DECL_HAS_VALUE_EXPR_P (*stmt)) { tree t = DECL_VALUE_EXPR (*stmt); return cp_walk_tree (&t, rewrite_param_uses, d, NULL); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 714b6d55f4f..a1b882f11fe 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3189,7 +3189,7 @@ struct GTY(()) lang_decl { /* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */ #define DECL_DISCRIMINATOR_P(NODE) \ - (((TREE_CODE (NODE) == VAR_DECL && TREE_STATIC (NODE)) \ + (((VAR_P (NODE) && TREE_STATIC (NODE)) \ || DECL_IMPLICIT_TYPEDEF_P (NODE)) \ && DECL_FUNCTION_SCOPE_P (NODE)) @@ -4453,7 +4453,7 @@ get_vec_init_expr (tree t) Keep these checks in ascending code order. */ #define ARITHMETIC_TYPE_P(TYPE) \ (CP_INTEGRAL_TYPE_P (TYPE) \ - || TREE_CODE (TYPE) == REAL_TYPE \ + || SCALAR_FLOAT_TYPE_P (TYPE) \ || TREE_CODE (TYPE) == COMPLEX_TYPE) /* [basic.types] diff --git a/gcc/cp/cvt.cc b/gcc/cp/cvt.cc index 17827d06a4a..c6b52f07050 100644 --- a/gcc/cp/cvt.cc +++ b/gcc/cp/cvt.cc @@ -810,7 +810,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags, /* enum = enum, enum = int, enum = float, (enum)pointer are all errors. */ if (((INTEGRAL_OR_ENUMERATION_TYPE_P (intype) - || TREE_CODE (intype) == REAL_TYPE) + || SCALAR_FLOAT_TYPE_P (intype)) && ! (convtype & CONV_STATIC)) || TYPE_PTR_P (intype)) { diff --git a/gcc/cp/cxx-pretty-print.cc b/gcc/cp/cxx-pretty-print.cc index 4b547c77ef4..909a9dc917f 100644 --- a/gcc/cp/cxx-pretty-print.cc +++ b/gcc/cp/cxx-pretty-print.cc @@ -1966,7 +1966,7 @@ pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t) if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL && TYPE_P (DECL_TEMPLATE_RESULT (arg)))) pp->type_id (arg); - else if (TREE_CODE (arg) == VAR_DECL && DECL_NTTP_OBJECT_P (arg)) + else if (VAR_P (arg) && DECL_NTTP_OBJECT_P (arg)) pp->expression (DECL_INITIAL (arg)); else pp->expression (arg); diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 23a2b2fef0b..a672e4844f1 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -6349,7 +6349,7 @@ layout_var_decl (tree decl) && !vec_safe_is_empty (CONSTRUCTOR_ELTS (DECL_INITIAL (decl))) && DECL_SIZE (decl) != NULL_TREE && TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST - && TYPE_SIZE (type) != NULL_TREE + && COMPLETE_TYPE_P (type) && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST && tree_int_cst_equal (DECL_SIZE (decl), TYPE_SIZE (type))) { @@ -8927,7 +8927,7 @@ get_tuple_size (tree type) return NULL_TREE; tree val = lookup_qualified_name (inst, value_identifier, LOOK_want::NORMAL, /*complain*/false); - if (TREE_CODE (val) == VAR_DECL || TREE_CODE (val) == CONST_DECL) + if (VAR_P (val) || TREE_CODE (val) == CONST_DECL) val = maybe_constant_value (val); if (TREE_CODE (val) == INTEGER_CST) return val; diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 9b967ce409d..31319aa9e87 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -1140,7 +1140,7 @@ dump_global_iord (cxx_pretty_printer *pp, tree t) static void dump_simple_decl (cxx_pretty_printer *pp, tree t, tree type, int flags) { - if (TREE_CODE (t) == VAR_DECL && DECL_NTTP_OBJECT_P (t)) + if (VAR_P (t) && DECL_NTTP_OBJECT_P (t)) return dump_expr (pp, DECL_INITIAL (t), flags); if (flags & TFF_DECL_SPECIFIERS) diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc index 9925209b2ed..a359bc6ee8d 100644 --- a/gcc/cp/lambda.cc +++ b/gcc/cp/lambda.cc @@ -1474,7 +1474,7 @@ void start_lambda_scope (tree decl) { gcc_checking_assert (decl); - if (current_function_decl && TREE_CODE (decl) == VAR_DECL) + if (current_function_decl && VAR_P (decl)) // If we're inside a function, we ignore variable scope. Don't push. lambda_scope.nesting++; else diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc index a235f23459d..826c5e76c1d 100644 --- a/gcc/cp/mangle.cc +++ b/gcc/cp/mangle.cc @@ -3793,7 +3793,7 @@ write_template_arg (tree node) } } - if (TREE_CODE (node) == VAR_DECL && DECL_NTTP_OBJECT_P (node)) + if (VAR_P (node) && DECL_NTTP_OBJECT_P (node)) /* We want to mangle the argument, not the var we stored it in. */ node = tparm_object_argument (node); diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc index 00eae56eb5b..cbcc7948b37 100644 --- a/gcc/cp/method.cc +++ b/gcc/cp/method.cc @@ -1048,7 +1048,7 @@ spaceship_comp_cat (tree optype) { if (INTEGRAL_OR_ENUMERATION_TYPE_P (optype) || TYPE_PTROBV_P (optype)) return cc_strong_ordering; - else if (TREE_CODE (optype) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (optype)) return cc_partial_ordering; /* ??? should vector <=> produce a vector of one of the above? */ diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index ac2fe66b080..ecde98d69b4 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -4042,7 +4042,7 @@ node_template_info (tree decl, int &use) } } else if (DECL_LANG_SPECIFIC (decl) - && (TREE_CODE (decl) == VAR_DECL + && (VAR_P (decl) || TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == FIELD_DECL @@ -5151,7 +5151,7 @@ trees_out::start (tree t, bool code_streamed) switch (TREE_CODE (t)) { default: - if (TREE_CODE_CLASS (TREE_CODE (t)) == tcc_vl_exp) + if (VL_EXP_CLASS_P (t)) u (VL_EXP_OPERAND_LENGTH (t)); break; @@ -8551,7 +8551,7 @@ trees_out::decl_node (tree decl, walk_kind ref) { tinfo: /* A typeinfo, tt_tinfo_typedef or tt_tinfo_var. */ - bool is_var = TREE_CODE (decl) == VAR_DECL; + bool is_var = VAR_P (decl); tree type = TREE_TYPE (decl); unsigned ix = get_pseudo_tinfo_index (type); if (streaming_p ()) @@ -8651,7 +8651,7 @@ trees_out::decl_node (tree decl, walk_kind ref) Mostly things that can be defined outside of their (original declaration) context. */ gcc_checking_assert (TREE_CODE (decl) == TEMPLATE_DECL - || TREE_CODE (decl) == VAR_DECL + || VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == USING_DECL @@ -11702,7 +11702,7 @@ bool trees_in::read_var_def (tree decl, tree maybe_template) { /* Do not mark the virtual table entries as used. */ - bool vtable = TREE_CODE (decl) == VAR_DECL && DECL_VTABLE_OR_VTT_P (decl); + bool vtable = VAR_P (decl) && DECL_VTABLE_OR_VTT_P (decl); unused += vtable; tree init = tree_node (); tree dyn_init = init ? NULL_TREE : tree_node (); @@ -18776,7 +18776,7 @@ void set_instantiating_module (tree decl) { gcc_assert (TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == VAR_DECL + || VAR_P (decl) || TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == CONCEPT_DECL || TREE_CODE (decl) == TEMPLATE_DECL diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index ad03141df43..eb5c333b5ea 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -3488,7 +3488,7 @@ maybe_record_mergeable_decl (tree *slot, tree name, tree decl) tree not_tmpl = STRIP_TEMPLATE (decl); if ((TREE_CODE (not_tmpl) == FUNCTION_DECL - || TREE_CODE (not_tmpl) == VAR_DECL) + || VAR_P (not_tmpl)) && DECL_THIS_STATIC (not_tmpl)) /* Internal linkage. */ return; @@ -6932,7 +6932,7 @@ consider_decl (tree decl, best_match &bm, { /* Skip compiler-generated variables (e.g. __for_begin/__for_end within range for). */ - if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl)) + if (VAR_P (decl) && DECL_ARTIFICIAL (decl)) return; tree suggestion = DECL_NAME (decl); @@ -6967,7 +6967,7 @@ maybe_add_fuzzy_decl (auto_vec &vec, tree decl) { /* Skip compiler-generated variables (e.g. __for_begin/__for_end within range for). */ - if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl)) + if (VAR_P (decl) && DECL_ARTIFICIAL (decl)) return false; tree suggestion = DECL_NAME (decl); diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 696df2bdd9f..16d658e3c6a 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -7487,7 +7487,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) integral promotions (_conv.prom_) and integral conversions (_conv.integral_) are applied. */ if (INTEGRAL_OR_ENUMERATION_TYPE_P (type) - || TREE_CODE (type) == REAL_TYPE) + || SCALAR_FLOAT_TYPE_P (type)) { if (cxx_dialect < cxx11) { diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 13c6582b628..05df6282302 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -5169,7 +5169,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec &types, && TREE_CODE (TREE_OPERAND (t, 0)) == COMPONENT_REF) t = TREE_OPERAND (t, 0); ret = t; - while (TREE_CODE (t) == INDIRECT_REF) + while (INDIRECT_REF_P (t)) { t = TREE_OPERAND (t, 0); STRIP_NOPS (t); @@ -5206,7 +5206,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec &types, } t = TREE_OPERAND (t, 0); while (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF + || INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); @@ -8097,7 +8097,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) if (REFERENCE_REF_P (t)) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF) + || INDIRECT_REF_P (t)) { t = TREE_OPERAND (t, 0); STRIP_NOPS (t); @@ -8182,7 +8182,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ATTACH_DETACH) OMP_CLAUSE_DECL (c) = t; } - while (TREE_CODE (t) == INDIRECT_REF + while (INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); @@ -8201,7 +8201,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) remove = true; indir_component_ref_p = false; if (TREE_CODE (t) == COMPONENT_REF - && (TREE_CODE (TREE_OPERAND (t, 0)) == INDIRECT_REF + && (INDIRECT_REF_P (TREE_OPERAND (t, 0)) || TREE_CODE (TREE_OPERAND (t, 0)) == ARRAY_REF)) { t = TREE_OPERAND (TREE_OPERAND (t, 0), 0); @@ -8255,7 +8255,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) t = TREE_OPERAND (t, 0); } while (TREE_CODE (t) == MEM_REF - || TREE_CODE (t) == INDIRECT_REF + || INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) { t = TREE_OPERAND (t, 0); @@ -8706,7 +8706,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) t = OMP_CLAUSE_DECL (c); while (TREE_CODE (t) == TREE_LIST) t = TREE_CHAIN (t); - while (TREE_CODE (t) == INDIRECT_REF + while (INDIRECT_REF_P (t) || TREE_CODE (t) == ARRAY_REF) t = TREE_OPERAND (t, 0); } @@ -9021,7 +9021,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) { t = OMP_CLAUSE_DECL (c); while (handled_component_p (t) - || TREE_CODE (t) == INDIRECT_REF + || INDIRECT_REF_P (t) || TREE_CODE (t) == ADDR_EXPR || TREE_CODE (t) == MEM_REF || TREE_CODE (t) == NON_LVALUE_EXPR) @@ -9070,7 +9070,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) if (TREE_CODE (t) == POINTER_PLUS_EXPR) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == ADDR_EXPR - || TREE_CODE (t) == INDIRECT_REF) + || INDIRECT_REF_P (t)) t = TREE_OPERAND (t, 0); if (DECL_P (t)) bitmap_clear_bit (&aligned_head, DECL_UID (t)); @@ -9609,7 +9609,7 @@ finish_omp_target_clauses_r (tree *tp, int *walk_subtrees, void *ptr) of DECL_VALUE_EXPRs during the target body walk seems the only way to find them. */ if (current_closure - && (TREE_CODE (t) == VAR_DECL + && (VAR_P (t) || TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL) && DECL_HAS_VALUE_EXPR_P (t) @@ -12362,8 +12362,8 @@ is_this_parameter (tree t) if (!DECL_P (t) || DECL_NAME (t) != this_identifier) return false; gcc_assert (TREE_CODE (t) == PARM_DECL - || (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t)) - || (cp_binding_oracle && TREE_CODE (t) == VAR_DECL)); + || (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t)) + || (cp_binding_oracle && VAR_P (t))); return true; } diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index 131b212ff73..19dfb3ed782 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -1173,7 +1173,7 @@ build_cplus_array_type (tree elt_type, tree index_type, int dependent) } /* Avoid spurious warnings with VLAs (c++/54583). */ - if (TYPE_SIZE (t) && EXPR_P (TYPE_SIZE (t))) + if (CAN_HAVE_LOCATION_P (TYPE_SIZE (t))) suppress_warning (TYPE_SIZE (t), OPT_Wunused); /* Push these needs up to the ARRAY_TYPE so that initialization takes @@ -3911,7 +3911,7 @@ is_this_expression (tree t) { t = get_innermost_component (t); /* See through deferences and no-op conversions. */ - if (TREE_CODE (t) == INDIRECT_REF) + if (INDIRECT_REF_P (t)) t = TREE_OPERAND (t, 0); if (TREE_CODE (t) == NOP_EXPR) t = TREE_OPERAND (t, 0); diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index 53ac925a092..a4ceb8a1703 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -4996,8 +4996,8 @@ do_warn_enum_conversions (location_t loc, enum tree_code code, tree type0, } } else if ((TREE_CODE (type0) == ENUMERAL_TYPE - && TREE_CODE (type1) == REAL_TYPE) - || (TREE_CODE (type0) == REAL_TYPE + && SCALAR_FLOAT_TYPE_P (type1)) + || (SCALAR_FLOAT_TYPE_P (type0) && TREE_CODE (type1) == ENUMERAL_TYPE)) { const bool enum_first_p = TREE_CODE (type0) == ENUMERAL_TYPE; diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc index bf03967a71f..6affdc73fb1 100644 --- a/gcc/cp/typeck2.cc +++ b/gcc/cp/typeck2.cc @@ -907,7 +907,7 @@ store_init_value (tree decl, tree init, vec** cleanups, int flags) here it should have been digested into an actual value for the type. */ gcc_checking_assert (TREE_CODE (value) != CONSTRUCTOR || processing_template_decl - || TREE_CODE (type) == VECTOR_TYPE + || VECTOR_TYPE_P (type) || !TREE_HAS_CONSTRUCTOR (value)); /* If the initializer is not a constant, fill in DECL_INITIAL with @@ -974,7 +974,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain, return ok; if (CP_INTEGRAL_TYPE_P (type) - && TREE_CODE (ftype) == REAL_TYPE) + && SCALAR_FLOAT_TYPE_P (ftype)) ok = false; else if (INTEGRAL_OR_ENUMERATION_TYPE_P (ftype) && CP_INTEGRAL_TYPE_P (type)) @@ -992,8 +992,8 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain, } /* [dcl.init.list]#7.2: "from long double to double or float, or from double to float". */ - else if (TREE_CODE (ftype) == REAL_TYPE - && TREE_CODE (type) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (ftype) + && SCALAR_FLOAT_TYPE_P (type)) { if ((extended_float_type_p (ftype) || extended_float_type_p (type)) ? /* "from a floating-point type T to another floating-point type @@ -1030,7 +1030,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain, } } else if (INTEGRAL_OR_ENUMERATION_TYPE_P (ftype) - && TREE_CODE (type) == REAL_TYPE) + && SCALAR_FLOAT_TYPE_P (type)) { ok = false; if (TREE_CODE (init) == INTEGER_CST)