Commit 26f54248 authored by Chun-wei Fan's avatar Chun-wei Fan

build: Force-include msvc_recommended_pragmas.h on Visual Studio

By doing so, we essentially cover the various compiler flags that we
want to use for non-Visual Studio builds to check for warnings that
might cause real concern.

This also skips the checks for the various GCC-isque CFlag checks that
are scattered in the various build files on Visual Studio builds, since
they are essentially meaningless on Visual Studio builds.
parent d2faab30
Pipeline #78837 passed with stages
in 5 minutes and 36 seconds
......@@ -29,17 +29,22 @@ cmph_deps = [
cc.find_library('m', required: false),
]
custom_c_args = cc.get_supported_arguments([
'-Wno-implicit-fallthrough',
'-Wno-old-style-definition',
'-Wno-suggest-attribute=noreturn',
'-Wno-type-limits',
'-Wno-undef',
'-Wno-unused-parameter',
'-Wno-cast-align',
'-Wno-unused-function',
'-Wno-return-type',
])
custom_c_args = []
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
'-Wno-implicit-fallthrough',
'-Wno-old-style-definition',
'-Wno-suggest-attribute=noreturn',
'-Wno-type-limits',
'-Wno-undef',
'-Wno-unused-parameter',
'-Wno-cast-align',
'-Wno-unused-function',
'-Wno-return-type',
])
endif
cmph = static_library('cmph',
sources: cmph_sources,
c_args: gi_hidden_visibility_cflags + custom_c_args,
......@@ -51,10 +56,13 @@ cmph_dep = declare_dependency(
include_directories: include_directories('.'),
)
custom_c_args = cc.get_supported_arguments([
'-Wno-old-style-definition',
'-Wno-type-limits',
])
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
'-Wno-old-style-definition',
'-Wno-type-limits',
])
endif
cmph_test = executable('cmph-bdz-test', '../cmph-bdz-test.c',
dependencies: [
cmph_dep,
......
subdir('cmph')
custom_c_args = cc.get_supported_arguments([
'-Wno-old-style-definition',
'-Wno-cast-align',
])
custom_c_args = []
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
'-Wno-old-style-definition',
'-Wno-cast-align',
])
endif
girepo_gthash_lib = static_library('girepository-gthash',
sources: 'gthash.c',
include_directories : configinc,
......@@ -21,11 +26,14 @@ girepo_gthash_dep = declare_dependency(
include_directories: include_directories('.'),
)
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
'-Wno-duplicated-branches',
'-Wno-cast-align',
])
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
'-Wno-duplicated-branches',
'-Wno-cast-align',
])
endif
girepo_internals_lib = static_library('girepository-internals',
sources: [
'girmodule.c',
......@@ -145,13 +153,16 @@ girepo_gir_sources = files(
install_headers(girepo_headers, subdir: 'gobject-introspection-1.0')
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
'-Wno-duplicated-branches',
'-Wno-type-limits',
'-Wno-cast-align',
'-Wno-missing-field-initializers',
])
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
'-Wno-duplicated-branches',
'-Wno-type-limits',
'-Wno-cast-align',
'-Wno-missing-field-initializers',
])
endif
girepo_lib = shared_library('girepository-1.0',
sources: girepo_sources,
include_directories : configinc,
......
......@@ -82,10 +82,14 @@ if not cc.has_header('unistd.h')
giscanner_args += '-DYY_NO_UNISTD_H'
endif
custom_c_args = cc.get_supported_arguments([
'-Wno-missing-field-initializers',
'-Wno-unused-parameter',
])
custom_c_args = []
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
'-Wno-missing-field-initializers',
'-Wno-unused-parameter',
])
endif
giscanner_lib = static_library('giscanner',
sources: [
'sourcescanner.c',
......
......@@ -63,6 +63,10 @@ if cc.get_id() != 'msvc'
project_c_args += [
'-fno-strict-aliasing',
]
else
project_c_args += [
'-FImsvc_recommended_pragmas.h',
]
endif
project_c_args = cc.get_supported_arguments(project_c_args)
......
......@@ -65,9 +65,13 @@ test_everything_files = custom_target('everything',
test_everything_headers = [test_everything_files[0]]
test_everything_sources = [test_everything_files[1]]
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
])
custom_c_args = []
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
])
endif
everything_lib = shared_library('everything-1.0',
sources: test_everything_sources,
include_directories : configinc,
......@@ -76,9 +80,12 @@ everything_lib = shared_library('everything-1.0',
version: '1.0.0',
)
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
])
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
])
endif
gimarshallingtests_lib = shared_library('gimarshallingtests-1.0',
sources: test_marshalling_sources,
include_directories : configinc,
......
......@@ -23,9 +23,12 @@ endforeach
test_girs = []
test_typelibs = []
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
])
custom_c_args = []
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
])
endif
typedef_lib = shared_library('typedef-1.0',
sources: ['typedefs.c'],
......@@ -76,11 +79,13 @@ barapp_lib = shared_library('barapp-1.0',
dependencies: [gobject_dep, girepo_dep],
)
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
'-Wno-old-style-definition',
'-Wno-missing-field-initializers',
])
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments([
'-Wno-unused-parameter',
'-Wno-old-style-definition',
'-Wno-missing-field-initializers',
])
endif
if with_cairo
regress_deps = [cairo_dep, cairo_gobject_dep]
......
......@@ -43,9 +43,12 @@ if with_doctool
girdoctool = tool_output[-1]
endif
custom_c_args = cc.get_supported_arguments([
'-Wno-missing-field-initializers',
])
custom_c_args = []
if cc.get_id() != 'msvc'
custom_c_args = cc.get_supported_arguments(['-Wno-missing-field-initializers'])
endif
gircompiler = executable('g-ir-compiler', 'compiler.c',
dependencies: [
girepo_internals_dep,
......@@ -55,9 +58,6 @@ gircompiler = executable('g-ir-compiler', 'compiler.c',
c_args: custom_c_args,
)
custom_c_args = cc.get_supported_arguments([
'-Wno-missing-field-initializers',
])
girgenerate = executable('g-ir-generate', 'generate.c',
dependencies: [
girepo_internals_dep,
......@@ -67,9 +67,6 @@ girgenerate = executable('g-ir-generate', 'generate.c',
c_args: custom_c_args,
)
custom_c_args = cc.get_supported_arguments([
'-Wno-missing-field-initializers',
])
girinspect = executable('g-ir-inspect', 'g-ir-inspect.c',
dependencies: girepo_dep,
install: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment