MSVC does not support VLAs, so we want to prevent VLAs from being
introduced under this path.

Signed-off-by: Andre Muezerie <andre...@linux.microsoft.com>
---
 drivers/common/meson.build      | 8 ++++++++
 drivers/common/mlx5/meson.build | 1 +
 drivers/common/qat/meson.build  | 8 ++++++++
 3 files changed, 17 insertions(+)

diff --git a/drivers/common/meson.build b/drivers/common/meson.build
index 8734af36aa..79ba0a3001 100644
--- a/drivers/common/meson.build
+++ b/drivers/common/meson.build
@@ -11,3 +11,11 @@ drivers = [
         'mvep',
         'octeontx',
 ]
+
+warning_flags = ['-Wvla']
+
+foreach arg: warning_flags
+    if cc.has_argument(arg)
+        cflags += arg
+    endif
+endforeach
diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build
index 1eefc02f06..a6a67fbb85 100644
--- a/drivers/common/mlx5/meson.build
+++ b/drivers/common/mlx5/meson.build
@@ -26,6 +26,7 @@ sources += files(
 
 cflags_options = [
         '-std=c11',
+        '-Wvla',
         '-Wno-strict-prototypes',
         '-D_BSD_SOURCE',
         '-D_DEFAULT_SOURCE',
diff --git a/drivers/common/qat/meson.build b/drivers/common/qat/meson.build
index 5a8de16fe0..8dd38e9abd 100644
--- a/drivers/common/qat/meson.build
+++ b/drivers/common/qat/meson.build
@@ -119,3 +119,11 @@ if qat_crypto
     deps += ['security']
     cflags += ['-DBUILD_QAT_SYM', '-DBUILD_QAT_ASYM']
 endif
+
+extra_flags = ['-Wvla']
+
+foreach arg: extra_flags
+    if cc.has_argument(arg)
+        cflags += arg
+    endif
+endforeach
-- 
2.47.0.vfs.0.3

Reply via email to