GCC Bugzilla – Bug 53182
GNU C: attributes without underscores should be discouraged / no longer be documented e.g. as examples
Last modified: 2012-05-02 13:27:28 UTC
Attributes without underscores can conflict with the ISO C standard. For instance, if the C11 <stdnoreturn.h> header is included, this breaks GCC's
(such problems may occur in particular if different libraries, with different expectations, are used). To avoid such a clash, only the __noreturn__ version should be used. Other attributes without __ may also lead to conflicts with a future C standard. You can see
and the corresponding discussion, from which I've reported this bug.
I suggest the following changes:
* Fix the GCC manual: the versions without __ should be discouraged (explain why) and the examples should always use the __ version, e.g. change
void fatal () __attribute__ ((noreturn));
void fatal () __attribute__ ((__noreturn__));
* Possibly issue a warning if an attribute without __ is used.
It would also help to add an attribute named __attribute__((_Noreturn)) (and therefore also adding __attribute__((___Noreturn__)), of course), for this particular instance of <stdnoreturn.h> vs. existing code.