[gtk/wip/otte/warnings: 3/3] build: Add new gcc error flags



commit dfd7bf64accc3762e85ff0fa3b660b7f0f0ebd8d
Author: Benjamin Otte <otte redhat com>
Date:   Sat Jan 26 15:09:55 2019 +0100

    build: Add new gcc error flags
    
    These flags check for code that we don't want to write, so turn them
    into error flags.
    
    Variable length arrays should be replaced by malloc() - or explicit
    alloca() calls if you know what you're doing.
    
    Implicit fallthrough should be replaced by explicit fallthrough with the
    usage of G_GNU_FALLTHROUGH.
    
    This work inspired by Kees Cook's LCA2019 talk:
    https://www.youtube.com/watch?v=FY9SbqTO5GQ
    http://outflux.net/slides/2019/lca/danger.pdf

 meson.build | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/meson.build b/meson.build
index e38f769cf2..7f76a8e9a5 100644
--- a/meson.build
+++ b/meson.build
@@ -251,6 +251,7 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
     '-Werror=array-bounds',
     '-Werror=empty-body',
     '-Werror=implicit',
+    '-Werror=implicit-fallthrough',
     '-Werror=init-self',
     '-Werror=int-to-pointer-cast',
     '-Werror=main',
@@ -263,6 +264,7 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
     '-Werror=return-type',
     '-Werror=sequence-point',
     '-Werror=trigraphs',
+    '-Werror=vla',
     '-Werror=write-strings',
   ]
 else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]