This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/51437] GCC should warn on the use of reserved identifier/macro names
- From: "bugdal at aerifal dot cx" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 19 Feb 2012 05:47:18 +0000
- Subject: [Bug c/51437] GCC should warn on the use of reserved identifier/macro names
- Auto-submitted: auto-generated
- References: <bug-51437-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51437
--- Comment #8 from Rich Felker <bugdal at aerifal dot cx> 2012-02-19 05:47:18 UTC ---
You really do want to flag both definition and usage. For instance, there's
plenty of buggy software (especially GNU software like binutils) using __pid_t
and similar when it should be using pid_t, etc.
>From an undefined behavior standpoint, defining a name in the reserved
namespace is no worse than using a name in the referred namespace assuming the
implementation has defined it. Both are incorrect C usage and both should be
flagged.
My heuristic about -isystem would prevent flagging usage of reserved names
resulting from implementations of system headers - for instance, if a macro in
a system header used __uint32_t because it needs to avoid making uint32_t
visible.