Wireshark mailing list archives

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


From: Bill Meier <wmeier () newsguy com>
Date: Wed, 19 Dec 2012 00:12:30 -0500

On 12/18/2012 11:48 PM, Bill Meier wrote:
On 12/18/2012 11:43 PM, Guy Harris wrote:

On Dec 18, 2012, at 5:08 PM, eapache () wireshark org wrote:

http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=46606



User: eapache
Date: 2012/12/18 05:08 PM

Log: Try to fix windows builds - MSVC doesn't like
g_assert_not_reached() ?


MSVC doesn't understand that it never returns.  I don't know whether
there's a way to tell MSVC that a function never returns,

There is: Wireshark uses it in a few places:

See #define MSVC_NORETURN in config.h


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.


We now return back to our regularly scheduled program ....
___________________________________________________________________________
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: