From: Simon Marchi Date: Mon, 23 Aug 2021 18:01:17 +0000 (-0400) Subject: configure: add -Wno-gnu-folding-constant X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d0004d4bfc7d0f7e411b905b83da56d336768238;p=lttng-tools.git configure: add -Wno-gnu-folding-constant When building with clang 12, I get: CC tp.o In file included from /home/simark/src/lttng-tools/tests/utils/testapp/gen-ust-events/tp.c:10: In file included from /home/simark/src/lttng-tools/tests/utils/testapp/gen-ust-events/./tp.h:75: In file included from /tmp/lttng/include/lttng/tracepoint-event.h:69: In file included from /tmp/lttng/include/lttng/ust-tracepoint-event.h:1021: /home/simark/src/lttng-tools/tests/utils/testapp/gen-ust-events/./tp.h:30:1: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant] TRACEPOINT_EVENT(tp, tptest, ^ /tmp/lttng/include/lttng/tracepoint.h:791:27: note: expanded from macro 'TRACEPOINT_EVENT' #define TRACEPOINT_EVENT LTTNG_UST_TRACEPOINT_EVENT ^ /tmp/lttng/include/lttng/ust-tracepoint-event.h:84:2: note: expanded from macro 'LTTNG_UST_TRACEPOINT_EVENT' LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, \ ^ /tmp/lttng/include/lttng/ust-tracepoint-event.h:940:10: note: expanded from macro 'LTTNG_UST__TRACEPOINT_EVENT_CLASS' size_t __dynamic_len[__num_fields]; \ ^ From what I understand, this warning simply says that the compiler did figure out that __num_fields could be known at compile-time, so __dynamic_len ends up as a regular static array and not a variable length array (which is what we want). And it warns us that this behavior is not standard C, but an extension that originated from GNU. So I think it's fine to ignore it, as it simply warns us that the behavior we want happens. Change-Id: Ib7273e7f86c6b04742f8463f925cdbb1fa14041d Signed-off-by: Simon Marchi Signed-off-by: Jérémie Galarneau --- diff --git a/configure.ac b/configure.ac index b175ef52b..c8324a591 100644 --- a/configure.ac +++ b/configure.ac @@ -44,6 +44,7 @@ AX_APPEND_COMPILE_FLAGS([ dnl -Wold-style-definition dnl -Wstrict-prototypes dnl -Wshadow dnl + -Wno-gnu-folding-constant dnl ], [WARN_CFLAGS], [-Werror])