From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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) -- 2.43.0