print_fields.h: add PRINT_FIELD_U_CAST

Add a macro for printing fields explicitly casted to specific type.
This is useful for bit fields, as otherwise the magic of *_extend_to_*
macros breaks.

* print_field.h (PRINT_FIELD_U_CAST): New macro.
This commit is contained in:
Eugene Syromyatnikov 2018-01-05 20:59:04 +01:00 committed by Dmitry V. Levin
parent 45532079c6
commit 03a7b946e2

View File

@ -44,6 +44,10 @@
STRACE_PRINTF("%s%s=%llu", (prefix_), #field_, \
zero_extend_signed_to_ull((where_).field_))
#define PRINT_FIELD_U_CAST(prefix_, where_, field_, type_) \
STRACE_PRINTF("%s%s=%llu", (prefix_), #field_, \
zero_extend_signed_to_ull((type_) (where_).field_))
#define PRINT_FIELD_X(prefix_, where_, field_) \
STRACE_PRINTF("%s%s=%#llx", (prefix_), #field_, \
zero_extend_signed_to_ull((where_).field_))