[PATCH v15 60/60] lib: add compile warning about use of VLAs
    Andre Muezerie 
    andremue at linux.microsoft.com
       
    Tue Jan 14 02:23:12 CET 2025
    
    
  
MSVC does not support VLAs, so we want to prevent VLAs from being
introduced under this path.
Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
---
 lib/meson.build | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/meson.build b/lib/meson.build
index ce92cb5537..43a92be5fa 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -111,9 +111,13 @@ default_cflags = machine_args
 default_cflags += ['-DALLOW_EXPERIMENTAL_API']
 default_cflags += ['-DALLOW_INTERNAL_API']
 
-if cc.has_argument('-Wno-format-truncation')
-    default_cflags += '-Wno-format-truncation'
-endif
+extra_flags = ['-Wno-format-truncation', '-Wvla']
+
+foreach arg: extra_flags
+    if cc.has_argument(arg)
+        default_cflags += arg
+    endif
+endforeach
 
 foreach l:libraries
     build = true
-- 
2.47.0.vfs.0.3
    
    
More information about the dev
mailing list