|
From: | Paul Eggert |
Subject: | Re: clang and _Noreturn |
Date: | Mon, 24 Apr 2017 18:08:18 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 |
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.
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?Don't some compilers complain if the storage class ('extern', here) is not first?GCC and clang, at least, prefer 'extern' after '[[noreturn]]'. Bruno
http://hg.code.sf.net/p/clisp/clisp/rev/c5ba2cfdd7fd?revcount=480
[Prev in Thread] | Current Thread | [Next in Thread] |