aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/backend/backends.py7
-rw-r--r--mesonbuild/backend/ninjabackend.py20
-rw-r--r--mesonbuild/compilers.py14
3 files changed, 31 insertions, 10 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 16f7ada..1d3fddd 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -327,11 +327,14 @@ class Backend():
extra_args.append(arg)
return extra_args
- def generate_basic_compiler_args(self, target, compiler):
+ def generate_basic_compiler_args(self, target, compiler, no_warn_args=False):
commands = []
commands += self.get_cross_stdlib_args(target, compiler)
commands += compiler.get_always_args()
- commands += compiler.get_warn_args(self.environment.coredata.get_builtin_option('warning_level'))
+ if no_warn_args:
+ commands += compiler.get_no_warn_args()
+ else:
+ commands += compiler.get_warn_args(self.environment.coredata.get_builtin_option('warning_level'))
commands += compiler.get_option_compile_args(self.environment.coredata.compiler_options)
commands += self.build.get_global_args(compiler)
commands += self.environment.coredata.external_args[compiler.get_language()]
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index a29af60..f8c8109 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -233,7 +233,7 @@ int dummy;
if isinstance(target, build.RunTarget):
self.generate_run_target(target, outfile)
name = target.get_id()
- gen_src_deps = []
+ vala_gen_sources = []
if name in self.processed_targets:
return
if isinstance(target, build.Jar):
@@ -249,8 +249,7 @@ int dummy;
self.generate_swift_target(target, outfile)
return
if 'vala' in target.compilers:
- vala_output_files = self.generate_vala_compile(target, outfile)
- gen_src_deps += vala_output_files
+ vala_gen_sources = self.generate_vala_compile(target, outfile)
self.scan_fortran_module_outputs(target)
self.process_target_dependencies(target, outfile)
self.generate_custom_generator_rules(target, outfile)
@@ -318,9 +317,10 @@ int dummy;
src_list.append(src)
obj_list.append(self.generate_single_compile(target, outfile, src, True,
header_deps=header_deps))
- # Generate compilation targets for sources belonging to this target that
- # are generated by other rules (this is only used for Vala right now)
- for src in gen_src_deps:
+ # Generate compilation targets for C sources generated from Vala
+ # sources. This can be extended to other $LANG->C compilers later if
+ # necessary.
+ for src in vala_gen_sources:
src_list.append(src)
if is_unity:
unity_src.append(os.path.join(self.environment.get_build_dir(), src))
@@ -334,7 +334,7 @@ int dummy;
if self.environment.is_header(src):
header_deps.append(src)
else:
- obj_list.append(self.generate_single_compile(target, outfile, src, True, [], header_deps))
+ obj_list.append(self.generate_single_compile(target, outfile, src, 'vala', [], header_deps))
# Generate compile targets for all the pre-existing sources for this target
for src in target.get_sources():
if src.endswith('.vala'):
@@ -1614,7 +1614,11 @@ rule FORTRAN_DEP_HACK
commands += sargs
for d in i.get_extra_build_dirs():
commands += compiler.get_include_args(d, i.is_system)
- commands += self.generate_basic_compiler_args(target, compiler)
+ commands += self.generate_basic_compiler_args(target, compiler,
+ # The code generated by valac is usually crap
+ # and has tons of unused variables and such,
+ # so disable warnings for Vala C sources.
+ no_warn_args=(is_generated == 'vala'))
for d in target.external_deps:
if d.need_threads():
commands += compiler.thread_flags()
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 68157bd..6ad2f1e 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -473,6 +473,10 @@ class CCompiler(Compiler):
def get_warn_args(self, level):
return self.warn_args[level]
+ def get_no_warn_args(self):
+ # Almost every compiler uses this for disabling warnings
+ return ['-w']
+
def get_soname_args(self, prefix, shlib_name, suffix, path, soversion):
return []
@@ -2255,6 +2259,9 @@ end program prog
def get_warn_args(self, level):
return ['-Wall']
+ def get_no_warn_args(self):
+ return ['-w']
+
class GnuFortranCompiler(FortranCompiler):
def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None):
@@ -2292,6 +2299,10 @@ class G95FortranCompiler(FortranCompiler):
def get_always_args(self):
return ['-pipe']
+ def get_no_warn_args(self):
+ # FIXME: Confirm that there's no compiler option to disable all warnings
+ return []
+
def gen_import_library_args(self, implibname):
"""
The name of the outputted import library
@@ -2357,6 +2368,9 @@ class PGIFortranCompiler(FortranCompiler):
def get_warn_args(self, level):
return PGIFortranCompiler.std_warn_args
+ def get_no_warn_args(self):
+ return ['-silent']
+
class Open64FortranCompiler(FortranCompiler):
std_warn_args = ['-fullwarn']