Joe:

 Can you clarify your usage about GLOBAL_REMOVE_IF_UNREFERENCED? With this change, the warning of unused variable will not be reported if the unused variable with this attribute. Is it right?

 

Thanks

Liming

发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 JoeX Lu
发送时间: 2023428 13:54
收件人: Pedro Falcato <pedro.falcato@gmail.com>; devel@edk2.groups.io
主题: Re: [edk2-devel] [PATCH] Support GLOBAL_REMOVE_IF_UNREFERENCED in GCC5/11

 

Hi Pedro,
  Thanks for your comment.

  I hope this attribute can silent Wunused in GCC build.

  Because it will be nice to declaim GLOBAL_REMOVE_IF_UNREFERENCED before unusd variable than #ifdef

 example1:

 

#ifdef (UNUSED_CONDITION)

  static Boolean samplvariable;  // which will be triggered the Wunused warning message in GCC

#endif

example2:

  GLOBAL_REMOVE_IF_UNREFERENCED  static Boolean samplvariable; // which will be triggered the Wunused warning message in GCC

  I think example2 will be better than example1.

 

Best Regards,

Joe Lu