Wireshark mailing list archives

Re: [Wireshark-commits] rev 46606: /trunk/epan/wmem/ /trunk/epan/wmem/: wmem_core.c


From: Guy Harris <guy () alum mit edu>
Date: Tue, 18 Dec 2012 21:57:54 -0800



On Dec 18, 2012, at 9:12 PM, Bill Meier <wmeier () newsguy com> 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?

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: