http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53182
Bug #: 53182
Summary: GNU C: attributes without underscores should be
discouraged / no longer be documented e.g. as examples
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
Attributes without underscores can conflict with the ISO C standard. For
instance, if the C11 <stdnoreturn.h> header is included, this breaks GCC's
__attribute__ ((noreturn))
(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
http://lists.gnu.org/archive/html/bug-gnulib/2012-05/msg00024.html
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));
to
void fatal () __attribute__ ((__noreturn__));
* Possibly issue a warning if an attribute without __ is used.