mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-09 19:06:15 +01:00
build: Pass warning and warning-disabling arguments to C++ and ObjC too
Previously they were only passed to the C compiler, which meant disabled warnings were still emitted when (for example) including C headers from C++ and ObjC files. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
cc0e2978a4
commit
249e654b96
24
meson.build
24
meson.build
@ -425,17 +425,15 @@ endforeach
|
||||
|
||||
# Compiler flags
|
||||
if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
||||
warning_c_args = [
|
||||
warning_common_args = [
|
||||
'-Wduplicated-branches',
|
||||
'-Wimplicit-fallthrough',
|
||||
'-Wmisleading-indentation',
|
||||
'-Wstrict-prototypes',
|
||||
'-Wunused',
|
||||
# Due to maintained deprecated code, we do not want to see unused parameters
|
||||
'-Wno-unused-parameter',
|
||||
# Due to pervasive use of things like GPOINTER_TO_UINT(), we do not support
|
||||
# building with -Wbad-function-cast.
|
||||
'-Wno-bad-function-cast',
|
||||
'-Wno-cast-function-type',
|
||||
# Due to function casts through (void*) we cannot support -Wpedantic:
|
||||
# https://wiki.gnome.org/Projects/GLib/CompilerRequirements#Function_pointer_conversions.
|
||||
@ -444,14 +442,23 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
||||
'-Wno-format-zero-length',
|
||||
# We explicitly require variadic macros
|
||||
'-Wno-variadic-macros',
|
||||
'-Werror=declaration-after-statement',
|
||||
'-Werror=format=2',
|
||||
'-Werror=implicit-function-declaration',
|
||||
'-Werror=init-self',
|
||||
'-Werror=missing-include-dirs',
|
||||
'-Werror=missing-prototypes',
|
||||
'-Werror=pointer-arith',
|
||||
]
|
||||
|
||||
warning_c_args = warning_common_args + [
|
||||
'-Wstrict-prototypes',
|
||||
# Due to pervasive use of things like GPOINTER_TO_UINT(), we do not support
|
||||
# building with -Wbad-function-cast.
|
||||
'-Wno-bad-function-cast',
|
||||
'-Werror=declaration-after-statement',
|
||||
'-Werror=implicit-function-declaration',
|
||||
'-Werror=missing-prototypes',
|
||||
]
|
||||
warning_cxx_args = warning_common_args
|
||||
warning_objc_args = warning_c_args
|
||||
warning_c_link_args = [
|
||||
'-Wl,-z,nodelete',
|
||||
]
|
||||
@ -460,10 +467,13 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
||||
endif
|
||||
else
|
||||
warning_c_args = []
|
||||
warning_cxx_args = []
|
||||
warning_objc_args = []
|
||||
warning_c_link_args = []
|
||||
endif
|
||||
|
||||
add_project_arguments(cc.get_supported_arguments(warning_c_args), language: 'c')
|
||||
add_project_arguments(cxx.get_supported_arguments(warning_cxx_args), language: 'cpp')
|
||||
|
||||
# FIXME: We cannot build some of the GResource tests with -z nodelete, which
|
||||
# means we cannot use that flag in add_project_link_arguments(), and must add
|
||||
@ -757,6 +767,8 @@ if host_system == 'darwin'
|
||||
add_languages('objc')
|
||||
objcc = meson.get_compiler('objc')
|
||||
|
||||
add_project_arguments(objcc.get_supported_arguments(warning_objc_args), language: 'objc')
|
||||
|
||||
osx_ldflags += ['-Wl,-framework,CoreFoundation']
|
||||
|
||||
# Mac OS X Carbon support
|
||||
|
Loading…
Reference in New Issue
Block a user