diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-12-21 13:44:46 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-12-21 21:45:09 +0000 |
commit | 5d30a3cb41afdf2dc4ecc03116bb4e792d3344fb (patch) | |
tree | 543985fbcd6cda6949b7cfc72c108a55eb47daae /epan/proto.h | |
parent | c96858b5fe9d60ef66c42d93000813249d7363af (diff) |
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>
Diffstat (limited to 'epan/proto.h')
-rw-r--r-- | epan/proto.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/epan/proto.h b/epan/proto.h index 9512ba5380..e24394b3cd 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -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. |