From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 3226CAC12DA for ; Mon, 11 Dec 2023 15:19:07 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=vijrT3zMOu1Rwz4R6tj70AXwnjIspaW6IFRtStU4YJ0=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1702307946; v=1; b=dwkuW/D9ox6yjPDg4e4E+PbLdA2t8ljscmtXun3fFtbgC0BhlBJrGBq/8L5R3NXI6vYewKHV otmLgt484GjRmUeBU63C4mcAincyqFIkpRMvhbB5NuzzWPrPy9dp42ZQ/4OSApJxsGZE1C6G2qR Cwhy4OVK/pBz4aNwB4o+9GBY= X-Received: by 127.0.0.2 with SMTP id mM3tYY7687511xhOSAwOzPPw; Mon, 11 Dec 2023 07:19:06 -0800 X-Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mx.groups.io with SMTP id smtpd.web11.10864.1702307945978475710 for ; Mon, 11 Dec 2023 07:19:06 -0800 X-Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-40c2d50bfbfso21270545e9.0 for ; Mon, 11 Dec 2023 07:19:05 -0800 (PST) X-Gm-Message-State: PSRfQGxENf77IFfProYLNOpbx7686176AA= X-Google-Smtp-Source: AGHT+IGIHpE1cg3PmukRAbAkcc2/TZrlJLxl4iCTerPGzLrCNL006HnHOZiJ3tp8wxvNygApQlvINZwWRhEjjyy29oo= X-Received: by 2002:a7b:ca4a:0:b0:40c:3cc0:8612 with SMTP id m10-20020a7bca4a000000b0040c3cc08612mr2036251wml.94.1702307944222; Mon, 11 Dec 2023 07:19:04 -0800 (PST) MIME-Version: 1.0 References: <20231210101859.19198-1-mjsbeaton@gmail.com> <9b333ba1-7ce6-5be7-6482-3aadef7f1973@redhat.com> In-Reply-To: <9b333ba1-7ce6-5be7-6482-3aadef7f1973@redhat.com> From: "Mike Beaton" Date: Mon, 11 Dec 2023 15:18:52 +0000 Message-ID: Subject: Re: [edk2-devel] [PATCH] BaseTools/tools_def: Disable unneeded-internal-declaration warning in CLANGPDB To: Laszlo Ersek Cc: devel@edk2.groups.io, Ard Biesheuvel , Ard Biesheuvel Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mjsbeaton@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: multipart/alternative; boundary="000000000000505537060c3d747d" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="dwkuW/D9"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io --000000000000505537060c3d747d Content-Type: text/plain; charset="UTF-8" I believe this would be logically wrong, as the other versions still wouldn't compile if you changed the relevant debug Pcds. (Which are logically independent of the compile and link options - e.g. what if for some reason you wanted to single step with the Debug Pcds set to disabled, in a NOOPT build?) On Mon, 11 Dec 2023, 15:00 Laszlo Ersek, wrote: > On 12/10/23 11:18, Mike Beaton wrote: > > From: Mike Beaton > > > > This warning was already disabled in CLANGDWARF by commit > > d3225577123767fd09c91201d27e9c91663ae132. > > > > gcc can distinguish between optimised-away variable usage (as can occur > in > > valid debug code) and genuinely unused variables, and only complains > about > > the latter. clang cannot, and therefore this warning ends up complaining > > about valid debug code under clang. > > > > Since EDK-II code is in general going to be compiled by gcc as well as > clang > > then disabling this warning in clang does not amount to entirely removing > > potentially valid warnings about genuinely unused variables. > > > > Signed-off-by: Mike Beaton > > --- > > BaseTools/Conf/tools_def.template | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/BaseTools/Conf/tools_def.template > b/BaseTools/Conf/tools_def.template > > index c34ecfd557..48cf45245f 100755 > > --- a/BaseTools/Conf/tools_def.template > > +++ b/BaseTools/Conf/tools_def.template > > @@ -1754,7 +1754,7 @@ DEFINE CLANGPDB_X64_PREFIX = > ENV(CLANG_BIN) > > DEFINE CLANGPDB_IA32_TARGET = -target i686-unknown-windows-gnu > > DEFINE CLANGPDB_X64_TARGET = -target > x86_64-unknown-windows-gnu > > > > -DEFINE CLANGPDB_WARNING_OVERRIDES = -Wno-parentheses-equality > -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare > -Wno-empty-body -Wno-unused-const-variable -Wno-varargs > -Wno-unknown-warning-option -Wno-unused-but-set-variable > -Wno-unused-const-variable -Wno-unaligned-access > -Wno-microsoft-enum-forward-reference > > +DEFINE CLANGPDB_WARNING_OVERRIDES = -Wno-parentheses-equality > -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare > -Wno-empty-body -Wno-unused-const-variable -Wno-varargs > -Wno-unknown-warning-option -Wno-unused-but-set-variable > -Wno-unused-const-variable -Wno-unaligned-access > -Wno-unneeded-internal-declaration -Wno-microsoft-enum-forward-reference > > DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) > DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -funsigned-char > -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang > -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas > -Wno-incompatible-library-redeclaration -Wno-null-dereference > -mno-implicit-float -mms-bitfields -mno-stack-arg-probe -nostdlib > -nostdlibinc -fseh-exceptions > > > > ########################### > > AFAICT, CLANGPDB_WARNING_OVERRIDES gets included in > CLANGPDB_ALL_CC_FLAGS, which in turn gets included in all three of > DEBUG, RELEASE and NOOPT build target flags. > > The original report was "RELEASE CLANGPDB OVMF currently does not compile". > > Can we use "-Wno-unneeded-internal-declaration" with RELEASE builds only? > > Thanks, > Laszlo > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112306): https://edk2.groups.io/g/devel/message/112306 Mute This Topic: https://groups.io/mt/103087794/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- --000000000000505537060c3d747d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I believe this would be logically wrong, as the othe= r versions still wouldn't compile if you changed the relevant debug Pcd= s. (Which are logically independent of the compile and link options - e.g. = what if for some reason you wanted to single step with the Debug Pcds set t= o disabled, in a NOOPT build?)




