public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Mike Beaton" <mjsbeaton@gmail.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: devel@edk2.groups.io, ardb@google.com, lersek@redhat.com
Subject: Re: [edk2-devel] [PATCH] DebugLib: Allow -Wunneeded-internal-declaration with clang
Date: Tue, 12 Dec 2023 10:33:10 +0000	[thread overview]
Message-ID: <CAHzAAWQbsDgrEmY0yZd5xO+_9UNQqjcBkp7V8PJC=E75o+NLwA@mail.gmail.com> (raw)
In-Reply-To: <CAMj1kXHKKQAH3Xc_m1PuT3EqF_3hKxAksRA+fpf4D-j9i7ak-A@mail.gmail.com>

> 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/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-12-12 10:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  8:48 [edk2-devel] [PATCH] DebugLib: Allow -Wunneeded-internal-declaration with clang Mike Beaton
2023-12-12  9:26 ` Ard Biesheuvel
2023-12-12 10:33   ` Mike Beaton [this message]
2023-12-12 15:26     ` Laszlo Ersek
2023-12-12 12:57   ` Mike Beaton
2023-12-12 15:28     ` Laszlo Ersek
2023-12-12 15:33       ` Mike Beaton
2023-12-12 16:52         ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHzAAWQbsDgrEmY0yZd5xO+_9UNQqjcBkp7V8PJC=E75o+NLwA@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox