meson: add extra_checks do add more compilation errors

These are the same options we already use in build scripts.
This commit is contained in:
Steve Lhomme 2023-10-18 09:23:54 +02:00
parent fded16c5cd
commit 8f3d984910
2 changed files with 15 additions and 0 deletions

View File

@ -476,6 +476,16 @@ add_project_arguments(cc.get_supported_arguments([
'-pipe'
]), language: ['c'])
if get_option('extra_checks')
add_project_arguments(cc.get_supported_arguments([
'-Werror=missing-field-initializers'
]), language: ['c', 'cpp'])
add_project_arguments(cc.get_supported_arguments([
'-Werror=incompatible-pointer-types',
'-Werror=restrict'
]), language: ['c'])
endif
if get_option('branch_protection') \
.require(host_machine.cpu_family() == 'aarch64', error_message: 'Branch protection is only available for AArch64') \
.require(cc.has_argument('-mbranch-protection=standard'), error_message: 'Compiler does not support `-mbranch-protection`') \

View File

@ -50,6 +50,11 @@ option('ssp',
value : 'auto',
description : 'Stack smashing protection')
option('extra_checks',
type : 'boolean',
value : false,
description : 'Turn some warnings into compilation error')
option('winstore_app',
type : 'boolean',
value : false,