From patchwork Sat May 13 23:23:19 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: 93624 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6015887vqo; Sat, 13 May 2023 16:27:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6UI2fNIKXv0K+h9CGnL9lvxcGrGlWcYL3fZ6KRg9rSfasFAn2o9NlsFY683XdNdyD1/i9Z X-Received: by 2002:a17:906:4fd6:b0:94e:116:8581 with SMTP id i22-20020a1709064fd600b0094e01168581mr28900546ejw.5.1684020459684; Sat, 13 May 2023 16:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684020459; cv=none; d=google.com; s=arc-20160816; b=OaagWaJBPa276zZ7sVCSyZ0RpTUtyB0aBo6AzxfhmEKi8xww9vy7V6gnGtwX/o2U78 jcUyZmNMhCc/dTKlyaFRIWCFcXg2UOIHBcUQAi7MIzq4+TPLFyKtRaqTDU5IPRbGZ/Ip cngbwbHwdJUsp+MWEojR4mY/rYOAVJFyuSWXJ43pffoqnkWptKajowWxghNamGo4CO8u vl0oPvdURzcTL7309LuEp9rn7pCy/OabNGvF9nu+BB4B6CRlna2xpZpzorLZ98JeL16w P189YUD+Ak5ndnB0a1UpLxHUJcliohGkAE03cIPNiYPKKH4sXGePhyk60m18b8f68QK7 /TAQ== 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=lcgcGderMCLlnyMkN1MUhO2uI+89Y9qIEMeAHXpzNcI=; b=ablZaeT+aJLDJj8TDUQsQzNAFUJOUI1jolC6a5Uuk6xrLSgX2LC5wElhsy9KIXAI4x HYiY3RXtaxNNoKRZaBrP+ZASkVn+Dn7wTfJS03RDx0+w+Kxbo/krSP2Dwbmz34ZiQBnE lfkDXYb7u6qCYT+XWL2toeSwQ6tqKw2ckLzrc9diEhHvEa/EOZQtLKyzL0aCE/7YtL0p RzM7q8Wnrbwlkr4jDRQKIA+SXvUpBxtZ/M1IqDlm0/HtdDC4FOM/nQpkIkXoLBNo7K1m ZmKeipWSDVvBvrTMyxjOBbmfoRmp93pH/VT8J2rcjBROi6DFkU0gmQcxJri3FHyyRGFL JP0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=UZg4Yke5; 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 ty17-20020a170907c71100b009664a15f62asi10452240ejc.385.2023.05.13.16.27.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:27:39 -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=UZg4Yke5; 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 CD32E385DC20 for ; Sat, 13 May 2023 23:25:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD32E385DC20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020342; bh=lcgcGderMCLlnyMkN1MUhO2uI+89Y9qIEMeAHXpzNcI=; 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=UZg4Yke5+6riExKNm+4usa1M2pCm4oTXTKaOXoJnqGe/Igml6kK/VkatobJBxkSHu 5jqIausP8XrXRi3Hxd1XhQFBdYFLX5DZuK2l4/UPzN59gIddOvdX4VP3uyBQ8XsL3E uOEt6zqPaMJUZhZWPeo16wzay8tU3+ajmrQGdiMQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id E78323858431; Sat, 13 May 2023 23:23:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E78323858431 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-50be17a1eceso21153277a12.2; Sat, 13 May 2023 16:23:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020233; x=1686612233; 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=lcgcGderMCLlnyMkN1MUhO2uI+89Y9qIEMeAHXpzNcI=; b=YOMTutvDfwUJpqR3qOZOVHmgXZQdcygekavQcFpqN2oL/kDtRX6zidKQnZRgwwADNo KJl1CfgABl3qyj8G9IpRZ+VqTL5sdBrQinoyPzXFYrfVuioggvIVAyhTPNo8bYDjUXlZ Mfj6orV7/olcVzOGtk0UBou4B6W9UnRF1elji/ZCSnUvhkPe8wpheWPx+8lYNEP47ybH tlt096eebudVCmQCHPp2egzkfFKFKNSp+FF7UPF1w+0Kh/LfldNENRzi7CXOG503h7Q+ yDXwrdZO8eEdYw7vSVTtDBMV6kWcJ9GvoOwq+7GiauZRlBe+o0Nlx5sdqftp2dar35Gp x4DA== X-Gm-Message-State: AC+VfDxmeLGIHti4teL3FHAKmO13g3QzX1Gu0uiybjre9No7dDgUvH2U JpSHPYxekDHJwvQ2sUP4kv9Lj7FmQw8= X-Received: by 2002:a17:907:2685:b0:94f:3bf7:dacf with SMTP id bn5-20020a170907268500b0094f3bf7dacfmr24595794ejc.71.1684020233043; Sat, 13 May 2023 16:23:53 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id u15-20020aa7db8f000000b0050bc863d32asm5442560edt.27.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-001Amz-0c; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 12/14] go: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:19 +0200 Message-Id: <20230513232321.279733-13-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.2 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?1765823437679911165?= X-GMAIL-MSGID: =?utf-8?q?1765823437679911165?= From: Bernhard Reutner-Fischer gcc/go/ChangeLog: * go-gcc.cc (Gcc_backend::fill_in_array): Use _P() defines from tree.h. (Gcc_backend::named_type): Ditto. (Gcc_backend::convert_expression): Ditto. (operator_to_tree_code): Ditto. (Gcc_backend::init_statement): Ditto. gcc/ChangeLog: * godump.cc (go_format_type): Ditto. (go_output_typedef): Ditto. --- gcc/go/go-gcc.cc | 10 +++++----- gcc/godump.cc | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 41ae9f83731..ad001a9044a 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -1168,7 +1168,7 @@ Gcc_backend::fill_in_array(Btype* fill, Btype* element_type, if (element_type_tree == error_mark_node || length_tree == error_mark_node) return this->error_type(); - gcc_assert(TYPE_SIZE(element_type_tree) != NULL_TREE); + gcc_assert (COMPLETE_TYPE_P (element_type_tree)); length_tree = fold_convert(sizetype, length_tree); @@ -1347,7 +1347,7 @@ Gcc_backend::named_type(const std::string& name, Btype* btype, if (TYPE_NAME(type) == NULL_TREE && location.gcc_location() == BUILTINS_LOCATION && (TREE_CODE(type) == INTEGER_TYPE - || TREE_CODE(type) == REAL_TYPE + || SCALAR_FLOAT_TYPE_P (type) || TREE_CODE(type) == COMPLEX_TYPE || TREE_CODE(type) == BOOLEAN_TYPE)) { @@ -1670,7 +1670,7 @@ Gcc_backend::convert_expression(Btype* type, Bexpression* expr, } else if (TREE_CODE(type_tree) == INTEGER_TYPE) ret = fold(convert_to_integer(type_tree, expr_tree)); - else if (TREE_CODE(type_tree) == REAL_TYPE) + else if (SCALAR_FLOAT_TYPE_P (type_tree)) ret = fold(convert_to_real(type_tree, expr_tree)); else if (TREE_CODE(type_tree) == COMPLEX_TYPE) ret = fold(convert_to_complex(type_tree, expr_tree)); @@ -1880,7 +1880,7 @@ operator_to_tree_code(Operator op, tree type) code = MULT_EXPR; break; case OPERATOR_DIV: - if (TREE_CODE(type) == REAL_TYPE || TREE_CODE(type) == COMPLEX_TYPE) + if (SCALAR_FLOAT_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE) code = RDIV_EXPR; else code = TRUNC_DIV_EXPR; @@ -2223,7 +2223,7 @@ Gcc_backend::init_statement(Bfunction*, Bvariable* var, Bexpression* init) tree init_tree = init->get_tree(); if (var_tree == error_mark_node || init_tree == error_mark_node) return this->error_statement(); - gcc_assert(TREE_CODE(var_tree) == VAR_DECL); + gcc_assert (VAR_P (var_tree)); // To avoid problems with GNU ld, we don't make zero-sized // externally visible variables. That might lead us to doing an diff --git a/gcc/godump.cc b/gcc/godump.cc index 0893d5fbc97..1a62753af12 100644 --- a/gcc/godump.cc +++ b/gcc/godump.cc @@ -791,7 +791,7 @@ go_format_type (class godump_container *container, tree type, tree real_type; real_type = TREE_TYPE (type); - if (TREE_CODE (real_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (real_type)) { switch (TYPE_PRECISION (real_type)) { @@ -1100,7 +1100,7 @@ go_output_typedef (class godump_container *container, tree decl) if (TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE && TYPE_SIZE (TREE_TYPE (decl)) != 0 && !container->decls_seen.contains (TREE_TYPE (decl)) - && (TYPE_CANONICAL (TREE_TYPE (decl)) == NULL_TREE + && (TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (decl)) || !container->decls_seen.contains (TYPE_CANONICAL (TREE_TYPE (decl))))) {