build: Don't use any -Werror in release builds
authorBenjamin Otte <otte@redhat.com>
Wed, 10 Nov 2021 19:01:36 +0000 (20:01 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 10 Nov 2021 19:04:07 +0000 (20:04 +0100)
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

index 5eb86dce0ecf9a2869885df837616e0dfd610b14..66c398f7fef279ac736f18e80fbf5aa011831992 100644 (file)
@@ -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