From 6f6d04e2f9585f603e713198938197821328c1b5 Mon Sep 17 00:00:00 2001 From: Jakub Zawadzki Date: Sun, 10 Nov 2013 16:04:15 +0000 Subject: [PATCH] Move REPORT_DISSECTOR_BUG() body to proto_report_dissector_bug() function. Remove exceptions.h include from proto.h svn path=/trunk/; revision=53231 --- epan/proto.c | 9 +++++++++ epan/proto.h | 9 ++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/epan/proto.c b/epan/proto.c index 0692af086f..d150b01cda 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -36,6 +36,7 @@ #include #include "packet.h" +#include "exceptions.h" #include "ptvcursor.h" #include "strutil.h" #include "addr_resolv.h" @@ -1050,6 +1051,14 @@ proto_tree_add_debug_text(proto_tree *tree, const char *format, ...) return pi; } +void proto_report_dissector_bug(const char *message) +{ + if (getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) + abort(); + else + THROW_MESSAGE(DissectorError, message); +} + /* We could probably get away with changing is_error to a minimum length value. */ static void report_type_length_mismatch(proto_tree *tree, const gchar *descr, int length, gboolean is_error) { diff --git a/epan/proto.h b/epan/proto.h index de42b8e350..32de2c9413 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -55,7 +55,6 @@ #include "ftypes/ftypes.h" #include "register.h" #include "ws_symbol_export.h" -#include "exceptions.h" #ifdef __cplusplus extern "C" { @@ -106,7 +105,7 @@ typedef struct _protocol protocol_t; } \ } -/** Macro used for reporting errors in dissectors; it throws a +/** Function used for reporting errors in dissectors; it throws a * DissectorError exception, with the string passed as an argument * as the message for the exception, so that it can show up in * the Info column and the protocol tree. @@ -119,10 +118,10 @@ typedef struct _protocol protocol_t; * * @param message string to use as the message */ +WS_DLL_PUBLIC WS_MSVC_NORETURN void proto_report_dissector_bug(const char *message) G_GNUC_NORETURN; + #define REPORT_DISSECTOR_BUG(message) \ - ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ - abort() : \ - THROW_MESSAGE(DissectorError, message)) + proto_report_dissector_bug(message) /** Macro used to provide a hint to static analysis tools. * (Currently only Visual C++.)