From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id A164438582BA for ; Mon, 26 Sep 2022 10:35:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A164438582BA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id F25EB300089; Mon, 26 Sep 2022 10:35:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1664188544; bh=ztk+V+X5BKAiEYFX20SBk+KXw8vePuK6fOZNCLaLmDM=; h=From:To:Cc:Subject:Date:Message-Id:Mime-Version: Content-Transfer-Encoding; b=cS4YVV3E2JVOiNQg+nnAiNNCT/c9JZZCPAybJUeiFCJXpqKt3jLX52J/Ecq84EYhS C3NdTUtB/YFO6L8EUCay17M5e1Jof9XOs0q+iJiILzvZUqyAoByAi3ex0wrBU6lW9h WRWwsNcU4b9RFNKnj8yH2E4MLj/j7EGZe22/k8qQ= From: Tsukasa OI To: Tsukasa OI , Ian Lance Taylor , Cary Coutant Cc: binutils@sourceware.org Subject: [PATCH 0/1] gold: Suppress "unused" variable warning on Clang Date: Mon, 26 Sep 2022 10:35:39 +0000 Message-Id: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.2 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 List-Id: Hello, [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 (GNU gold). - It still requires -Wno-implicit-function-declaration on the LatticeMicro32 and M32R simulators. Except them, all Binutils / GDB components can be built with Clang by default with my tree. 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 Patch] Clang generates a warning if there is a variable that is set but not used otherwise ("-Wunused-but-set-variable"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). Because the cause of this error is in the Bison-generated code ($(binutils)/gold/yyscript.y -> $(srcdir)/gold/yyscript.c), this commit suppresses this warning ("-Wunused-but-set-variable") by placing DIAGNOSTIC_IGNORE_UNUSED_BUT_SET_VARIABLE macro at the end of user prologue on yyscript.y. Thanks, Tsukasa Tsukasa OI (1): gold: Suppress "unused" variable warning on Clang gold/yyscript.y | 3 +++ 1 file changed, 3 insertions(+) base-commit: c21736aed1d4877e090df60362413669dbdc391d -- 2.34.1