summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-11-23 18:47:54 +0100
committerThomas Haller <thaller@redhat.com>2020-11-23 21:06:55 +0100
commitc0c6470e4d21cc7dfa6db27bb78b316304ff0756 (patch)
tree4738d817ad98d94d3f0939cdfaa72e4a10002e3b
parentdf76da8ea0d6994b5611c64ca66f7f86d233b541 (diff)
downloadNetworkManager-c0c6470e4d21cc7dfa6db27bb78b316304ff0756.tar.gz
build/meson: fix build to always set "-W" compiler flags
We must set these compiler flags independent as to whether this is a release build or a debug build. In most cases, we don't differentiate between release and debug build anyway. Granted, we have "-D more_asserts=100" and set "-O" CFLAGS, but that is more granular and not a simple "buildtype". In particular, these compiler flags apply to all kinds of builds. This is important, because otherwise we get build failures, because also in release build we want to build with `-Werror` and `-Wall`. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/692
-rw-r--r--meson.build119
1 files changed, 57 insertions, 62 deletions
diff --git a/meson.build b/meson.build
index 9559f0793c..ccec712295 100644
--- a/meson.build
+++ b/meson.build
@@ -67,8 +67,6 @@ libnm_version = '@0@.@1@.@2@'.format(current - age, age, revision)
libnm_pkgincludedir = join_paths(nm_includedir, libnm_name)
-nm_debug = get_option('buildtype').contains('debug')
-
gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')
@@ -175,67 +173,64 @@ if enable_lto
common_ldflags += lto_flag
endif
-if nm_debug
- common_flags += cc.get_supported_arguments([
- '-Wall',
- '-Wextra',
- '-Wdeclaration-after-statement',
- '-Wfloat-equal',
- '-Wformat-nonliteral',
- '-Wformat-security',
- '-Wimplicit-function-declaration',
- '-Winit-self',
- '-Wlogical-op',
- '-Wmissing-declarations',
- '-Wmissing-include-dirs',
- '-Wmissing-prototypes',
- '-Wpointer-arith',
- '-Wshadow',
- '-Wshift-negative-value',
- '-Wstrict-prototypes',
- '-Wundef',
- '-Wvla',
- '-Wno-duplicate-decl-specifier',
- '-Wno-format-truncation',
- '-Wno-format-y2k',
- '-Wno-gnu-variable-sized-type-not-at-end',
- '-Wno-missing-field-initializers',
- '-Wno-pragmas',
- '-Wno-sign-compare',
- '-Wno-tautological-constant-out-of-range-compare',
- '-Wno-unknown-pragmas',
- '-Wno-unused-parameter',
- '-Wparentheses-equality',
- '-Wpointer-arith',
- '-Wshadow',
- '-Wstrict-prototypes',
- '-Wtypedef-redefinition',
- '-Wundef',
- '-Wunknown-attributes',
- '-fno-strict-aliasing',
- ])
-
- if cc.has_argument('-Wimplicit-fallthrough')
- if cc.compiles('''
- int main(int argc, char **argv) {
- int r = 0;
- switch (argc) {
- case 0:
- r++;
- /* fall-through */
- case 1:
- r++;
- break;
- }
- return r;
- }
- ''',
- args: '-Werror=implicit-fallthrough',
- name: '-Werror=implicit-fallthrough')
- common_flags += '-Wimplicit-fallthrough'
- endif
+common_flags += cc.get_supported_arguments([
+ '-Wall',
+ '-Wextra',
+ '-Wdeclaration-after-statement',
+ '-Wfloat-equal',
+ '-Wformat-nonliteral',
+ '-Wformat-security',
+ '-Wimplicit-function-declaration',
+ '-Winit-self',
+ '-Wlogical-op',
+ '-Wmissing-declarations',
+ '-Wmissing-include-dirs',
+ '-Wmissing-prototypes',
+ '-Wpointer-arith',
+ '-Wshadow',
+ '-Wshift-negative-value',
+ '-Wstrict-prototypes',
+ '-Wundef',
+ '-Wvla',
+ '-Wno-duplicate-decl-specifier',
+ '-Wno-format-truncation',
+ '-Wno-format-y2k',
+ '-Wno-gnu-variable-sized-type-not-at-end',
+ '-Wno-missing-field-initializers',
+ '-Wno-pragmas',
+ '-Wno-sign-compare',
+ '-Wno-tautological-constant-out-of-range-compare',
+ '-Wno-unknown-pragmas',
+ '-Wno-unused-parameter',
+ '-Wparentheses-equality',
+ '-Wpointer-arith',
+ '-Wshadow',
+ '-Wstrict-prototypes',
+ '-Wtypedef-redefinition',
+ '-Wundef',
+ '-Wunknown-attributes',
+ '-fno-strict-aliasing',
+])
+
+if cc.has_argument('-Wimplicit-fallthrough')
+ if cc.compiles('''
+ int main(int argc, char **argv) {
+ int r = 0;
+ switch (argc) {
+ case 0:
+ r++;
+ /* fall-through */
+ case 1:
+ r++;
+ break;
+ }
+ return r;
+ }
+ ''',
+ args: '-Werror=implicit-fallthrough',
+ name: '-Werror=implicit-fallthrough')
+ common_flags += '-Wimplicit-fallthrough'
endif
-
endif
add_project_arguments(common_flags, language: 'c')