Message ID | cover.1664095312.git.research_trasio@irq.a4lg.com |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> 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 3578F3858022 for <patchwork@sourceware.org>; Sun, 25 Sep 2022 08:42:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3578F3858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664095368; bh=g0j8n689ZGQk67vTEnq7e6XlisQFAg0L5a5DGBd8lb8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Q4lalYhC90hCvO4a5Ixz8CxOi3Wp+TOV22WheRYMHI2Ho1nKbgm9cgt8DtvWIY+uC /CFD649Tf13QoLoOH7vtXovT0PnUzABQEU0GIbyfZqRNuds9kqZ+6EJe6fG94/pnpw fcXH2sDvmSmb/v5nbj6/GpuLt4GcPm6btJZMNGmA= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id D69CF385840C for <gdb-patches@sourceware.org>; Sun, 25 Sep 2022 08:42:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D69CF385840C Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 1F89E300089; Sun, 25 Sep 2022 08:42:20 +0000 (UTC) To: Tsukasa OI <research_trasio@irq.a4lg.com>, Andrew Burgess <aburgess@redhat.com>, Mike Frysinger <vapier@gentoo.org> Subject: [PATCH v2 0/5] sim: Suppress warnings if built with Clang Date: Sun, 25 Sep 2022 08:42:01 +0000 Message-Id: <cover.1664095312.git.research_trasio@irq.a4lg.com> In-Reply-To: <cover.1663073826.git.research_trasio@irq.a4lg.com> References: <cover.1663073826.git.research_trasio@irq.a4lg.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_NONE, SPF_PASS, TXREP 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.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Tsukasa OI via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Tsukasa OI <research_trasio@irq.a4lg.com> Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series | sim: Suppress warnings if built with Clang | |
Message
Tsukasa OI
Sept. 25, 2022, 8:42 a.m. UTC
Hello, This is the version 2 patchset to suppress Clang compiler warnings (causes a build failure due to default -Werror). [Background] When we build Binutils and GDB with Clang, it causes a build failure due to warnings generated by Clang and the default -Werror configuration. I finally managed to make ALL ARCHITECTURE ENABLED Binutils and GDB -Werror-free on Clang 15.0.0 (note that this does not necessarily mean warning-free) and this patchset is a part of it (common simulator part except the printf-like functions). Full Clang 15.0.0 -Werror-free branch is available at: <https://github.com/a4lg/binutils-gdb/tree/clang-nowarn-dev> [About this Patchset] This patchset contains four five fixes to the files under sim{,/common}. Each contains minor fixes to suppress Clang / GCC warnings. Each change is detailed in the each patch. [Changes: v1 -> v2] - Commit messages are improved - PATCH v1 1/4 is Moved to another patchset - PATCH v1 2-4/4 -> PATCH v2 1-3/5 - New: Check known getopt definition on sim (PATCH v2 4/5) This test is already performed on binutils, gas, gprof and ld and this commit does the same to sim. - New: Initialize pbb_br_* by default (PATCH v2 5/5) It did not generate warnings on Clang but GCC creates some warnings (although those are not reported as errors). This is due to uninitialized pbb_br_* variables and this commit fixes the issue by initializing them by a harmless value. Thanks, Tsukasa Tsukasa OI (5): sim: Remove self-assignments sim: Make WITH_{TRACE,PROFILE}-based macros bool sim: Suppress non-literal printf warning sim: Check known getopt definition existence sim: Initialize pbb_br_* by default sim/common/genmloop.sh | 8 ++++---- sim/common/hw-tree.c | 2 -- sim/common/sim-hw.c | 3 +++ sim/common/sim-profile.h | 12 ++++++------ sim/common/sim-trace.h | 4 ++-- sim/config.h.in | 3 +++ sim/configure | 32 ++++++++++++++++++++++++++++++++ sim/configure.ac | 10 ++++++++++ 8 files changed, 60 insertions(+), 14 deletions(-) base-commit: 58d69206b8173b9d027a6c65f56cdaf045ae6e64
Comments
Hello, This is the version 2 patchset to suppress Clang compiler warnings (causes a build failure due to default -Werror). [Background] When we build Binutils and GDB with Clang, it causes a build failure due to warnings generated by Clang and the default -Werror configuration. I MOSTLY managed to make ALL ARCHITECTURE ENABLED Binutils and GDB -Werror-free on Clang 15.0.0 (note that this does not necessarily mean warning-free) and this patchset is a part of it (common simulator parts). - It still requires -Wno-implicit-function-declaration on the LatticeMicro32 and M32R simulators. Except them, most of Binutils / GDB components can be built with Clang by default with my tree. - I noticed that the assembler is not tested enough (because just with --enable-targets=all, it builds only host assembler). Full Clang 15.0.0 -Werror-free branch in development is available at: <https://github.com/a4lg/binutils-gdb/tree/clang-nowarn-dev> Tested configuration: - Ubuntu 22.04.1 LTS (x86_64) - LLVM / Clang 15.0.0 (built from source) - Configuration examples: $srcdir/configure \ --enable-targets=all \ --enable-multilib --enable-ld --enable-gold --enable-nls \ CC=clang CXX=clang++ CCLD=clang CXXLD=clang++ \ CFLAGS=' -O2 -g -Wno-implicit-function-declaration' \ CXXFLAGS='-O2 -g -Wno-implicit-function-declaration' $srcdir/configure \ --target=riscv64-unknown-linux-gnu \ --enable-multilib --enable-ld --enable-gold --enable-nls \ CC=clang CXX=clang++ CCLD=clang CXXLD=clang++ \ CFLAGS='-O2 -g' CXXFLAGS='-O2 -g' [About this Patchset] This patchset contains four five fixes to the files under sim{,/common}. Each contains minor fixes to suppress Clang / GCC warnings. Each change is detailed in the each patch. [Changes: v2 -> v3] - PATCH 2/5: Rewritten predicate macros from (!!x) to (x != 0). (This is based on the feedback by Andrew Burgess). - PATCH 3/5: Replaced with a patch by Andrew Burgess (slightly modified by me). - PATCH 4/5: Fix cached variable from ld_cv_* to sim_cv_*. - Removed ChangeLog from commit messages (based on the feedback [to another patchset by me] by Bruno Larsen). [Changes: v1 -> v2] - Commit messages are improved - PATCH v1 1/4 is Moved to another patchset - PATCH v1 2-4/4 -> PATCH v2 1-3/5 - New: Check known getopt definition on sim (PATCH v2 4/5) This test is already performed on binutils, gas, gprof and ld and this commit does the same to sim. - New: Initialize pbb_br_* by default (PATCH v2 5/5) It did not generate warnings on Clang but GCC creates some warnings (although those are not reported as errors). This is due to uninitialized pbb_br_* variables and this commit fixes the issue by initializing them by a harmless value. Thanks, Tsukasa Tsukasa OI (5): sim: Remove self-assignments sim: Make WITH_{TRACE,PROFILE}-based macros bool sim: Suppress non-literal printf warning sim: Check known getopt definition existence sim: Initialize pbb_br_* by default sim/common/genmloop.sh | 8 ++++---- sim/common/hw-tree.c | 2 -- sim/common/sim-hw.c | 26 ++++++++++++++++---------- sim/common/sim-profile.h | 12 ++++++------ sim/common/sim-trace.h | 4 ++-- sim/config.h.in | 3 +++ sim/configure | 32 ++++++++++++++++++++++++++++++++ sim/configure.ac | 10 ++++++++++ 8 files changed, 73 insertions(+), 24 deletions(-) base-commit: a13886e2198beb78b81c59839043b021ce6df78a