On 18/03/16 22:30, Laszlo Ersek wrote:
Unfortunately, I've run into a big issue: the DEBUG(()) macro. (To a
smaller extent, the ASSERT_EFI_ERROR() macro as well.) These macros
expand to the null replacement string when MDEPKG_NDEBUG is defined
(which is occasionally the case for RELEASE builds). If those macro
invocations constitute the only read accesses to some local variables,
then the MDEPKG_NDEBUG build triggers "-Wunused-but-set-variable".

For ASSERT_EFI_ERROR(), I could work it around like this:

   ((VOID)(TRUE ? 0 : (StatusParameter)))

but I have no clue how to do the same with DEBUG(), which can receive
any number of arguments (of any type too).

With the caveat that I haven't looked at how DEBUG() is implemented in EDK2:

Could this rely upon dead code elimination? At least gcc will happily accept something which expands to

  if ( 0 ) {
     do_something_with ( a_variable );
  }

and treat that as being a "use" of a_variable (for the purposes of -Wunused-but-set-variable).

Michael
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to