summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-11-23 18:47:54 +0100
committerThomas Haller <thaller@redhat.com>2021-06-10 21:48:59 +0200
commita3576d312c4346423e7e1152871ede05ab843fe3 (patch)
tree6b75a9b51219f77a4acb748437e7e2fcc9da6d40
parent3f3397abcac6fadbb053e8ca74108b0b9e2e2e91 (diff)
downloadNetworkManager-a3576d312c4346423e7e1152871ede05ab843fe3.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 (cherry picked from commit c0c6470e4d21cc7dfa6db27bb78b316304ff0756) (cherry picked from commit 6b316a1991e28430e551269affaac1508904cfcf) (cherry picked from commit 805c9fa8d439a37d16d5fef6dee8fb83648eb074)
-rw-r--r--meson.build119
1 files changed, 57 insertions, 62 deletions
diff --git a/meson.build b/meson.build
index 94f110e50b..2edd103322 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')