On Mon, 11 Dec 2023, 15:00 Laszlo Ersek, &= lt;lersek@redhat.com> wrote:
On 12/10/23 11:18, Mike Beaton wrote:=
> From: Mike Beaton <mjsbeaton@gmail.com>
>
> This warning was already disabled in CLANGDWARF by commit
> d3225577123767fd09c91201d27e9c91663ae132.
>
> gcc can distinguish between optimised-away variable usage (as=C2=A0 ca= n occur in
> valid debug code) and genuinely unused variables, and only complains a= bout
> the latter. clang cannot, and therefore this warning ends up complaini= ng
> about valid debug code under clang.
>
> Since EDK-II code is in general going to be compiled by gcc as well as= clang
> then disabling this warning in clang does not amount to entirely remov= ing
> potentially valid warnings about genuinely unused variables.
>
> Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
> ---
>=C2=A0 BaseTools/Conf/tools_def.template | 2 +-
>=C2=A0 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_= def.template
> index c34ecfd557..48cf45245f 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -1754,7 +1754,7 @@ DEFINE CLANGPDB_X64_PREFIX=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0=3D ENV(CLANG_BIN)
>=C2=A0 DEFINE CLANGPDB_IA32_TARGET=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =3D -target i686-unknown-windows-gnu
>=C2=A0 DEFINE CLANGPDB_X64_TARGET=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0=3D -target x86_64-unknown-windows-gnu
>=C2=A0
> -DEFINE CLANGPDB_WARNING_OVERRIDES=C2=A0 =C2=A0 =3D -Wno-parentheses-e= quality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-c= ompare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown= -warning-option -Wno-unused-but-set-variable -Wno-unused-const-variable -Wn= o-unaligned-access -Wno-microsoft-enum-forward-reference
> +DEFINE CLANGPDB_WARNING_OVERRIDES=C2=A0 =C2=A0 =3D -Wno-parentheses-e= quality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-c= ompare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown= -warning-option -Wno-unused-but-set-variable -Wno-unused-const-variable -Wn= o-unaligned-access -Wno-unneeded-internal-declaration -Wno-microsoft-enum-f= orward-reference
>=C2=A0 DEFINE CLANGPDB_ALL_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =3D DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-prot= ector -funsigned-char -ftrap-function=3Dundefined_behavior_has_been_optimiz= ed_away_by_clang -Wno-address -Wno-shift-negative-value -Wno-unknown-pragma= s -Wno-incompatible-library-redeclaration -Wno-null-dereference -mno-implic= it-float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc -fseh-e= xceptions
>=C2=A0
>=C2=A0 ###########################

AFAICT, CLANGPDB_WARNING_OVERRIDES gets included in
CLANGPDB_ALL_CC_FLAGS, which in turn gets included in all three of
DEBUG, RELEASE and NOOPT build target flags.

The original report was "RELEASE CLANGPDB OVMF currently does not comp= ile".

Can we use "-Wno-unneeded-internal-declaration" with RELEASE buil= ds only?

Thanks,
Laszlo

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#112306) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--000000000000505537060c3d747d--