[patch] Error on setenv(..., NULL, ...)

Paul Eggert eggert@cs.ucla.edu
Mon Mar 16 04:11:00 GMT 2015


Paul Pluzhnikov wrote:
> I assume you also know about DIAG_PUSH_NEEDS_COMMENT /
> DIAG_POP_NEEDS_COMMENT, which then makes me not understand your
> comment about selective pacification.

When I tried to use those macros, I still got the warning and the build still 
failed.  Part of the problem is that 'vallen' gets used as part of an argument 
to the __mempcpy/memcpy macros, and GCC decides that since 'vallen' is used in 
the macro body, it'll issue a warning since the macro body is outside the 
"scope" of the DIAG_PUSH* and DIAG_POP* brackets.  It's the classic problem of 
macro capture.

I couldn't even use plain DIAG_IGNORE_NEEDS_COMMENT (i.e., without 
DIAG_PUSH_NEEDS_COMMENT), because I needed to put the #pragma before including 
<errno.h> (the first standard include) -- otherwise I got the warning -- and 
DIAG_IGNORE_NEEDS_COMMENT isn't defined until after <errno.h> is included.

I was using GCC 4.9.2 20150212 (Red Hat 4.9.2-6), for what that's worth.



More information about the Libc-alpha mailing list