[PATCH] gdbsupport, gdbserver, gdb: use -Wno-vla-cxx-extension

Tom Tromey tom@tromey.com
Mon Apr 15 16:22:07 GMT 2024


>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

Simon> When building with clang 18, I see:
Simon>       CXX    aarch64-linux-tdep.o
Simon>     /home/smarchi/src/binutils-gdb/gdb/aarch64-linux-tdep.c:1299:26: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
Simon>      1299 |       gdb_byte za_zeroed[za_bytes];
Simon>           |                          ^~~~~~~~
Simon>     /home/smarchi/src/binutils-gdb/gdb/aarch64-linux-tdep.c:1299:26: note: read of non-const variable 'za_bytes' is not allowed in a constant expression
Simon>     /home/smarchi/src/binutils-gdb/gdb/aarch64-linux-tdep.c:1282:10: note: declared here
Simon>      1282 |   size_t za_bytes = std::pow (sve_vl_from_vg (svg), 2);
Simon>           |          ^

Simon> Since we are using VLAs right now, that warning doesn't make sense for
Simon> us.  add `-Wno-vla-cxx-extension` to the list of warning flags we try to
Simon> enable.  If we ever choose to disallow VLAs, we can remove that flag.

I wonder if we should instead remove the use of VLAs.
Is it just the one spot?

Tom


More information about the Gdb-patches mailing list