> This seems redundant to me. Either we set the pragma and the compiler
> does not care, or we don't, and rely on the fact that the compiler can
> infer that 'Expression' will never be evaluated at runtime, but won't
> complain about symbols that are only referenced via 'Expression' and
> nowhere else.

I thought so too on initially reading the code, so I tried removing
the pragmas, and in fact the pragma is to tell the compiler not to
warn about the contained `(VOID) Expression`, not to fix the actual
problem warning - which `(VOID) Expression` itself does, once allowed.

So without the pragmas we get instead errors such as:

```
/home/mjsbeaton/OpenSource/edk2/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c:444:86:
error: expression result unused; should this cast be to 'void'?
[-Werror,-Wunused-value]
  DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Loading DXE CORE at 0x%11p
EntryPoint=0x%11p\n", (VOID *)(UINTN)DxeCoreAddress,
FUNCTION_ENTRY_POINT (DxeCoreEntryPoint)));

              ^     ~
/home/mjsbeaton/OpenSource/edk2/MdePkg/Include/Library/DebugLib.h:432:16:
note: expanded from macro 'DEBUG'
        (VOID) Expression;                                 \
               ^
1 error generated.
```


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112387): https://edk2.groups.io/g/devel/message/112387
Mute This Topic: https://groups.io/mt/103126777/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to