On 04/24/2017 01:38 PM, Bruno Haible wrote:
Hi Paul,
the only position that works for both C and C++ is the first one:
_GL_NORETURN_FUNC extern void foo (void);
Maybe a shorter name for this usage: _GL_NORETURN, perhaps?
If we want to offer a short macro name, such as _GL_NORETURN, it should
be usable in both places, function declarations and function pointers.
That is, make it an alias of _GL_NORETURN_FUNCPTR.
But that may not work best for function definitions and declarations,
for compilers that don't support __attribute__ ((__noreturn__)).
Function pointers are relatively rare compared to function definitions
and declarations, so a short name is more-important for the latter.
Don't some compilers complain if the storage class ('extern', here) is
not first?
GCC and clang, at least, prefer 'extern' after '[[noreturn]]'.
Bruno
I vaguely recall problems with putting _Noreturn first, maybe for
compilers that lacked native _Noreturn. Why, for example, was this patch
made to clisp in 2011?
http://hg.code.sf.net/p/clisp/clisp/rev/c5ba2cfdd7fd?revcount=480