From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4167 invoked by alias); 16 Jul 2018 17:54:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 4157 invoked by uid 89); 16 Jul 2018 17:54:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,SPF_HELO_PASS autolearn=no version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Jul 2018 17:54:55 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1B1CC4022414; Mon, 16 Jul 2018 17:54:54 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C7FC2156893; Mon, 16 Jul 2018 17:54:53 +0000 (UTC) Subject: Re: [RFA 12/13] Add ATTRIBUTE_UNUSED to regdat.sh output To: Tom Tromey References: <20180712205208.32646-1-tom@tromey.com> <20180712205208.32646-13-tom@tromey.com> <9c6ed571-1f28-f527-64ff-445f51089dcd@redhat.com> <87r2k35e2z.fsf@tromey.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <54f2c414-766b-bd6a-4217-4bc48aa0bfd6@redhat.com> Date: Mon, 16 Jul 2018 17:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <87r2k35e2z.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-07/txt/msg00496.txt.bz2 On 07/16/2018 05:40 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Pedro> On 07/12/2018 09:52 PM, Tom Tromey wrote: >>> This changes regdat.sh to emit ATTRIBUTE_UNUSED for the >>> xmltarget_${name} variable. This seemed simpler than trying to figure >>> out under exactly which circumstances each one was in fact used. > > Pedro> Can you give an example configuration where you got a warning? > > I only found this one via the buildbot: > > https://gdb-build.sergiodj.net/builders/Fedora-s390x-m64/builds/9085 > > > It fails like so: > > s390-linux32-generated.c: In function ‘void init_registers_s390_linux32()’: > s390-linux32-generated.c:141:20: error: unused variable ‘xmltarget_s390_linux32’ [-Werror=unused-variable] > static const char *xmltarget_s390_linux32 = "s390-linux32.xml"; > ^~~~~~~~~~~~~~~~~~~~~~ > s390-linux32v1-generated.c: In function ‘void init_registers_s390_linux32v1()’: > s390-linux32v1-generated.c:143:20: error: unused variable ‘xmltarget_s390_linux32v1’ [-Werror=unused-variable] > static const char *xmltarget_s390_linux32v1 = "s390-linux32v1.xml"; > ^~~~~~~~~~~~~~~~~~~~~~~~ > s390-linux32-generated.c: At global scope: > s390-linux32-generated.c:141:20: error: ‘xmltarget_s390_linux32’ defined but not used [-Werror=unused-variable] > s390-linux32v1-generated.c: At global scope: > s390-linux32v1-generated.c:143:20: error: ‘xmltarget_s390_linux32v1’ defined but not used [-Werror=unused-variable] This is building an ipa object: s390-linux32-generated.c: In function ‘void init_registers_s390_linux32()’: s390-linux32-generated.c:141:20: error: unused variable ‘xmltarget_s390_linux32’ [-Werror=unused-variable] static const char *xmltarget_s390_linux32 = "s390-linux32.xml"; ^~~~~~~~~~~~~~~~~~~~~~ s390-linux32v1-generated.c: In function ‘void init_registers_s390_linux32v1()’: s390-linux32v1-generated.c:143:20: error: unused variable ‘xmltarget_s390_linux32v1’ [-Werror=unused-variable] static const char *xmltarget_s390_linux32v1 = "s390-linux32v1.xml"; ^~~~~~~~~~~~~~~~~~~~~~~~ s390-linux32-generated.c: At global scope: s390-linux32-generated.c:141:20: error: ‘xmltarget_s390_linux32’ defined but not used [-Werror=unused-variable] s390-linux32v1-generated.c: At global scope: s390-linux32v1-generated.c:143:20: error: ‘xmltarget_s390_linux32v1’ defined but not used [-Werror=unused-variable] cc1plus: all warnings being treated as errors make[4]: *** [Makefile:576: s390-linux32-ipa.o] Error 1 The generated files look something like this (here for x86-64): static const char *expedite_regs_amd64_linux[] = { "rbp", "rsp", "rip", 0 }; static const char *xmltarget_amd64_linux = 0; #ifndef IN_PROCESS_AGENT result->xmltarget = xmltarget_amd64_linux; #endif So the xmltarget_foo variable is defined unconditionally, but used only when #ifndef IN_PROCESS_AGENT. So if we wrap the variable definition in !IN_PROCESS_AGENT too, the warning should go away. I guess that getting warning or not is most likely dependent on GCC version. Thanks, Pedro Alves