public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH] gdbsupport, gdbserver, gdb: use -Wno-vla-cxx-extension
Date: Fri, 12 Apr 2024 13:51:54 -0400	[thread overview]
Message-ID: <20240412175200.829114-1-simon.marchi@efficios.com> (raw)

When building with clang 18, I see:

      CXX    aarch64-linux-tdep.o
    /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]
     1299 |       gdb_byte za_zeroed[za_bytes];
          |                          ^~~~~~~~
    /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
    /home/smarchi/src/binutils-gdb/gdb/aarch64-linux-tdep.c:1282:10: note: declared here
     1282 |   size_t za_bytes = std::pow (sve_vl_from_vg (svg), 2);
          |          ^

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

Change-Id: Ie41feafc50c343f6e75333d4f836ce32fbeb6d8c
---
 gdb/configure         | 1 +
 gdbserver/configure   | 1 +
 gdbsupport/configure  | 1 +
 gdbsupport/warning.m4 | 1 +
 4 files changed, 4 insertions(+)

diff --git a/gdb/configure b/gdb/configure
index a77e3e273328..c3d5cf7ed63d 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -31179,6 +31179,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wredundant-move \
 -Wmissing-declarations \
 -Wstrict-null-sentinel \
+-Wno-vla-cxx-extension \
 "
 
 # The -Wmissing-prototypes flag will be accepted by GCC, but results
diff --git a/gdbserver/configure b/gdbserver/configure
index b85db9cd49df..026d250cc732 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -13706,6 +13706,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wredundant-move \
 -Wmissing-declarations \
 -Wstrict-null-sentinel \
+-Wno-vla-cxx-extension \
 "
 
 # The -Wmissing-prototypes flag will be accepted by GCC, but results
diff --git a/gdbsupport/configure b/gdbsupport/configure
index b45f12de45be..ae991250ce4c 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -14179,6 +14179,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wredundant-move \
 -Wmissing-declarations \
 -Wstrict-null-sentinel \
+-Wno-vla-cxx-extension \
 "
 
 # The -Wmissing-prototypes flag will be accepted by GCC, but results
diff --git a/gdbsupport/warning.m4 b/gdbsupport/warning.m4
index bdac8b3e7d22..d12bccbd3fb9 100644
--- a/gdbsupport/warning.m4
+++ b/gdbsupport/warning.m4
@@ -52,6 +52,7 @@ build_warnings="-Wall -Wpointer-arith \
 -Wredundant-move \
 -Wmissing-declarations \
 -Wstrict-null-sentinel \
+-Wno-vla-cxx-extension \
 "
 
 # The -Wmissing-prototypes flag will be accepted by GCC, but results

base-commit: ec48903170926f3827144525b50ddd3c6ae3fbf0
-- 
2.44.0


             reply	other threads:[~2024-04-12 17:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 17:51 Simon Marchi [this message]
2024-04-15 16:22 ` Tom Tromey
2024-04-15 16:32   ` Luis Machado
2024-04-15 16:48   ` Simon Marchi
2024-04-16 22:56     ` Tom Tromey
2024-04-17 14:52       ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240412175200.829114-1-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).