From patchwork Sat May 13 23:23:12 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: 93626 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6016004vqo; Sat, 13 May 2023 16:28:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7zpl43avT3iGvgvLJmodXUyRsYhf5XkOJytlePiCFz+4DQNIsY/cqUwzipYw5OK+hfcLL5 X-Received: by 2002:a17:907:9405:b0:957:12a6:a00f with SMTP id dk5-20020a170907940500b0095712a6a00fmr25945758ejc.21.1684020484360; Sat, 13 May 2023 16:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684020484; cv=none; d=google.com; s=arc-20160816; b=LFktz7m1ndfw1H5xAEXvxgGoKjIMDVV0z0lUZ4IjjIqGbIVs6jzeBM0YAEZIdEEC+A pCSoxLAKLnBl1NNxy1kSDyIN4Y88jwGnVPyDTe9BNpWqNld0GfwFBxMjRmTDTi5TJf62 IjZt6ePdUE6UWoHu0re23Fo37hl71CvPDMG3aawUbMNE73V6sjDq82YwsG1ZuUodB7Y9 cqQic6nDvSM8JRfOdDWjxedmZv3Jm0L9Ym3P2URYnrjuFLqAuoCtTAvRFcB3jwqxE/7y tC/8YCmwcHn+WkG6Sws0G2YOZVY+OYefERS+VoIl5kpCrcIj9BTFfQtre7ZIsGxH5Kot /LoQ== 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=ZJV79/3lv5TfRTFSHzAifChQkNPVQS2NIeTDn10EkD0=; b=Sc56ZaNqY9Q+14hx7ErMtJSjRj6zOcx2NmiXa81Z5r37CU6Anc4stY85Zj+5479Rhc /wBjD2yw9g8lAcIHm+qOZkvYL8HCnvyzB8RsarkmG7tNJyrFPh1U5aN5y8o1rf4NZ7Ml 8B6fPcTjWMNiNPZps7gaa0ch86FGxZnw/iW79pzSJe5lcByyfBUFh8qaTUqzyrKTac4v QUS9zn/kwrfJHCTmLnxkn9EHkSMBalWftcujzETrpq5xa6fumqeZRj3XKlcJWoIx3VQe F6cKHguOkXdXByqpbInmk5GGDMaZWhrx1u5NLrqaavvXfa7UjBRWVbl0vWQzEjP4s8Hr XrGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wDs6IwgJ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id k22-20020a1709063e1600b009659e77ef5dsi10109786eji.481.2023.05.13.16.28.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:28:04 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=wDs6IwgJ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 4DD2B3847809 for ; Sat, 13 May 2023 23:25:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DD2B3847809 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020354; bh=ZJV79/3lv5TfRTFSHzAifChQkNPVQS2NIeTDn10EkD0=; 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=wDs6IwgJ+MN1hQ3RzXoMpelxiH04ZRV4fKw7yo0pQ97G1HKNUqo43+MuPR6iNiejB /QiSgkn6gdLNUbjhwEn0WG40mPzjB8VDHPiwXzc/ZYa6n8/bTyicZuwKMVt16JCx9l jsUXtpc92ZPaqAjnUiUCeoB8/HZfnaz/IO5CjZuw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id 0AAF03858412; Sat, 13 May 2023 23:23:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0AAF03858412 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-50bc4ba28cbso20067125a12.0; Sat, 13 May 2023 16:23:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020231; x=1686612231; 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=ZJV79/3lv5TfRTFSHzAifChQkNPVQS2NIeTDn10EkD0=; b=G/yoE8hU/gPeLvKCmY/uYaGT3XxetgEUsUHFgD+oPqXr4GZJG6HvrNggOhEV8a01PW NXUDsWo8dMl06ObufRanyVP9f2aUvkDYL8DvW1lcHPyqdoZ6CItlkNLNc2iB03Zkwsfz +fM505Hg453YcdNCYn3bVRrZbmcOM73SNUh+7RhRuLjhjVTaZYbpAQ17HQgfcYdgM6VQ p/xR2z+dICoDK7mN34P7OkbINcVVpbLiM9aka+MA9Hsd+49Zlihdn0iDJXyXgx+jnK41 mUkdVsUg8i2+uZ6OfqUT+BDh4NRfjbVUQNq3Vo4Lu1vUBQz2PYDGPo4np779KRBP9ruv LVBg== X-Gm-Message-State: AC+VfDwzETa48AGuia7jOS0b2d7Mf6zKVUx/ACUwDRoYSNFxB/3QcZ8u Wt7Q9ZcsAyYOZrRFoUn0ietCjNJLxkI= X-Received: by 2002:a17:907:6d15:b0:96a:bfc:7335 with SMTP id sa21-20020a1709076d1500b0096a0bfc7335mr14535803ejc.53.1684020230993; Sat, 13 May 2023 16:23:50 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id ht7-20020a170907608700b0096a16e49b0fsm5744167ejc.51.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-001AmX-04; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 05/14] m2: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:12 +0200 Message-Id: <20230513232321.279733-6-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.1 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?1765823463214221553?= X-GMAIL-MSGID: =?utf-8?q?1765823463214221553?= From: Bernhard Reutner-Fischer gcc/m2/ChangeLog: * gm2-gcc/m2builtins.cc (doradix): Use _P defines from tree.h. (doplaces): Ditto. (doexponentmin): Ditto. (doexponentmax): Ditto. (dolarge): Ditto. (dosmall): Ditto. (dogUnderflow): Ditto. * gm2-gcc/m2convert.cc (unsafe_conversion_p): Ditto. * gm2-gcc/m2expr.cc (m2expr_build_unary_op_check): Ditto. (m2expr_build_binary_op_check): Ditto. * gm2-gcc/m2tree.cc (m2tree_is_var): Ditto. * gm2-gcc/m2treelib.cc (build_modify_expr): Ditto. * gm2-gcc/m2type.cc (gm2_finish_decl): Ditto. * m2pp.cc (hextree): Ditto. (m2pp_call_expr): Ditto. --- gcc/m2/gm2-gcc/m2builtins.cc | 14 +++++++------- gcc/m2/gm2-gcc/m2convert.cc | 8 ++++---- gcc/m2/gm2-gcc/m2expr.cc | 4 ++-- gcc/m2/gm2-gcc/m2tree.cc | 2 +- gcc/m2/gm2-gcc/m2treelib.cc | 2 +- gcc/m2/gm2-gcc/m2type.cc | 4 ++-- gcc/m2/m2pp.cc | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gcc/m2/gm2-gcc/m2builtins.cc b/gcc/m2/gm2-gcc/m2builtins.cc index 8d104c41a1e..3d13e2018d7 100644 --- a/gcc/m2/gm2-gcc/m2builtins.cc +++ b/gcc/m2/gm2-gcc/m2builtins.cc @@ -552,7 +552,7 @@ m2builtins_GetBuiltinTypeInfo (location_t location, tree type, static tree doradix (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { enum machine_mode mode = TYPE_MODE (type); int radix = REAL_MODE_FORMAT (mode)->b; @@ -568,7 +568,7 @@ doradix (location_t location ATTRIBUTE_UNUSED, tree type) static tree doplaces (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { /* Taken from c-family/c-cppbuiltin.cc. */ /* The number of decimal digits, q, such that any floating-point @@ -592,7 +592,7 @@ doplaces (location_t location ATTRIBUTE_UNUSED, tree type) static tree doexponentmin (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { enum machine_mode mode = TYPE_MODE (type); int emin = REAL_MODE_FORMAT (mode)->emin; @@ -607,7 +607,7 @@ doexponentmin (location_t location ATTRIBUTE_UNUSED, tree type) static tree doexponentmax (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { enum machine_mode mode = TYPE_MODE (type); int emax = REAL_MODE_FORMAT (mode)->emax; @@ -640,7 +640,7 @@ computeLarge (tree type) static tree dolarge (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) return computeLarge (type); return NULL_TREE; } @@ -667,7 +667,7 @@ computeSmall (tree type) static tree dosmall (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) return computeSmall (type); return NULL_TREE; } @@ -735,7 +735,7 @@ dorounds (location_t location ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED) static tree dogUnderflow (location_t location ATTRIBUTE_UNUSED, tree type) { - if (TREE_CODE (type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type)) { enum machine_mode mode = TYPE_MODE (type); const struct real_format *fmt = REAL_MODE_FORMAT (mode); diff --git a/gcc/m2/gm2-gcc/m2convert.cc b/gcc/m2/gm2-gcc/m2convert.cc index f806669dc39..5d35bcee239 100644 --- a/gcc/m2/gm2-gcc/m2convert.cc +++ b/gcc/m2/gm2-gcc/m2convert.cc @@ -91,7 +91,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns) /* Warn for real constant that is not an exact integer converted to integer type. */ - if (TREE_CODE (expr_type) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (expr_type) && TREE_CODE (type) == INTEGER_TYPE) { if (!real_isinteger (TREE_REAL_CST_PTR (expr), @@ -121,7 +121,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns) else give_warning = UNSAFE_OTHER; } - else if (TREE_CODE (type) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type)) { /* Warn for an integer constant that does not fit into real type. */ if (TREE_CODE (expr_type) == INTEGER_TYPE) @@ -133,7 +133,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns) /* Warn for a real constant that does not fit into a smaller real type. */ - else if (TREE_CODE (expr_type) == REAL_TYPE + else if (SCALAR_FLOAT_TYPE_P (expr_type) && TYPE_PRECISION (type) < TYPE_PRECISION (expr_type)) { REAL_VALUE_TYPE a = TREE_REAL_CST (expr); @@ -145,7 +145,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns) else { /* Warn for real types converted to integer types. */ - if (TREE_CODE (expr_type) == REAL_TYPE + if (SCALAR_FLOAT_TYPE_P (expr_type) && TREE_CODE (type) == INTEGER_TYPE) give_warning = UNSAFE_REAL; diff --git a/gcc/m2/gm2-gcc/m2expr.cc b/gcc/m2/gm2-gcc/m2expr.cc index e46d894d636..8021eb00671 100644 --- a/gcc/m2/gm2-gcc/m2expr.cc +++ b/gcc/m2/gm2-gcc/m2expr.cc @@ -1041,7 +1041,7 @@ m2expr_build_unary_op_check (location_t location, enum tree_code code, if (check != NULL) result = build2 (COMPOUND_EXPR, argtype, check, result); - if (TREE_CODE (argtype) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (argtype)) m2expr_checkRealOverflow (location, code, result); return m2expr_FoldAndStrip (result); @@ -2594,7 +2594,7 @@ m2expr_build_binary_op_check (location_t location, enum tree_code code, if (check != NULL) result = build2 (COMPOUND_EXPR, TREE_TYPE (result), check, result); - if (TREE_CODE (type1) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (type1)) m2expr_checkRealOverflow (location, code, result); return result; } diff --git a/gcc/m2/gm2-gcc/m2tree.cc b/gcc/m2/gm2-gcc/m2tree.cc index 0fc2fe57b63..99405123290 100644 --- a/gcc/m2/gm2-gcc/m2tree.cc +++ b/gcc/m2/gm2-gcc/m2tree.cc @@ -29,7 +29,7 @@ along with GNU Modula-2; see the file COPYING3. If not see bool m2tree_is_var (tree var) { - return TREE_CODE (var) == VAR_DECL; + return VAR_P (var); } bool diff --git a/gcc/m2/gm2-gcc/m2treelib.cc b/gcc/m2/gm2-gcc/m2treelib.cc index 9ec095d5284..6694af66d8b 100644 --- a/gcc/m2/gm2-gcc/m2treelib.cc +++ b/gcc/m2/gm2-gcc/m2treelib.cc @@ -99,7 +99,7 @@ build_modify_expr (location_t location, tree lhs, enum tree_code modifycode, if (TREE_CODE (lhs) == COMPONENT_REF && (TREE_CODE (lhstype) == INTEGER_TYPE || TREE_CODE (lhstype) == BOOLEAN_TYPE - || TREE_CODE (lhstype) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (lhstype) || TREE_CODE (lhstype) == ENUMERAL_TYPE)) lhstype = TREE_TYPE (get_unwidened (lhs, 0)); diff --git a/gcc/m2/gm2-gcc/m2type.cc b/gcc/m2/gm2-gcc/m2type.cc index 2808ddf8b8a..eeee3557c62 100644 --- a/gcc/m2/gm2-gcc/m2type.cc +++ b/gcc/m2/gm2-gcc/m2type.cc @@ -1247,7 +1247,7 @@ gm2_finish_decl (location_t location, tree decl) int was_incomplete = (DECL_SIZE (decl) == 0); m2assert_AssertLocation (location); - if (TREE_CODE (decl) == VAR_DECL) + if (VAR_P (decl)) { if (DECL_SIZE (decl) == 0 && TREE_TYPE (decl) != error_mark_node && COMPLETE_TYPE_P (TREE_TYPE (decl))) @@ -1278,7 +1278,7 @@ gm2_finish_decl (location_t location, tree decl) functions, unless the type is an undefined structure or union. If not, it will get done when the type is completed. */ - if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL) + if (VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL) { if (DECL_FILE_SCOPE_P (decl)) { diff --git a/gcc/m2/m2pp.cc b/gcc/m2/m2pp.cc index 21d1cb9dce7..52a29384e8d 100644 --- a/gcc/m2/m2pp.cc +++ b/gcc/m2/m2pp.cc @@ -579,7 +579,7 @@ hextree (tree t) hextree (DECL_INITIAL (t)); hextree (DECL_SAVED_TREE (t)); } - if (TREE_CODE (t) == VAR_DECL) + if (VAR_P (t)) { pretty *state = initPretty (FALSE); @@ -2364,7 +2364,7 @@ m2pp_call_expr (pretty *s, tree t) int has_return_type = TRUE; tree proc; - if (type && (TREE_CODE (type) == VOID_TYPE)) + if (type && VOID_TYPE_P (type)) has_return_type = FALSE; if (TREE_CODE (call) == ADDR_EXPR || TREE_CODE (call) == NON_LVALUE_EXPR)