Define helper macros before they're used.

The code works if they're defined afterwards, but defining them earlier
makes it a bit clearer that they're helper macros used as components of
the macros we're exporting.

Change-Id: I326894eea67d2db43fedf4567699cd9eaaa0e004
Reviewed-on: https://code.wireshark.org/review/5956
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-12-21 13:44:46 -08:00
parent c96858b5fe
commit 5d30a3cb41
1 changed files with 12 additions and 12 deletions

View File

@ -137,6 +137,18 @@ WS_DLL_PUBLIC WS_MSVC_NORETURN void proto_report_dissector_bug(const char *messa
* @param expression expression to test in the assertion
*/
#define __DISSECTOR_ASSERT_STRINGIFY(s) # s
#define __DISSECTOR_ASSERT(expression, file, lineno) \
(REPORT_DISSECTOR_BUG( \
ep_strdup_printf("%s:%u: failed assertion \"%s\"", \
file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression))))
#define __DISSECTOR_ASSERT_HINT(expression, file, lineno, hint) \
(REPORT_DISSECTOR_BUG( \
ep_strdup_printf("%s:%u: failed assertion \"%s\" (%s)", \
file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression), hint)))
#define DISSECTOR_ASSERT(expression) \
((void) ((expression) ? (void)0 : \
__DISSECTOR_ASSERT (expression, __FILE__, __LINE__))) \
@ -219,18 +231,6 @@ WS_DLL_PUBLIC WS_MSVC_NORETURN void proto_report_dissector_bug(const char *messa
ep_strdup_printf("%s:%u: failed assertion "#a" "#op" "#b" ("fmt" "#op" "fmt")", \
__FILE__, __LINE__, (type)a, (type)b)))
#define __DISSECTOR_ASSERT_STRINGIFY(s) # s
#define __DISSECTOR_ASSERT(expression, file, lineno) \
(REPORT_DISSECTOR_BUG( \
ep_strdup_printf("%s:%u: failed assertion \"%s\"", \
file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression))))
#define __DISSECTOR_ASSERT_HINT(expression, file, lineno, hint) \
(REPORT_DISSECTOR_BUG( \
ep_strdup_printf("%s:%u: failed assertion \"%s\" (%s)", \
file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression), hint)))
/*
* The encoding of a field of a particular type may involve more
* than just whether it's big-endian or little-endian and its size.