From: "Marvin Häuser" <mhaeuser@posteo.de>
To: devel@edk2.groups.io, mcb30@ipxe.org
Cc: michael.d.kinney@intel.com, krichanov@ispras.ru,
gaoliming@byosoft.com.cn, "Liu,
Zhiguang" <zhiguang.liu@intel.com>,
vit9696@protonmail.com
Subject: Re: [edk2-devel] [PATCH] MdePkg: DebugLib: Compilation fix for clang-13.
Date: Tue, 23 Nov 2021 06:41:14 +0000 (UTC) [thread overview]
Message-ID: <b3510e57-b9df-4e32-b7f7-30c557ff9a28@posteo.de> (raw)
In-Reply-To: <8d9101ac-fbda-eecf-950e-692fa375c3f9@ipxe.org>
23.11.2021 00:17:30 Michael Brown <mcb30@ipxe.org>:
> On 22/11/2021 16:42, Michael D Kinney wrote:
>> You are also modifying the DebugLib in the paths where ASSERT() macros
>> are disabled. When they are disabled, we want all code/data associated
>> with ASSERT() to be removed by the optimizing compiler/linker. The source
>> code change appears to force a reference to a variable/expression. Does
>> this have any size impact to any of the toolchains when ASSERT() is
>> disabled? Can you provide the size comparison before and after this
>> change?
>
> I would very strongly recommend having the non-debug version of the macro use something like:
>
> #define ASSERT(Expression) do { \
> if (FALSE) { \
> (VOID) (Expression); \
> } \
> } while (FALSE)
>
> Without the "if (FALSE)", you will find that an expression that may have side-effects (e.g. by calling an external function) will result in executable code being generated.
In theory +1, but don't some compilers generate "unreachable code" warnings for this? I unfortunately cannot check them all right now. Maybe guards push/pop'ing the warning for that need to be defined, that are only allowed to be used with explicit documentation why they are necessary?
Best regards,
Marvin
>
> Michael
>
>
>
next prev parent reply other threads:[~2021-11-23 6:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211119090529.2865-1-krichanov@ispras.ru>
2021-11-19 16:51 ` [PATCH] MdePkg: DebugLib: Compilation fix for clang-13 Michael D Kinney
[not found] ` <db6fe4e5b31c28a6bcdb1f189cfcd5b1@ispras.ru>
2021-11-22 16:42 ` Michael D Kinney
2021-11-22 23:17 ` [edk2-devel] " Michael Brown
2021-11-23 6:41 ` Marvin Häuser [this message]
2021-11-23 11:40 ` Michael Brown
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=b3510e57-b9df-4e32-b7f7-30c557ff9a28@posteo.de \
--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