1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

meson: enable more warnings when building efi binary

This commit is contained in:
Yu Watanabe 2021-06-02 15:49:44 +09:00
parent ca474d5114
commit 6526736397
2 changed files with 29 additions and 22 deletions

View File

@ -325,7 +325,7 @@ basic_disabled_warnings = [
'-Wno-format-signedness', '-Wno-format-signedness',
] ]
possible_cc_flags = [ possible_common_cc_flags = [
'-Werror=undef', '-Werror=undef',
'-Wlogical-op', '-Wlogical-op',
'-Wmissing-include-dirs', '-Wmissing-include-dirs',
@ -334,9 +334,7 @@ possible_cc_flags = [
'-Winit-self', '-Winit-self',
'-Wfloat-equal', '-Wfloat-equal',
'-Wsuggest-attribute=noreturn', '-Wsuggest-attribute=noreturn',
'-Werror=missing-prototypes',
'-Werror=implicit-function-declaration', '-Werror=implicit-function-declaration',
'-Werror=missing-declarations',
'-Werror=return-type', '-Werror=return-type',
'-Werror=incompatible-pointer-types', '-Werror=incompatible-pointer-types',
'-Werror=format=2', '-Werror=format=2',
@ -363,8 +361,6 @@ possible_cc_flags = [
'-fdiagnostics-show-option', '-fdiagnostics-show-option',
'-fno-strict-aliasing', '-fno-strict-aliasing',
'-fvisibility=hidden', '-fvisibility=hidden',
'-fstack-protector',
'-fstack-protector-strong',
'--param=ssp-buffer-size=4', '--param=ssp-buffer-size=4',
] ]
@ -374,7 +370,7 @@ possible_cc_flags = [
# busywork. See https://github.com/systemd/systemd/pull/19226. # busywork. See https://github.com/systemd/systemd/pull/19226.
if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
cc.version().version_compare('<10')) cc.version().version_compare('<10'))
possible_cc_flags += '-Wno-maybe-uninitialized' possible_common_cc_flags += '-Wno-maybe-uninitialized'
endif endif
# --as-needed and --no-undefined are provided by meson by default, # --as-needed and --no-undefined are provided by meson by default,
@ -386,14 +382,14 @@ possible_link_flags = [
] ]
if cc.get_id() == 'clang' if cc.get_id() == 'clang'
possible_cc_flags += [ possible_common_cc_flags += [
'-Wno-typedef-redefinition', '-Wno-typedef-redefinition',
'-Wno-gnu-variable-sized-type-not-at-end', '-Wno-gnu-variable-sized-type-not-at-end',
] ]
endif endif
if get_option('buildtype') != 'debug' if get_option('buildtype') != 'debug'
possible_cc_flags += [ possible_common_cc_flags += [
'-ffunction-sections', '-ffunction-sections',
'-fdata-sections', '-fdata-sections',
] ]
@ -401,6 +397,13 @@ if get_option('buildtype') != 'debug'
possible_link_flags += '-Wl,--gc-sections' possible_link_flags += '-Wl,--gc-sections'
endif endif
possible_cc_flags = possible_common_cc_flags + [
'-Werror=missing-declarations',
'-Werror=missing-prototypes',
'-fstack-protector',
'-fstack-protector-strong',
]
add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c') add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c') add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c') add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')

View File

@ -175,23 +175,27 @@ if have_gnu_efi
endif endif
if have_gnu_efi if have_gnu_efi
compile_args = ['-Wall', compile_args = cc.get_supported_arguments(
'-Wextra', basic_disabled_warnings +
'-std=gnu99', possible_common_cc_flags + [
'-nostdlib', '-ffreestanding',
'-fno-stack-protector',
'-fpic', '-fpic',
'-fshort-wchar', '-fshort-wchar',
'-ffreestanding', '-Wall',
'-fno-strict-aliasing', '-Wextra',
'-fno-stack-protector',
'-Wsign-compare', '-Wsign-compare',
'-Wno-missing-field-initializers', ]
) + [
'-nostdlib',
'-std=gnu99',
'-isystem', efi_incdir, '-isystem', efi_incdir,
'-isystem', join_paths(efi_incdir, gnu_efi_path_arch), '-isystem', join_paths(efi_incdir, gnu_efi_path_arch),
'-I', fundamental_path, '-I', fundamental_path,
'-DSD_BOOT', '-DSD_BOOT',
'-include', efi_config_h, '-include', efi_config_h,
'-include', version_h] '-include', version_h,
]
if efi_arch == 'x86_64' if efi_arch == 'x86_64'
compile_args += ['-mno-red-zone', compile_args += ['-mno-red-zone',
'-mno-sse', '-mno-sse',