* [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang
@ 2023-05-10 14:50 Ard Biesheuvel
2023-05-10 14:54 ` Rebecca Cran
2023-05-11 4:55 ` Gerd Hoffmann
0 siblings, 2 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2023-05-10 14:50 UTC (permalink / raw)
To: devel; +Cc: Ard Biesheuvel, Rebecca Cran, Gerd Hoffmann, Liming Gao
The warnings Clang emits when enabling -Wunneeded-internal-declaration
(which is part of -Wall) are generating false positives for variables
whose size gets taken but are not referenced beyond that.
This may happen legitimately in debug code, so let's disable this
warning for Clang, rather than tiptoe around it in the code base.
This fixes the RELEASE build for OVMF, which triggers this issue in the
newly added VirtioSerialDxe driver.
Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
Reproducer: https://godbolt.org/z/zx6qqjKrK
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 b3c822f0bc20046d..65dde57631fb6c95 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1858,7 +1858,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
DEFINE CLANGDWARF_IA32_TARGET = -target i686-pc-linux-gnu
DEFINE CLANGDWARF_X64_TARGET = -target x86_64-pc-linux-gnu
-DEFINE CLANGDWARF_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
+DEFINE CLANGDWARF_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
DEFINE CLANGDWARF_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGDWARF_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference
###########################
--
2.39.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang
2023-05-10 14:50 [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang Ard Biesheuvel
@ 2023-05-10 14:54 ` Rebecca Cran
2023-05-11 4:55 ` Gerd Hoffmann
1 sibling, 0 replies; 5+ messages in thread
From: Rebecca Cran @ 2023-05-10 14:54 UTC (permalink / raw)
To: Ard Biesheuvel, devel; +Cc: Gerd Hoffmann, Liming Gao
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
This should go in for the edk2-stable202305 release.
--
Rebecca Cran
On 5/10/23 08:50, Ard Biesheuvel wrote:
> The warnings Clang emits when enabling -Wunneeded-internal-declaration
> (which is part of -Wall) are generating false positives for variables
> whose size gets taken but are not referenced beyond that.
>
> This may happen legitimately in debug code, so let's disable this
> warning for Clang, rather than tiptoe around it in the code base.
>
> This fixes the RELEASE build for OVMF, which triggers this issue in the
> newly added VirtioSerialDxe driver.
>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> Reproducer: https://godbolt.org/z/zx6qqjKrK
>
> 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 b3c822f0bc20046d..65dde57631fb6c95 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -1858,7 +1858,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
> DEFINE CLANGDWARF_IA32_TARGET = -target i686-pc-linux-gnu
>
> DEFINE CLANGDWARF_X64_TARGET = -target x86_64-pc-linux-gnu
>
>
>
> -DEFINE CLANGDWARF_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
>
> +DEFINE CLANGDWARF_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
>
> DEFINE CLANGDWARF_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGDWARF_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference
>
>
>
> ###########################
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang
2023-05-10 14:50 [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang Ard Biesheuvel
2023-05-10 14:54 ` Rebecca Cran
@ 2023-05-11 4:55 ` Gerd Hoffmann
2023-05-12 6:39 ` [edk2-devel] " Ard Biesheuvel
1 sibling, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2023-05-11 4:55 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: devel, Rebecca Cran, Liming Gao
On Wed, May 10, 2023 at 04:50:08PM +0200, Ard Biesheuvel wrote:
> The warnings Clang emits when enabling -Wunneeded-internal-declaration
> (which is part of -Wall) are generating false positives for variables
> whose size gets taken but are not referenced beyond that.
>
> This may happen legitimately in debug code, so let's disable this
> warning for Clang, rather than tiptoe around it in the code base.
>
> This fixes the RELEASE build for OVMF, which triggers this issue in the
> newly added VirtioSerialDxe driver.
>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang
2023-05-11 4:55 ` Gerd Hoffmann
@ 2023-05-12 6:39 ` Ard Biesheuvel
2023-05-15 0:55 ` 回复: " gaoliming
0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2023-05-12 6:39 UTC (permalink / raw)
To: devel, kraxel; +Cc: Rebecca Cran, Liming Gao
Liming:
I'd like to merge this one for the stable tag - any objections?
On Thu, 11 May 2023 at 06:55, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> On Wed, May 10, 2023 at 04:50:08PM +0200, Ard Biesheuvel wrote:
> > The warnings Clang emits when enabling -Wunneeded-internal-declaration
> > (which is part of -Wall) are generating false positives for variables
> > whose size gets taken but are not referenced beyond that.
> >
> > This may happen legitimately in debug code, so let's disable this
> > warning for Clang, rather than tiptoe around it in the code base.
> >
> > This fixes the RELEASE build for OVMF, which triggers this issue in the
> > newly added VirtioSerialDxe driver.
> >
> > Cc: Rebecca Cran <rebecca@bsdio.com>
> > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
>
> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* 回复: [edk2-devel] [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang
2023-05-12 6:39 ` [edk2-devel] " Ard Biesheuvel
@ 2023-05-15 0:55 ` gaoliming
0 siblings, 0 replies; 5+ messages in thread
From: gaoliming @ 2023-05-15 0:55 UTC (permalink / raw)
To: devel, ardb, kraxel; +Cc: 'Rebecca Cran'
Ard:
I am OK.
Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Ard
> Biesheuvel
> 发送时间: 2023年5月12日 14:40
> 收件人: devel@edk2.groups.io; kraxel@redhat.com
> 抄送: Rebecca Cran <rebecca@bsdio.com>; Liming Gao
> <gaoliming@byosoft.com.cn>
> 主题: Re: [edk2-devel] [PATCH] BaseTools/tools_def: Disable overzealous
> unused variable warning on Clang
>
> Liming:
>
> I'd like to merge this one for the stable tag - any objections?
>
>
> On Thu, 11 May 2023 at 06:55, Gerd Hoffmann <kraxel@redhat.com> wrote:
> >
> > On Wed, May 10, 2023 at 04:50:08PM +0200, Ard Biesheuvel wrote:
> > > The warnings Clang emits when enabling
> -Wunneeded-internal-declaration
> > > (which is part of -Wall) are generating false positives for variables
> > > whose size gets taken but are not referenced beyond that.
> > >
> > > This may happen legitimately in debug code, so let's disable this
> > > warning for Clang, rather than tiptoe around it in the code base.
> > >
> > > This fixes the RELEASE build for OVMF, which triggers this issue in the
> > > newly added VirtioSerialDxe driver.
> > >
> > > Cc: Rebecca Cran <rebecca@bsdio.com>
> > > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> >
> > Acked-by: Gerd Hoffmann <kraxel@redhat.com>
> >
> >
> >
> >
> >
> >
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-15 0:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-10 14:50 [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang Ard Biesheuvel
2023-05-10 14:54 ` Rebecca Cran
2023-05-11 4:55 ` Gerd Hoffmann
2023-05-12 6:39 ` [edk2-devel] " Ard Biesheuvel
2023-05-15 0:55 ` 回复: " gaoliming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox