[gtk/wip/otte/no-errors-ever-again] build: Don't use any -Werror in release builds




commit 362e91c40b5036ec0ac0a5a0c231a4b58414509f
Author: Benjamin Otte <otte redhat com>
Date:   Wed Nov 10 20:01:36 2021 +0100

    build: Don't use any -Werror in release builds
    
    Do kep them for debug and debugoptimized builds though.
    
    Keeping -Werror flags in release builds causes issues with forward
    compatibility, when new compiler releases or different toolchains
    suddenly cause those warnings to be emitted during compilation.
    
    While we certainly want those issues to be investigated and fixed, they
    should not prevent anyone from building GTK until they are.
    
    Resolves #4388

 meson.build | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/meson.build b/meson.build
index 5eb86dce0e..66c398f7fe 100644
--- a/meson.build
+++ b/meson.build
@@ -291,6 +291,9 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
     '-Wundef',
     '-Wuninitialized',
     '-Wunused',
+  ]
+  
+  extra_warnings = [
     '-Werror=address',
     '-Werror=array-bounds',
     '-Werror=empty-body',
@@ -312,6 +315,16 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
     '-Werror=write-strings',
   ]
 
+  if get_option('buildtype').startswith('debug')
+    foreach warning: extra_warnings
+      test_cflags += '-Werror=@0@'.format(warning)
+    endforeach
+  else
+    foreach warning: extra_warnings
+      test_cflags += '-W@0@'.format(warning)
+    endforeach
+  endif
+
   if cc.get_id() == 'gcc'
     test_cflags += ['-Wcast-align'] # This warns too much on clang
   endif


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