From d0004d4bfc7d0f7e411b905b83da56d336768238 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 23 Aug 2021 14:01:17 -0400 Subject: [PATCH] configure: add -Wno-gnu-folding-constant MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- configure.ac | 1 + 1 file changed, 1 insertion(+) 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]) -- 2.34.1