[RFC PATCH 04/12] print_fields.h: add PRINT_FIELD_LEN macro
Dmitry V. Levin
ldv at altlinux.org
Fri Jun 12 16:51:05 UTC 2020
On Fri, Jun 12, 2020 at 04:33:48PM +0200, Ákos Uzonyi wrote:
> * print_fields.h (PRINT_FIELD_LEN): New macro.
[...]
> diff --git a/print_fields.h b/print_fields.h
> index 02c56bf9..2de7d613 100644
> --- a/print_fields.h
> +++ b/print_fields.h
> @@ -277,4 +277,18 @@
> (size_), (hwtype_)); \
> } while (0)
>
> +# define PRINT_FIELD_LEN(prefix_, struct_t_, struct_val_, field_, len_, \
> + print_func_, args...) \
> +do { \
> + unsigned int start = offsetof(struct struct_t_, field_); \
> + unsigned int end = start + sizeof(struct_val_.field_); \
Isn't struct_t_ argument redundant?
Can struct struct_t_ be replaced with typeof(struct_val_)?
--
ldv
More information about the Strace-devel
mailing list