How to avoid "the address of 'foo' will never be NULL" warning inside macros?

Jonathan Wakely jwakely.gcc@gmail.com
Thu Jun 9 12:52:00 GMT 2011


On 9 June 2011 09:15, Steffen Dettmer wrote:
>
> - implementing the macro as function would probably help but may
>  cause overhead and may have additional effects

http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gcc/Inline.html

> - implementing the macro as function for gcc of gcc-4.6.0 only
>  seems to be ugly and needlessly conditional
>
> - disabling the warning would (I guess) also affect when checking
>  addresses without using macros

Not if you do it locally in the macro only, using _Pragma
http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gcc/Diagnostic-Pragmas.html



More information about the Gcc-help mailing list