[v14,36/81] lib/cmdline: add compile warning about use of VLAs

Message ID 1736540620-21764-37-git-send-email-andremue@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series remove use of VLAs for Windows |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andre Muezerie Jan. 10, 2025, 8:22 p.m. UTC
MSVC does not support VLAs, so we want to prevent VLAs from being
introduced under this path.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 lib/cmdline/meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Patch

diff --git a/lib/cmdline/meson.build b/lib/cmdline/meson.build
index 63fb69100d..da7a578d05 100644
--- a/lib/cmdline/meson.build
+++ b/lib/cmdline/meson.build
@@ -32,3 +32,11 @@  else
 endif
 
 deps += ['net']
+
+extra_flags = ['-Wvla']
+
+foreach arg: extra_flags
+    if cc.has_argument(arg)
+        cflags += arg
+    endif
+endforeach