From patchwork Tue Jan 9 02:38:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 83589 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 94B2F3858C33 for ; Tue, 9 Jan 2024 02:39:16 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id AA2233858D39 for ; Tue, 9 Jan 2024 02:38:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA2233858D39 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 AA2233858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704767927; cv=none; b=cAyZvUk5w3dF43oPKluwCXddGkfJKOHAHJeO1dJT0WKcQ6EOqavYlLybP0XO6OYZfr8IA5lm53Ld9xHY3EM3A9/X45M/dC23hs8YaQVskVH/gErK+YrisLa3Em0TqItlKu0IDX6MLmI29Y8qCBf/2QB+VQ/F0zMnZfYUhAgZWVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704767927; c=relaxed/simple; bh=3jbWJB0uN2CazhRq3rq7pvYZSxjgPr+DLBqZlJktUeE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=TK27py2QTGuOIxozFgtkCz1fYNFHE3DTCB2Cun2WP6oNT43ybM8wyw+wQe8bDocNZjddcG4NU5YYwCyQldJCL2gqOCvUyl0eKAzx+pDvHg7GPgyX/4UfgQ9tUt8nMhn+EcWOAmn0uUjf4vUTbtPK1UnfFfWpPsm/g7BXZ8sO4SY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 5957B3432B9; Tue, 9 Jan 2024 02:38:45 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH/committed] sim: warnings: compile build tools with -Werror too Date: Mon, 8 Jan 2024 21:38:36 -0500 Message-ID: <20240109023836.486-1-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 Add support for compiling build tools with various -Werror settings. Since the tools don't compile cleanly with the same set of flags as the rest of the sim code, we need to maintain & test a separate list. Only bother when not cross-compiling so we don't have to test all the flags against the build compiler. This should be good enough for our actual development flows. --- sim/Makefile.am | 2 +- sim/Makefile.in | 4 +- sim/configure | 70 ++++++++++++++++++++++++++++++-- sim/m4/sim_ac_option_warnings.m4 | 29 +++++++++++++ 4 files changed, 100 insertions(+), 5 deletions(-) diff --git a/sim/Makefile.am b/sim/Makefile.am index 9183b349725e..a6e080eaafbd 100644 --- a/sim/Makefile.am +++ b/sim/Makefile.am @@ -67,7 +67,7 @@ AM_CPPFLAGS_FOR_BUILD = \ -I$(srcroot)/include \ $(SIM_HW_CFLAGS) \ $(SIM_INLINE) -COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) +COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(BUILD_WERROR_CFLAGS) $(BUILD_WARN_CFLAGS) LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ ## Deps to add to the install-data-local target. diff --git a/sim/m4/sim_ac_option_warnings.m4 b/sim/m4/sim_ac_option_warnings.m4 index 7a28ca621a0b..3b00889dbb05 100644 --- a/sim/m4/sim_ac_option_warnings.m4 +++ b/sim/m4/sim_ac_option_warnings.m4 @@ -76,6 +76,17 @@ dnl The cgen virtual insn logic involves enum conversions. dnl Disable until we can figure out how to make this work. -Wno-enum-conversion " +build_build_warnings=" +dnl TODO Fix the sh/gencode.c which triggers a ton of these warnings. +-Wno-missing-braces +dnl TODO Figure out the igen code that triggers warnings w/FORTIFY_SOURCE. +-Wno-stringop-truncation +dnl Fixing this requires ATTRIBUTE_FALLTHROUGH support at build time, but we +dnl don't have gnulib there (yet). +-Wno-implicit-fallthrough +dnl TODO Enable this after cleaning up code. +-Wno-shadow=local +" case "${host}" in *-*-mingw32*) @@ -123,8 +134,10 @@ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1 fi])dnl WARN_CFLAGS="" +BUILD_WARN_CFLAGS="" if test "x${build_warnings}" != x -a "x$GCC" = xyes then +AC_DEFUN([_SIM_TEST_ALL_WARNING_FLAGS], [dnl AC_MSG_CHECKING(compiler warning flags) # Separate out the -Werror flag as some files just cannot be # compiled with it enabled. @@ -135,6 +148,20 @@ then esac done AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS}) +]) + + dnl Test the host flags. + _SIM_TEST_ALL_WARNING_FLAGS + + dnl Test the build flags. + AS_IF([test "x$cross_compiling" = "xno"], [dnl + SAVE_WARN_CFLAGS=$WARN_CFLAGS + build_warnings=$build_build_warnings + _SIM_TEST_ALL_WARNING_FLAGS + BUILD_WARN_CFLAGS=$WARN_CFLAGS + WARN_CFLAGS=$SAVE_WARN_CFLAGS + BUILD_WERROR_CFLAGS=$WERROR_CFLAGS + ]) dnl Test individual flags to export to dedicated variables. m4_map([_SIM_EXPORT_WARNING_FLAG], m4_split(m4_normalize([ @@ -183,3 +210,5 @@ AC_DEFUN([_SIM_EXPORT_WARNING_FLAG], [dnl ]) AC_SUBST(WARN_CFLAGS) AC_SUBST(WERROR_CFLAGS) +AC_SUBST(BUILD_WARN_CFLAGS) +AC_SUBST(BUILD_WERROR_CFLAGS)