[edk2-devel] [PATCH V2] DebugLib: Allow -Wunneeded-internal-declaration with clang

2023-12-12 Thread Mike Beaton
From: Mikhail Krichanov Provides a variant of the DEBUG macro for clang when MDEPKG_NDEBUG is defined, which uses but discards the contained expression. This means clang can tell that it has optimised away variable usage as part of valid debug patterns (such as a STATIC variable which is only use

Re: [edk2-devel] [PATCH V2] DebugLib: Allow -Wunneeded-internal-declaration with clang

2023-12-12 Thread Mike Beaton
On Tue, 12 Dec 2023 at 21:45, wrote: > > From: Mikhail Krichanov > > Provides a variant of the DEBUG macro for clang when MDEPKG_NDEBUG is > defined, which uses but discards the contained expression. This means > clang can tell that it has optimised away variable usage as part of > valid debug pa

Re: [edk2-devel] [PATCH V2] DebugLib: Allow -Wunneeded-internal-declaration with clang

2023-12-12 Thread Ard Biesheuvel
On Tue, 12 Dec 2023 at 22:46, Mike Beaton wrote: > > From: Mikhail Krichanov > > Provides a variant of the DEBUG macro for clang when MDEPKG_NDEBUG is > defined, which uses but discards the contained expression. This means > clang can tell that it has optimised away variable usage as part of > va

Re: [edk2-devel] [PATCH V2] DebugLib: Allow -Wunneeded-internal-declaration with clang

2023-12-12 Thread Mike Beaton
> > +#define DEBUG(Expression)\ > > +do { \ > > + _Pragma("GCC diagnostic push") \ > > + _Pragma("GCC diagnostic ignored \"-Wunused-value\"") \ > > + if ((FALSE)) {