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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Vincent Lefèvre from comment #6)
> This is not specific to noreturn, because in C99, it didn't exist yet (I
> mean that in future C standards, you could have similar problems with other
> attributes).

And with any identifier.

> Also, note that identifiers that are not reserved should not be used,
> because they could be defined as macros by the developer, who has not tested
> his code with GCC (I'm saying GCC here, but this applies to any compiler).

Should not be used by who? For what purposes? In which contexts?

Users have to use non-reserved identifiers for their own code. A standard
library implementation needs to use the __noreturn__ form, but standard library
developers know that (well, except the darwin libc devs, PR 64883) and the GCC
manual is not aimed at them.

I think the specific case of noreturn could be addressed in the docs like so:

--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3233,6 +3233,10 @@ restored before calling the @code{noreturn} function.
 It does not make sense for a @code{noreturn} function to have a return
 type other than @code{void}.

+The C11 standard defines @code{noreturn} as a macro, in the header
+@code{<stdnoreturn.h>}, so to avoid conflicting with that macro, the
+reserved name form of the attribute can be used, @code{__noreturn__}.
+
 @item nothrow
 @cindex @code{nothrow} function attribute
 The @code{nothrow} attribute is used to inform the compiler that a


Eric's suggestion in comment 2 makes sense too, so that
__attribute__((noreturn)) still works even if the macro is defined and it gets
replaced with __attribute__((_Noreturn)).

Reply via email to