Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 46606: /trunk/epan/wmem/ /trunk/epan

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Tue, 18 Dec 2012 21:57:54 -0800

On Dec 18, 2012, at 9:12 PM, Bill Meier <wmeier@xxxxxxxxxxx> wrote:

> Looking a little deeper at GLib I see the following in one of the GLib .h files
> 
> void    g_assertion_message             (const char     *domain,
>                                         const char     *file,
>                                         int             line,
>                                         const char     *func,
>                                         const char     *message) G_GNUC_NORETURN;
> 
> 
> I suspect getting GLib to do something like G_MSVC_NORETURN is just not going to happen.

> 
> It does appear that the gcc noreturn attribute can preceed the funcion name (contrary to the comment in config.h).
> 
> From: http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Attribute-Syntax.html
> 
>     __attribute__((noreturn)) void d0 (void),
>         __attribute__((format(printf, 1, 2))) d1 (const char *, ...),
>          d2 (void)
> 
> "The noreturn attribute applies to all the functions declared; the format attribute only applies to d1. "
> 
> So: maybe one NORETURN macro def (expanding differently) could be used for both MSVC & GCC.

Would the Glib folks do something like

	#if     __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
	#define G_NORETURN __attribute__((__noreturn__))
	#elif defined(_MSC_VER) && (_MSC_VER >= {whatever})
	#define G_NORETURN __declspec(noreturn)
	#else
	#define G_NORETURN
	#endif

with G_NORETURN specified as going before the function, and, for all declarations with G_GNUC_NORETURN, replacing that with G_NORETURN going before the function?