[Bug c/86377] extern int errno; is treated as buggy function declaration [-Werror=strict-prototypes]

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 2 17:50:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86377

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
In fact <errno.h> is required to define it as a macro in C, and a footnote
says:
"The macro errno need not be the identifier of an object. It might expand to a
modifiable lvalue resulting from a function call (for example, *errno())."

Also since 'errno' is reserved as an identifier with external linkage, the
declaration in your program has undefined behaviour even if you don't include
<errno.h>


More information about the Gcc-bugs mailing list