Clean-up: common: fix -Wshadow errors in event-field-value.c
We get this when building with -Wshadow:
CC event-field-value.lo
In file included from /home/simark/src/lttng-tools/src/common/error.h:19,
from /home/simark/src/lttng-tools/src/common/event-field-value.c:17:
/home/simark/src/lttng-tools/src/common/event-field-value.c: In function ‘lttng_event_field_value_unsigned_int_get_value’:
/home/simark/src/lttng-tools/src/common/macros.h:55:42: error: declaration of ‘__ptr’ shadows a previous local [-Werror=shadow]
55 | const typeof(((type *)NULL)->member) * __ptr = (ptr); \
| ^~~~~
/home/simark/src/lttng-tools/src/common/event-field-value.c:390:10: note: in expansion of macro ‘container_of’
390 | *val = container_of(
| ^~~~~~~~~~~~
/home/simark/src/lttng-tools/src/common/event-field-value.c:391:5: note: in expansion of macro ‘container_of’
391 | container_of(field_val,
| ^~~~~~~~~~~~
/home/simark/src/lttng-tools/src/common/macros.h:55:42: note: shadowed declaration is here
55 | const typeof(((type *)NULL)->member) * __ptr = (ptr); \
| ^~~~~
/home/simark/src/lttng-tools/src/common/event-field-value.c:390:10: note: in expansion of macro ‘container_of’
390 | *val = container_of(
| ^~~~~~~~~~~~
This is because of the nested use of container_of, causing two temporary
__ptr variables to be declared in the same scope. Fix it by assigning
results of container_of to temporary variables. I think the temporary
variables make it more readable anyway, showing what's going on.
Change-Id: I7b66bc40227a4c76b7f5416a911dcdc696f4efc8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.025697 seconds and 4 git commands to generate.