From patchwork Sat Dec 9 16:38:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 176196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6142240vqy; Sat, 9 Dec 2023 08:39:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGILGR+hB6anmg+0mKLjW9lbMg/9K9BJrplT76CUAi3glz/nm8k2QCBl7DTv5TuzxxYUTCp X-Received: by 2002:a05:620a:2711:b0:77d:920a:9ed with SMTP id b17-20020a05620a271100b0077d920a09edmr2289311qkp.66.1702139963502; Sat, 09 Dec 2023 08:39:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702139963; cv=pass; d=google.com; s=arc-20160816; b=fM6x1TrrizlRzIv5HKWuwrOL4FxXuBgnlfGju2ZqouH/sZZ+h9RpbjzvUSI8Hy2H0f vXQwxLaFWokK1YbCKqFMxEb3ZM3AEZlMwNozsjQHP9KhXWpDvjVykJQYgew2b1raU4oQ OEY/aNpy2R4q/E7pkEpiKZEqc3dOeShWpoUcbEhSHsDU2ryv2pduMYfezcvlclguk61M Qtq/YXTc8p0aUZvvZ2xnVG6mSum4g7ltViqez89SaoRHoTE4FLrvpZKByQ4b8VqWgrLx KbHY6V3EYNVK7sCPTrDjsfZNcDoaDlZ26K7TOG7soBIONT44hMrklx3bEjKDDXYFNQ+g /SeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=XfAnPBCfctKjBrXu3zHP2jfGIwUF1/uhPwXtQAkQ3Co=; fh=oUCfM/eMlWtMCtZZKY1bglzxCo7b3kw9D5LTFFWuz38=; b=V5eYPE6ANhnZVkyei3HaU30B2iaTTCCn04GHXX5gerB+eC02T5bqXO87hE3s/LmQnn eklMz89+eFxEDUkDSm3F/vrF8lqrF0fw30DV6BPQf0/dH9zgUeCQtCP5u55ECg9JMbuX baQh2gr2sl762hhO5q9iOla/IZjYsDgzIZeoNcabmdBgNTOOkA2IY2kOU/XRP238b56F 6JeptQaeCFRHuHpv/hODYqkjy+buQUNjIlLYI8UpI1Y09xz9zJke0INNPsUB1At4b0Na FPYis7jNqaZK/kHUGsDSk5Sz05VgMgkTGgs0ueME5NgwWIFSM1WYecUWHpaZh5eSktsi WeRg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=AVe1Q7iX; arc=pass (i=1); 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=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b14-20020a05620a088e00b0077f38f09fb5si4063158qka.687.2023.12.09.08.39.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 08:39:23 -0800 (PST) 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=@xry111.site header.s=default header.b=AVe1Q7iX; arc=pass (i=1); 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=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4889C3858C2A for ; Sat, 9 Dec 2023 16:39:23 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 9F6B93858C98 for ; Sat, 9 Dec 2023 16:38:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9F6B93858C98 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9F6B93858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=89.208.246.23 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702139940; cv=none; b=edMw1MnYTWBdhUgxOtvvL8IQEzSUt5/u9CME1DScXLYUPeUwbOEX90IspJuYZMloJq5VYPaG8l5z5Lfgqw6tK1YgiwyERWN2NDaCKziKOQ6j/KGS2lAFa+O4gQrD9Lj0YN3b+IIwcz0EMZ9wZs3TeQwhZIat0ezt7P+ufMt+vOE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702139940; c=relaxed/simple; bh=G5qhtxGcbtnahIuWJMfdzcwD+zdhCDK5HtzfRMllh3M=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BqHG9IBJRiZ/RoiAIcLuYAEU5TgnEwcV6trTEfO5wOtuARK/RWy7VqWS01S4ocETpx1R8M/aVvaTm5KivfjVkNj7U3pQw0mCNFuGiFm+wT2OgohfjT02E5awj3j3CNXaNQeuFuJGBNinK8Cn4n3A/PK/HiDF+Y+SXZMOstfxnk0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1702139927; bh=G5qhtxGcbtnahIuWJMfdzcwD+zdhCDK5HtzfRMllh3M=; h=From:To:Cc:Subject:Date:From; b=AVe1Q7iX82LUckZAYlS+/D+S101SsIT3uC0ab0Exco8kHxsdw0Hy/DI+1lkafvFNf hXJDv46bL1mr0SFRZB/bogdiNfeeiSLmXb4NiDaWhhMRQBJ0zBPrzrhsXvCIfYlKsz P49aG6j7BQhlO+Kmn/EePZ3hq3AlBo3/LVnF4x5w= Received: from stargazer.. (unknown [IPv6:240e:358:1144:3a00:dc73:854d:832e:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id BB1FE66C7B; Sat, 9 Dec 2023 11:38:44 -0500 (EST) From: Xi Ruoyao To: gcc-patches@gcc.gnu.org Cc: chenglulu , i@xen0n.name, xuchenghua@loongson.cn, Xi Ruoyao Subject: [PATCH] LoongArch: Fix warnings building libgcc Date: Sun, 10 Dec 2023 00:38:11 +0800 Message-ID: <20231209163831.5320-1-xry111@xry111.site> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, LIKELY_SPAM_FROM, SPF_HELO_PASS, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784823114788741841 X-GMAIL-MSGID: 1784823114788741841 We are excluding loongarch-opts.h from target libraries, but now struct loongarch_target and gcc_options are not declared in the target libraries, causing: In file included from ../.././gcc/options.h:8, from ../.././gcc/tm.h:49, from ../../../gcc/libgcc/fixed-bit.c:48: ../../../gcc/libgcc/../gcc/config/loongarch/loongarch-opts.h:57:41: warning: 'struct gcc_options' declared inside parameter list will not be visible outside of this definition or declaration 57 | struct gcc_options *opts, | ^~~~~~~~~~~ So exclude the declarations referring to the C++ structs as well. gcc/ChangeLog: * config/loongarch/loongarch-opts.h (la_target): Move into #if for loongarch-def.h. (loongarch_init_target): Likewise. (loongarch_config_target): Likewise. (loongarch_update_gcc_opt_status): Likewise. --- Bootstrapped and regtested on loongarch64-linux-gnu. Ok for trunk? gcc/config/loongarch/loongarch-opts.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gcc/config/loongarch/loongarch-opts.h b/gcc/config/loongarch/loongarch-opts.h index 651c1c18ca8..d091359300a 100644 --- a/gcc/config/loongarch/loongarch-opts.h +++ b/gcc/config/loongarch/loongarch-opts.h @@ -21,22 +21,15 @@ along with GCC; see the file COPYING3. If not see #ifndef LOONGARCH_OPTS_H #define LOONGARCH_OPTS_H -/* This is a C++ header and it shouldn't be used by target libraries. */ +/* The loongarch-def.h file is a C++ header and it shouldn't be used by + target libraries. Exclude it and everything using the C++ structs + (struct loongarch_target and gcc_options) from target libraries. */ #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS) #include "loongarch-def.h" -#endif /* Target configuration */ extern struct loongarch_target la_target; -/* Flag status */ -struct loongarch_flags { - int flt; const char* flt_str; -#define SX_FLAG_TYPE(x) ((x) < 0 ? -(x) : (x)) - int sx[2]; -}; - - /* Initialize loongarch_target from separate option variables. */ void loongarch_init_target (struct loongarch_target *target, @@ -56,7 +49,14 @@ void loongarch_update_gcc_opt_status (struct loongarch_target *target, struct gcc_options *opts, struct gcc_options *opts_set); +#endif +/* Flag status */ +struct loongarch_flags { + int flt; const char* flt_str; +#define SX_FLAG_TYPE(x) ((x) < 0 ? -(x) : (x)) + int sx[2]; +}; /* Macros for common conditional expressions used in loongarch.{c,h,md} */ #define TARGET_CMODEL_NORMAL (la_target.cmodel == CMODEL_NORMAL)