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.

Michael


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


Reply via email to