public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] OvmfPkg/VirtioSerialDxe: fix RELEASE build error
@ 2023-05-10  7:33 Gerd Hoffmann
  2023-05-10  7:39 ` [edk2-devel] " Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2023-05-10  7:33 UTC (permalink / raw)
  To: devel
  Cc: Pawel Polawski, Gerd Hoffmann, Ard Biesheuvel, Jordan Justen,
	Oliver Steffen, Jiewen Yao, Rebecca Cran

EventNames is used to pretty-print debug log messages.
Add #ifdef to only include it in debug builds.
Fixes a clang build failure.

Reported-by: Rebecca Cran <rebecca@bsdio.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/VirtioSerialDxe/VirtioSerial.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/OvmfPkg/VirtioSerialDxe/VirtioSerial.c b/OvmfPkg/VirtioSerialDxe/VirtioSerial.c
index bfb2b324eadf..5fb4ce31914b 100644
--- a/OvmfPkg/VirtioSerialDxe/VirtioSerial.c
+++ b/OvmfPkg/VirtioSerialDxe/VirtioSerial.c
@@ -25,6 +25,7 @@
 
 STATIC LIST_ENTRY  mVirtioSerialList;
 
+#if !defined (MDEPKG_NDEBUG)
 STATIC CONST CHAR8  *EventNames[] = {
   [VIRTIO_SERIAL_DEVICE_READY]  = "device-ready",
   [VIRTIO_SERIAL_DEVICE_ADD]    = "device-add",
@@ -35,6 +36,7 @@ STATIC CONST CHAR8  *EventNames[] = {
   [VIRTIO_SERIAL_PORT_OPEN]     = "port-open",
   [VIRTIO_SERIAL_PORT_NAME]     = "port-name",
 };
+#endif
 
 VOID
 EFIAPI
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/VirtioSerialDxe: fix RELEASE build error
  2023-05-10  7:33 [PATCH 1/1] OvmfPkg/VirtioSerialDxe: fix RELEASE build error Gerd Hoffmann
@ 2023-05-10  7:39 ` Ard Biesheuvel
  2023-05-10  9:18   ` Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2023-05-10  7:39 UTC (permalink / raw)
  To: devel, kraxel
  Cc: Pawel Polawski, Ard Biesheuvel, Jordan Justen, Oliver Steffen,
	Jiewen Yao, Rebecca Cran

On Wed, 10 May 2023 at 09:34, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> EventNames is used to pretty-print debug log messages.
> Add #ifdef to only include it in debug builds.
> Fixes a clang build failure.
>
> Reported-by: Rebecca Cran <rebecca@bsdio.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Queued up as #4381 - thanks.


> ---
>  OvmfPkg/VirtioSerialDxe/VirtioSerial.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/OvmfPkg/VirtioSerialDxe/VirtioSerial.c b/OvmfPkg/VirtioSerialDxe/VirtioSerial.c
> index bfb2b324eadf..5fb4ce31914b 100644
> --- a/OvmfPkg/VirtioSerialDxe/VirtioSerial.c
> +++ b/OvmfPkg/VirtioSerialDxe/VirtioSerial.c
> @@ -25,6 +25,7 @@
>
>  STATIC LIST_ENTRY  mVirtioSerialList;
>
> +#if !defined (MDEPKG_NDEBUG)
>  STATIC CONST CHAR8  *EventNames[] = {
>    [VIRTIO_SERIAL_DEVICE_READY]  = "device-ready",
>    [VIRTIO_SERIAL_DEVICE_ADD]    = "device-add",
> @@ -35,6 +36,7 @@ STATIC CONST CHAR8  *EventNames[] = {
>    [VIRTIO_SERIAL_PORT_OPEN]     = "port-open",
>    [VIRTIO_SERIAL_PORT_NAME]     = "port-name",
>  };
> +#endif
>
>  VOID
>  EFIAPI
> --
> 2.40.1
>
>
>
> 
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/VirtioSerialDxe: fix RELEASE build error
  2023-05-10  7:39 ` [edk2-devel] " Ard Biesheuvel
@ 2023-05-10  9:18   ` Ard Biesheuvel
  2023-05-10 13:54     ` Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2023-05-10  9:18 UTC (permalink / raw)
  To: devel, kraxel
  Cc: Pawel Polawski, Ard Biesheuvel, Jordan Justen, Oliver Steffen,
	Jiewen Yao, Rebecca Cran

