Message ID | 20220905104312.xq3dkytz5olm56up@lug-owl.de |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp113738wrt; Mon, 5 Sep 2022 03:43:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR72bx4slMhTdyHXqoXGvgA7ooR2/4qcD/EDrQHyAC4eaVS3GmRriDdxDs7sj49rluAjAnj+ X-Received: by 2002:a17:907:2ce7:b0:741:6e62:4558 with SMTP id hz7-20020a1709072ce700b007416e624558mr27232892ejc.273.1662374621954; Mon, 05 Sep 2022 03:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662374621; cv=none; d=google.com; s=arc-20160816; b=V9AdXp8wiCkcz+EkHBAx2Ttzs5YxTWTVQY7Asx54CPBhtsWV+hafng8Befp06hQ2ZV qOmzzRQkD0Wost9sRqKrEeGcCnKdgclPY8OmqA2SrvbLOx8bLMreFoH6WKQi5MR8wd27 1/5U9neb3Z0bjlvgJxPH+Te061zHRNOA02txcachxY3w6pS2N3vYpC2GuyZPFaplw8z2 GUtnGwrXUL/ZsvjaNnZOOfI7f/DSI7Cx5Q48+jlYJYLg3nalpcBDBsKViiieylCOlUAs mepz6E2wMWQPHRH4d6PcPE/LS7YR0JpSoH2XyU9FKsHF3NvdeG7Kic2ctCgSRPCmND5D CcEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:user-agent:content-disposition :mime-version:message-id:subject:to:from:date:dmarc-filter :delivered-to; bh=QRsepiTaY5/GSUn7vz65eyZS0gHV+ci9OlP/8d2+/Jc=; b=B7wG/5rRhjHUBxag1cseAfG1p/OsCgY6rF69dSCommap1c95Js4s5UlsWZWJGOUrP8 TPVQV6fW5qFDhYroinpOiae+sGCkCsQyGgBp//zrAzWlY5IMp1S27+7B0c8HYAX6hkBV 5uxZlWn4bhizlpAIXr8dOtsdmEXg4y8ibc2f96IPTqMrnY0+BQW+Tw0yTJ+q61u0200W X/y9Bx/FAHTrTUkS53pULQ1hH3/eEAoDpIM6b3Dy28yB+VOcUc89oAsHliXF7WESbeBe Hg/jBThLUebwHViIV0kOxsFV7Va0+Upe/sjoYjJMmIaB4/kvfiMlau03yi7UfCqEzaf+ Uzyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c15-20020a0564021f8f00b0044eabb548b4si579241edc.473.2022.09.05.03.43.41 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 03:43:41 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 174253856DD9 for <ouuuleilei@gmail.com>; Mon, 5 Sep 2022 10:43:38 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from lug-owl.de (lug-owl.de [188.68.32.151]) by sourceware.org (Postfix) with ESMTPS id 17BFB3858D32 for <gcc-patches@gcc.gnu.org>; Mon, 5 Sep 2022 10:43:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 17BFB3858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lug-owl.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lug-owl.de Received: by lug-owl.de (Postfix, from userid 1001) id 014E84200A; Mon, 5 Sep 2022 12:43:12 +0200 (CEST) Date: Mon, 5 Sep 2022 12:43:12 +0200 From: Jan-Benedict Glaw <jbglaw@lug-owl.de> To: "Jose E. Marchesi" <jose.marchesi@oracle.com> Subject: [PATCH] bpf: Fix unused variable warning Message-ID: <20220905104312.xq3dkytz5olm56up@lug-owl.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ftercelec7mzw4em" Content-Disposition: inline X-Operating-System: Linux chamaeleon 5.14.0-0.bpo.2-amd64 X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-message-flag: Please send plain text messages only. Do not send HTML emails. Thank you. User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743126131652634312?= X-GMAIL-MSGID: =?utf-8?q?1743126131652634312?= |
Series |
bpf: Fix unused variable warning
|
|
Commit Message
Jan-Benedict Glaw
Sept. 5, 2022, 10:43 a.m. UTC
Hi! Building for for bpf-unknown-none target, recent GCCs will issue an unused variable warning as the REGNO_REG_CLASS macro doesn't actually use its argument. Reference the argument as (void) to silence the warning. .../gcc/configure --prefix=... --enable-werror-always --enable-languages=all --disable-gcov --disable-shared --disable-threads --target=bpf-unknown-none --without-headers [...] make V=1 all-gcc [...] /usr/lib/gcc-snapshot/bin/g++ -fno-PIE -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace -o regcprop.o -MT regcprop.o -MMD -MP -MF ./.deps/regcprop.TPo ../../gcc/gcc/regcprop.cc ../../gcc/gcc/regcprop.cc: In function 'bool copyprop_hardreg_forward_1(basic_block, value_data*)': ../../gcc/gcc/regcprop.cc:794:24: error: unused variable 'regno' [-Werror=unused-variable] 794 | unsigned int regno = REGNO (SET_SRC (set)); | ^~~~~ cc1plus: all warnings being treated as errors make[1]: *** [Makefile:1146: regcprop.o] Error 1 make[1]: Leaving directory '/var/lib/laminar/run/gcc-bpf-unknown-none/1/toolchain-build/gcc' make: *** [Makefile:4565: all-gcc] Error 2 Ok for HEAD? Thanks, Jan-Benedict gcc/ * config/bpf/bpf.h (REGNO_REG_CLASS): Reference arguments as (void). --
Comments
Hi Jan. > Building for for bpf-unknown-none target, recent GCCs will issue an unused > variable warning as the REGNO_REG_CLASS macro doesn't actually use its > argument. Reference the argument as (void) to silence the warning. > > .../gcc/configure --prefix=... --enable-werror-always --enable-languages=all --disable-gcov --disable-shared --disable-threads --target=bpf-unknown-none --without-headers > [...] > make V=1 all-gcc > [...] > > /usr/lib/gcc-snapshot/bin/g++ -fno-PIE -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbacktrace -o regcprop.o -MT regcprop.o -MMD -MP -MF ./.deps/regcprop.TPo ../../gcc/gcc/regcprop.cc > ../../gcc/gcc/regcprop.cc: In function 'bool copyprop_hardreg_forward_1(basic_block, value_data*)': > ../../gcc/gcc/regcprop.cc:794:24: error: unused variable 'regno' [-Werror=unused-variable] > 794 | unsigned int regno = REGNO (SET_SRC (set)); > | ^~~~~ > cc1plus: all warnings being treated as errors > make[1]: *** [Makefile:1146: regcprop.o] Error 1 > make[1]: Leaving directory '/var/lib/laminar/run/gcc-bpf-unknown-none/1/toolchain-build/gcc' > make: *** [Makefile:4565: all-gcc] Error 2 > > > Ok for HEAD? OK. Thanks.
diff --git a/gcc/config/bpf/bpf.h b/gcc/config/bpf/bpf.h index 5b3f4a58763..57903477a4a 100644 --- a/gcc/config/bpf/bpf.h +++ b/gcc/config/bpf/bpf.h @@ -209,7 +209,7 @@ enum reg_class register REGNO. In general there is more that one such class; choose a class which is "minimal", meaning that no smaller class also contains the register. */ -#define REGNO_REG_CLASS(REGNO) GENERAL_REGS +#define REGNO_REG_CLASS(REGNO) ((void)(REGNO), GENERAL_REGS) /* A macro whose definition is the name of the class to which a valid base register must belong. A base register is one used in