This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/86377] extern int errno; is treated as buggy function declaration [-Werror=strict-prototypes]
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 02 Jul 2018 17:50:47 +0000
- Subject: [Bug c/86377] extern int errno; is treated as buggy function declaration [-Werror=strict-prototypes]
- Auto-submitted: auto-generated
- References: <bug-86377-4@http.gcc.gnu.org/bugzilla/>
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>