configure: add -Wno-gnu-folding-constant
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 23 Aug 2021 18:01:17 +0000 (14:01 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 24 Aug 2021 20:55:01 +0000 (16:55 -0400)
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 <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac

index b175ef52b2f100f37e14631e91074b765e7a8438..c8324a591c3076f8f7b87b7e3894fe5dc08e584d 100644 (file)
@@ -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])
This page took 0.025719 seconds and 4 git commands to generate.