From patchwork Sat Dec 23 04:28:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 82785 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 87C84385828D for ; Sat, 23 Dec 2023 04:29:09 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id C99553858431 for ; Sat, 23 Dec 2023 04:28:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C99553858431 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C99553858431 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703305735; cv=none; b=Zr+KS6CUz0wh9JUKFlpNheFRNAd7MjQcnSOnuLXSfl/mUdoQhwdi3hUJ/HmuLCeKC73tO2ZJORTGY6Q3CdZo47+v0PhXwIRaKNJs6HurDxlK+UR+vw2ODCSzjfIC9tn3Jc1h/PXnLvNE6TI3Kwas1fcDwtGpdNtjGM4gFv48aoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703305735; c=relaxed/simple; bh=fJVNEm/SHbfcwLAd7wVV1Muut7E8N9TCjPMa5moZxwU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=lYbVcGWL53zI6tpABWJOg9sSomL4TFCe4cV2J99HKu4B0ZAlLoIxPuXPFiezz6cXZDFhlmxBSqOTnxmoDmrMa2FegQCQJeZ66FbU4loNt8BDj/MHXo9led2jHJ+HmJhTMs+oE502WhVI4d2vjylyYd6gC4429aaoxsl3qOUWAcA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 63CDD342FF8; Sat, 23 Dec 2023 04:28:53 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: cris: disable -Wshadow=local in generated mloop files Date: Fri, 22 Dec 2023 23:28:51 -0500 Message-ID: <20231223042851.9416-1-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222012355.7504-1-vapier@gentoo.org> References: <20231222012355.7504-1-vapier@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org The mloop files include CGEN generated switch files which have some nested assignments that expand into repeated shadowed variables. Fixing this looks fairly non-trivial as it appears to be interplay between the common CGEN code and how this particular set of cris insns are defined. Disable the warning instead. In file included from sim/cris/mloop.in:286: sim/cris/semcrisv10f-switch.c: In function ‘crisv10f_engine_run_full’: sim/cris/semcrisv10f-switch.c:12383:8: error: declaration of ‘opval’ shadows a previous local [-Werror=shadow=local] 12383 | SI opval = tmp_addr; | ^~~~~ sim/cris/semcrisv10f-switch.c:12371:9: note: shadowed declaration is here 12371 | USI opval = ({ SI tmp_addr; | ^~~~~ And the code looks like: USI opval = ({ ... { SI opval = tmp_addr; ... } ... }); Since the CGEN code treats "opval" as an internal variable that the cpu definitions don't have direct access to, the likelihood of this being a real bug is low, so leave it be. The warning is suppressed for more code that is hand written (e.g. the mloop logic), but disabling for the entire file is the easiest way to suppress while keeping it on everywhere else in the sim. --- sim/Makefile.in | 4 +++- sim/cris/local.mk | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sim/Makefile.in b/sim/Makefile.in index 604732c698c5..6b73533f9db3 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -2160,7 +2160,9 @@ testsuite_common_CPPFLAGS = \ @SIM_ENABLE_ARCH_cr16_TRUE@cr16_gencode_SOURCES = cr16/gencode.c @SIM_ENABLE_ARCH_cr16_TRUE@cr16_gencode_LDADD = cr16/cr16-opc.o -@SIM_ENABLE_ARCH_cris_TRUE@AM_CFLAGS_cris_mloopv10f.o = -Wno-unused-but-set-variable +@SIM_ENABLE_ARCH_cris_TRUE@AM_CFLAGS_cris_mloopv10f.o = \ +@SIM_ENABLE_ARCH_cris_TRUE@ -Wno-unused-but-set-variable \ +@SIM_ENABLE_ARCH_cris_TRUE@ -Wno-shadow=local @SIM_ENABLE_ARCH_cris_TRUE@AM_CFLAGS_cris_mloopv32f.o = -Wno-unused-but-set-variable @SIM_ENABLE_ARCH_cris_TRUE@nodist_cris_libsim_a_SOURCES = \ @SIM_ENABLE_ARCH_cris_TRUE@ cris/modules.c diff --git a/sim/cris/local.mk b/sim/cris/local.mk index 011f8029e49f..a8eea65572ad 100644 --- a/sim/cris/local.mk +++ b/sim/cris/local.mk @@ -19,6 +19,8 @@ ## Some CGEN kludges are causing build-time warnings. See cris.cpu for details. AM_CFLAGS_%C%_mloopv10f.o = -Wno-unused-but-set-variable AM_CFLAGS_%C%_mloopv32f.o = -Wno-unused-but-set-variable +## Some CGEN assignments use variable names that are nested & repeated. +AM_CFLAGS_%C%_mloopv10f.o += -Wno-shadow=local nodist_%C%_libsim_a_SOURCES = \ %D%/modules.c