From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Nq61FpmcRWNI7QkAWB0awg (envelope-from ) for ; Tue, 11 Oct 2022 12:40:57 -0400 Received: by simark.ca (Postfix, from userid 112) id 4E9161E112; Tue, 11 Oct 2022 12:40:57 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=rexcJDBk; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EE1051E0CB for ; Tue, 11 Oct 2022 12:40:53 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 905C9385702F for ; Tue, 11 Oct 2022 16:40:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 905C9385702F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665506453; bh=7KKcJIoppPYC/FEgKIh9Alx4Z84zbo2bgOrOxD2dt2k=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=rexcJDBkjCHjh3RW8oPwo5i1VpJXhoM2GLBYjPsSMTlOQJO5MOivJAe1ZA3aUiaod ZUxp+DSjBdZ4JGKV9OGqaqMYycm/W7gVy1G2+X47J77sLdm+A8zEKPf5QTJuIdnkXJ 9o+sn9S/phHYmIHaU9oadGLMbXbNCtDi0HBWsTdU= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 627493858C2D for ; Tue, 11 Oct 2022 16:40:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 627493858C2D Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4FCD91F8B0; Tue, 11 Oct 2022 16:40:27 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 29469139ED; Tue, 11 Oct 2022 16:40:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cjl+CHucRWMKdwAAMHmgww (envelope-from ); Tue, 11 Oct 2022 16:40:27 +0000 Message-ID: <7b9c7afa-e282-de64-645b-b508320dd276@suse.de> Date: Tue, 11 Oct 2022 18:40:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v3 0/5] sim: Suppress warnings if built with Clang Content-Language: en-US To: Tsukasa OI , Andrew Burgess , Mike Frysinger References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 10/6/22 08:43, Tsukasa OI via Gdb-patches wrote: > Hello, > > This is the version 2 patchset to suppress Clang compiler warnings > (causes a build failure due to default -Werror). > > Hi, AFAICT, this causes breakage with the build bots, see f.i. https://builder.sourceware.org/buildbot/#/builders/74/builds/1357 : ... CC pk_disklabel.o ../../../binutils-gdb/sim/ppc/corefile.c: In function ‘core_map_find_mapping’: ../../../binutils-gdb/sim/ppc/corefile.c:295:136: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘cpu *’ {aka ‘struct _cpu *’} [-Werror=format=] 295 | error("core_find_mapping() - access to unmaped address, attach a default map to handle this - addr=0x%x nr_bytes=0x%x processor=0x%x cia=0x%x\n", | ~^ | | | unsigned int 296 | addr, nr_bytes, processor, cia); | ~~~~~~~~~ | | | cpu * {aka struct _cpu *} cc1: all warnings being treated as errors make[3]: *** [Makefile:144: corefile.o] Error 1 ... Thanks, - Tom > [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: > > > 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