From: Christian Brauner Date: Thu, 9 Jun 2022 16:07:35 +0000 (+0200) Subject: build: tweak build flags X-Git-Tag: lxc-5.0.0~3^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abc5e6bb94b2a8aee24f473ec8d5a9cafba54f29;p=thirdparty%2Flxc.git build: tweak build flags Signed-off-by: Christian Brauner (Microsoft) --- diff --git a/meson.build b/meson.build index 20668218f..f8197679f 100644 --- a/meson.build +++ b/meson.build @@ -155,6 +155,14 @@ endif dummy_config_data = configuration_data() dummy_config_data.set_quoted('DUMMY_VARIABLE', '1') +# Those generate many false positives, and we do not want to change the code to +# avoid them. +basic_disabled_warnings = [ + '-Wno-format-signedness', + '-Wno-missing-field-initializers', + '-Wno-unused-parameter', +] + # Build flags. possible_cc_flags = [ '-Wvla', @@ -193,7 +201,6 @@ possible_cc_flags = [ '-Wreturn-local-addr', '-fsanitize=cfi', '-Wstringop-overflow', - '-Wno-missing-field-initializers', ] possible_link_flags = [ @@ -201,14 +208,27 @@ possible_link_flags = [ '-Wl,-z,relro', '-Wl,-z,now', '-Wl,-fuse-ld=gold', + '-fstack-protector', ] +if sanitize == 'none' + possible_link_flags += '-Wl,--warn-common' +endif + +if cc.get_id() == 'clang' + possible_cc_flags += [ + '-Wno-typedef-redefinition', + '-Wno-gnu-variable-sized-type-not-at-end', + ] +endif + if meson.version().version_compare('>=0.46') add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language: 'c') else add_project_link_arguments(possible_link_flags, language: 'c') endif +add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c') add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language: 'c') # Feature detection