[v16,59/60] app: add compile warning about use of VLAs

Message ID 1736821958-3295-60-git-send-email-andremue@linux.microsoft.com (mailing list archive)
State Changes Requested
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. 14, 2025, 2:32 a.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>
---
 app/meson.build | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Patch

diff --git a/app/meson.build b/app/meson.build
index e2db888ae1..894d126dde 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -45,6 +45,15 @@  if get_option('tests')
 endif
 
 default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API']
+
+extra_flags = ['-Wvla']
+
+foreach arg: extra_flags
+    if cc.has_argument(arg)
+        default_cflags += arg
+    endif
+endforeach
+
 default_ldflags = []
 if get_option('default_library') == 'static' and not is_windows
     default_ldflags += ['-Wl,--export-dynamic']