On Wed, 10 May 2023 at 09:39, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Wed, 10 May 2023 at 09:34, Gerd Hoffmann <kraxel@redhat.com> wrote:
> >
> > EventNames is used to pretty-print debug log messages.
> > Add #ifdef to only include it in debug builds.
> > Fixes a clang build failure.
> >
> > Reported-by: Rebecca Cran <rebecca@bsdio.com>
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>
> Queued up as #4381 - thanks.
>

This appears to break the build

https://github.com/tianocore/edk2/pull/4381

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/VirtioSerialDxe: fix RELEASE build error
  2023-05-10  9:18   ` Ard Biesheuvel
@ 2023-05-10 13:54     ` Ard Biesheuvel
  2023-05-10 15:06       ` Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2023-05-10 13:54 UTC (permalink / raw)
  To: devel, kraxel
  Cc: Pawel Polawski, Ard Biesheuvel, Jordan Justen, Oliver Steffen,
	Jiewen Yao, Rebecca Cran

On Wed, 10 May 2023 at 11:18, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Wed, 10 May 2023 at 09:39, Ard Biesheuvel <ardb@kernel.org> wrote:
> >
> > On Wed, 10 May 2023 at 09:34, Gerd Hoffmann <kraxel@redhat.com> wrote:
> > >
> > > EventNames is used to pretty-print debug log messages.
> > > Add #ifdef to only include it in debug builds.
> > > Fixes a clang build failure.
> > >
> > > Reported-by: Rebecca Cran <rebecca@bsdio.com>
> > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> >
> > Queued up as #4381 - thanks.
> >
>
> This appears to break the build
>
> https://github.com/tianocore/edk2/pull/4381

Actually, looking at the code, I think the Clang diagnostic is highly
dubious here. The non-DEBUG code takes the ARRAY_SIZE() of EventNames,
and so the #ifdef will result in a compiler error.

I suppose we can work around this, but we might also just add
-Wunneeded-internal-declaration to the clang cflags for RELEASE

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/VirtioSerialDxe: fix RELEASE build error
  2023-05-10 13:54     ` Ard Biesheuvel
@ 2023-05-10 15:06       ` Ard Biesheuvel
  0 siblings, 0 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2023-05-10 15:06 UTC (permalink / raw)
  To: devel, kraxel
  Cc: Pawel Polawski, Ard Biesheuvel, Jordan Justen, Oliver Steffen,
	Jiewen Yao, Rebecca Cran

On Wed, 10 May 2023 at 15:54, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Wed, 10 May 2023 at 11:18, Ard Biesheuvel <ardb@kernel.org> wrote:
> >
> > On Wed, 10 May 2023 at 09:39, Ard Biesheuvel <ardb@kernel.org> wrote:
> > >
> > > On Wed, 10 May 2023 at 09:34, Gerd Hoffmann <kraxel@redhat.com> wrote:
> > > >
> > > > EventNames is used to pretty-print debug log messages.
> > > > Add #ifdef to only include it in debug builds.
> > > > Fixes a clang build failure.
> > > >
> > > > Reported-by: Rebecca Cran <rebecca@bsdio.com>
> > > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > >
> > > Queued up as #4381 - thanks.
> > >
> >
> > This appears to break the build
> >
> > https://github.com/tianocore/edk2/pull/4381
>
> Actually, looking at the code, I think the Clang diagnostic is highly
> dubious here. The non-DEBUG code takes the ARRAY_SIZE() of EventNames,
> and so the #ifdef will result in a compiler error.
>
> I suppose we can work around this, but we might also just add
> -Wunneeded-internal-declaration to the clang cflags for RELEASE

I've sent a BaseTools patch for this - I suggest we merge that and
drop this one.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-10 15:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-10  7:33 [PATCH 1/1] OvmfPkg/VirtioSerialDxe: fix RELEASE build error Gerd Hoffmann
2023-05-10  7:39 ` [edk2-devel] " Ard Biesheuvel
2023-05-10  9:18   ` Ard Biesheuvel
2023-05-10 13:54     ` Ard Biesheuvel
2023-05-10 15:06       ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox