Move REPORT_DISSECTOR_BUG() body to proto_report_dissector_bug() function. Remove exceptions.h include from proto.h

svn path=/trunk/; revision=53231
This commit is contained in:
Jakub Zawadzki 2013-11-10 16:04:15 +00:00
parent ae59b09443
commit 6f6d04e2f9
2 changed files with 13 additions and 5 deletions

View File

@ -36,6 +36,7 @@
#include <ftypes/ftypes-int.h>
#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) {

View File

@ -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++.)