From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 3B0223888801 for ; Thu, 15 Sep 2022 03:09:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3B0223888801 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 C1EAA300089; Thu, 15 Sep 2022 03:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1663211368; bh=x4yPsv2mu9lN8MfIu8N4u++KNl1+MnUTaIHj7icjea4=; h=From:To:Cc:Subject:Date:Message-Id:Mime-Version: Content-Transfer-Encoding; b=Ml0mrUr/RFOylzXjDcioKhT3sJ33mtPZKv7VOuzrQsmLpc3PKGe3c9z169ojaaFml p135wXO3pgHU3MPz9VC52GWbDdK7i5GGAVnRmp++HzQfLd3aRDkRsicdrlfv4dgoFb BNzBQZTqPz1K3vr7hMG4chWXSHle4JTXbNKvocUw= From: Tsukasa OI To: Tsukasa OI , Nick Clifton , Ian Lance Taylor , Nelson Chu Cc: binutils@sourceware.org Subject: [PATCH 0/1] bfd, binutils, gas: Mark unused variables Date: Thu, 15 Sep 2022 03:09:26 +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,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 List-Id: Hello, [Common Background: Building GNU Binutils / GDB with Clang 15.0.0] I'm now testing to build GNU Binutils / GDB with latest Clang (15.0.0) and found some errors by default (when Binutils / GDB is not configured with "--disable-werror"). While the best compiler to build GNU Binutils / GDB is GNU GCC, testing other compilers are helpful to discover underlying problems and modernize Binutils / GDB, even if building entire Binutils / GDB with the latest Clang is unrealistic. To be sure, I'm not going to finish "porting for Clang". I will take low-hanging fruits and... 1. make building with Clang easier and/or 2. fix code issues (or non-issues) discovered as Clang warnings. I made four patchsets in which, applying them all makes it possible to build GNU Binutils / GDB with Clang (without help of --disable-werrors) for many (but not all) targets including i386 and RISC-V with Ubuntu 22.04 LTS (x86_64) host. At least, I think they fix all (at minimum, most of) arch- independent parts which prevents building with the latest version of Clang. This is the one of them. [About this Patchset] Clang generates a warning on "written but not read thereafter" varibles ("-Wset-but-unused-variable"), making the build failure. We could just remove practically unused variables but instead I chose to keep it but with ATTRIBUTE_UNUSED. This is because the most of such variables may have possible uses in the future. ATTRIBUTE_UNUSED (__attribute__((unused))) marks a variable *possibly unused* and suppresses warnings about "written but not read thereafter" or just "unused" variables. Note that it only means a variable is "possibly unused". Even if a variable with this attribute is "used", it's completely safe (removing the attribute when a variable is started to be used is definitely better, though). Thanks, Tsukasa Tsukasa OI (1): bfd, binutils, gas: Mark unused variables bfd/elf32-lm32.c | 5 +---- bfd/elf32-nds32.c | 4 +--- bfd/mmo.c | 7 +------ binutils/windmc.c | 5 ++--- gas/config/tc-riscv.c | 4 +--- ld/pe-dll.c | 11 ++++------- 6 files changed, 10 insertions(+), 26 deletions(-) base-commit: fe39ffdc202f04397f31557f17170b40bc42b77a -- 2.34.1