aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py4
-rw-r--r--mesonbuild/compilers/compilers.py16
-rw-r--r--mesonbuild/compilers/mixins/clang.py7
-rw-r--r--mesonbuild/compilers/mixins/gnu.py6
-rw-r--r--mesonbuild/compilers/mixins/islinker.py2
-rw-r--r--mesonbuild/depfile.py2
-rw-r--r--mesonbuild/interpreter.py3
-rw-r--r--mesonbuild/interpreterbase.py4
-rw-r--r--mesonbuild/linkers.py8
-rw-r--r--mesonbuild/mlog.py5
-rw-r--r--mesonbuild/modules/gnome.py2
-rw-r--r--mesonbuild/modules/sourceset.py4
-rw-r--r--mesonbuild/mtest.py21
-rw-r--r--mesonbuild/scripts/clangformat.py7
-rw-r--r--mesonbuild/scripts/clangtidy.py2
15 files changed, 42 insertions, 51 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index c3c5705..15218c1 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -359,9 +359,9 @@ class NinjaBuildElement:
rulename = self.rulename
line = 'build {}{}: {} {}'.format(outs, implicit_outs, rulename, ins)
if len(self.deps) > 0:
- line += ' | ' + ' '.join([ninja_quote(x, True) for x in self.deps])
+ line += ' | ' + ' '.join([ninja_quote(x, True) for x in sorted(self.deps)])
if len(self.orderdeps) > 0:
- line += ' || ' + ' '.join([ninja_quote(x, True) for x in self.orderdeps])
+ line += ' || ' + ' '.join([ninja_quote(x, True) for x in sorted(self.orderdeps)])
line += '\n'
# This is the only way I could find to make this work on all
# platforms including Windows command shell. Slash is a dir separator
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 81d48d2..4e9b86b 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -266,9 +266,7 @@ clike_debug_args = {False: [],
True: ['-g']} # type: T.Dict[bool, T.List[str]]
base_options = {'b_pch': coredata.UserBooleanOption('Use precompiled headers', True),
- 'b_lto': coredata.UserComboOption('Use link time optimization',
- ['false', 'true', 'thin'],
- 'false'),
+ 'b_lto': coredata.UserBooleanOption('Use link time optimization', False),
'b_sanitize': coredata.UserComboOption('Code sanitizer to use',
['none', 'address', 'thread', 'undefined', 'memory', 'address,undefined'],
'none'),
@@ -309,7 +307,8 @@ def option_enabled(boptions: T.List[str], options: 'OptionDictType',
def get_base_compile_args(options: 'OptionDictType', compiler: 'Compiler') -> T.List[str]:
args = [] # type T.List[str]
try:
- args.extend(compiler.get_lto_compile_args(options['b_lto'].value))
+ if options['b_lto'].value:
+ args.extend(compiler.get_lto_compile_args())
except KeyError:
pass
try:
@@ -358,7 +357,8 @@ def get_base_link_args(options: 'OptionDictType', linker: 'Compiler',
is_shared_module: bool) -> T.List[str]:
args = [] # type: T.List[str]
try:
- args.extend(linker.get_lto_link_args(options['b_lto'].value))
+ if options['b_lto'].value:
+ args.extend(linker.get_lto_link_args())
except KeyError:
pass
try:
@@ -940,11 +940,11 @@ class Compiler(metaclass=abc.ABCMeta):
ret.append(arg)
return ret
- def get_lto_compile_args(self, lto_type: str) -> T.List[str]:
+ def get_lto_compile_args(self) -> T.List[str]:
return []
- def get_lto_link_args(self, lto_type: str) -> T.List[str]:
- return self.linker.get_lto_args(lto_type)
+ def get_lto_link_args(self) -> T.List[str]:
+ return self.linker.get_lto_args()
def sanitizer_compile_args(self, value: str) -> T.List[str]:
return []
diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py
index 773d9dc..acdb352 100644
--- a/mesonbuild/compilers/mixins/clang.py
+++ b/mesonbuild/compilers/mixins/clang.py
@@ -77,13 +77,6 @@ class ClangCompiler(GnuLikeCompiler):
# so it might change semantics at any time.
return ['-include-pch', os.path.join(pch_dir, self.get_pch_name(header))]
- def get_lto_compile_args(self, lto_type: str) -> T.List[str]:
- if lto_type == 'thin':
- return ['-flto=thin']
- if lto_type == 'true':
- return ['-flto']
- return []
-
def get_compiler_check_args(self, mode: CompileCheckMode) -> T.List[str]:
myargs = [] # type: T.List[str]
if mode is CompileCheckMode.COMPILE:
diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py
index 5771ad8..bb1fc66 100644
--- a/mesonbuild/compilers/mixins/gnu.py
+++ b/mesonbuild/compilers/mixins/gnu.py
@@ -295,10 +295,8 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta):
return self._split_fetch_real_dirs(line.split('=', 1)[1])
return []
- def get_lto_compile_args(self, lto_type: str) -> T.List[str]:
- if lto_type != 'false':
- return ['-flto']
- return []
+ def get_lto_compile_args(self) -> T.List[str]:
+ return ['-flto']
def sanitizer_compile_args(self, value: str) -> T.List[str]:
if value == 'none':
diff --git a/mesonbuild/compilers/mixins/islinker.py b/mesonbuild/compilers/mixins/islinker.py
index 67ac497..2445eec 100644
--- a/mesonbuild/compilers/mixins/islinker.py
+++ b/mesonbuild/compilers/mixins/islinker.py
@@ -48,7 +48,7 @@ class BasicLinkerIsCompilerMixin(Compiler):
def sanitizer_link_args(self, value: str) -> T.List[str]:
return []
- def get_lto_link_args(self, lto_type: str) -> T.List[str]:
+ def get_lto_link_args(self) -> T.List[str]:
return []
def can_linker_accept_rsp(self) -> bool:
diff --git a/mesonbuild/depfile.py b/mesonbuild/depfile.py
index 7a896cd..62cbe81 100644
--- a/mesonbuild/depfile.py
+++ b/mesonbuild/depfile.py
@@ -82,4 +82,4 @@ class DepFile:
deps.update(target.deps)
for dep in target.deps:
deps.update(self.get_all_dependencies(dep, visited))
- return deps
+ return sorted(deps)
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 138f6f8..6896a4d 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -4656,6 +4656,9 @@ different subdirectory.
elif arg in optargs:
mlog.warning('Consider using the built-in optimization level instead of using "{}".'.format(arg),
location=self.current_node)
+ elif arg == '-Werror':
+ mlog.warning('Consider using the built-in werror option instead of using "{}".'.format(arg),
+ location=self.current_node)
elif arg == '-g':
mlog.warning('Consider using the built-in debug option instead of using "{}".'.format(arg),
location=self.current_node)
diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py
index d3f8181..e57580b 100644
--- a/mesonbuild/interpreterbase.py
+++ b/mesonbuild/interpreterbase.py
@@ -823,7 +823,7 @@ The result of this is undefined and will become a hard error in a future Meson r
elif isinstance(items, dict):
if len(node.varnames) != 2:
raise InvalidArguments('Foreach on dict unpacks key and value')
- for key, value in items.items():
+ for key, value in sorted(items.items()):
self.set_variable(node.varnames[0], key)
self.set_variable(node.varnames[1], value)
try:
@@ -1166,7 +1166,7 @@ The result of this is undefined and will become a hard error in a future Meson r
if method_name == 'keys':
if len(posargs) != 0:
raise InterpreterException('keys() takes no arguments.')
- return list(obj.keys())
+ return sorted(obj.keys())
raise InterpreterException('Dictionaries do not have a method called "%s".' % method_name)
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py
index cc3db5f..589945c 100644
--- a/mesonbuild/linkers.py
+++ b/mesonbuild/linkers.py
@@ -411,7 +411,7 @@ class DynamicLinker(LinkerEnvVarsMixin, metaclass=abc.ABCMeta):
m = 'Linker {} does not support position-independent executable'
raise mesonlib.EnvironmentException(m.format(self.id))
- def get_lto_args(self, lto_type: str) -> T.List[str]:
+ def get_lto_args(self) -> T.List[str]:
return []
def sanitizer_args(self, value: str) -> T.List[str]:
@@ -550,10 +550,8 @@ class GnuLikeDynamicLinkerMixin:
def get_allow_undefined_args(self) -> T.List[str]:
return self._apply_prefix('--allow-shlib-undefined')
- def get_lto_args(self, lto_type: str) -> T.List[str]:
- if lto_type != 'false':
- return ['-flto']
- return []
+ def get_lto_args(self) -> T.List[str]:
+ return ['-flto']
def sanitizer_args(self, value: str) -> T.List[str]:
if value == 'none':
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index eefb308..46e2de1 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -124,7 +124,7 @@ class AnsiDecorator:
def get_text(self, with_codes: bool) -> str:
text = self.text
- if with_codes:
+ if with_codes and self.code:
text = self.code + self.text + AnsiDecorator.plain_code
if self.quoted:
text = '"{}"'.format(text)
@@ -133,6 +133,9 @@ class AnsiDecorator:
def bold(text: str, quoted: bool = False) -> AnsiDecorator:
return AnsiDecorator(text, "\033[1m", quoted=quoted)
+def plain(text: str) -> AnsiDecorator:
+ return AnsiDecorator(text, "")
+
def red(text: str) -> AnsiDecorator:
return AnsiDecorator(text, "\033[1;31m")
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 9fd31c7..547aff1 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -1430,7 +1430,7 @@ class GnomeModule(ExtensionModule):
GType
%s@enum_name@_get_type (void)
{
- static volatile gsize gtype_id = 0;
+ static gsize gtype_id = 0;
static const G@Type@Value values[] = {''' % func_prefix
c_file_kwargs['vprod'] = ' { C_@TYPE@(@VALUENAME@), "@VALUENAME@", "@valuenick@" },'
diff --git a/mesonbuild/modules/sourceset.py b/mesonbuild/modules/sourceset.py
index e23e12e..e49a548 100644
--- a/mesonbuild/modules/sourceset.py
+++ b/mesonbuild/modules/sourceset.py
@@ -14,7 +14,7 @@
from collections import namedtuple
from .. import mesonlib
-from ..mesonlib import listify
+from ..mesonlib import listify, OrderedSet
from . import ExtensionModule
from ..interpreterbase import (
noPosargs, noKwargs, permittedKwargs,
@@ -111,7 +111,7 @@ class SourceSetHolder(MutableInterpreterObject, ObjectHolder):
def collect(self, enabled_fn, all_sources, into=None):
if not into:
- into = SourceFiles(set(), set())
+ into = SourceFiles(OrderedSet(), OrderedSet())
for entry in self.held_object:
if all(x.found() for x in entry.dependencies) and \
all(enabled_fn(key) for key in entry.keys):
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index 92d02b3..5804303 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -957,20 +957,15 @@ class TestHarness:
dur=result.duration)
if result.res is TestResult.FAIL:
result_str += ' ' + returncode_to_status(result.returncode)
+ if result.res in bad_statuses:
+ self.collected_failures.append(result_str)
if not self.options.quiet or result.res not in ok_statuses:
- if result.res not in ok_statuses:
- self.collected_failures.append(result_str)
- if mlog.colorize_console():
- if result.res in bad_statuses:
- self.collected_failures.append(result_str)
- decorator = mlog.red
- elif result.res is TestResult.SKIP:
- decorator = mlog.yellow
- else:
- sys.exit('Unreachable code was ... well ... reached.')
- print(decorator(result_str).get_text(True))
- else:
- print(result_str)
+ decorator = mlog.plain
+ if result.res in bad_statuses:
+ decorator = mlog.red
+ elif result.res is TestResult.SKIP:
+ decorator = mlog.yellow
+ print(decorator(result_str).get_text(mlog.colorize_console()))
result_str += "\n\n" + result.get_log()
if result.res in bad_statuses:
if self.options.print_errorlogs:
diff --git a/mesonbuild/scripts/clangformat.py b/mesonbuild/scripts/clangformat.py
index e7a3ff8..062cb43 100644
--- a/mesonbuild/scripts/clangformat.py
+++ b/mesonbuild/scripts/clangformat.py
@@ -25,6 +25,7 @@ def clangformat(exelist: T.List[str], srcdir_name: str, builddir_name: str) -> i
suffixes = set(lang_suffixes['c']).union(set(lang_suffixes['cpp']))
suffixes.add('h')
futures = []
+ returncode = 0
with ThreadPoolExecutor() as e:
for f in (x for suff in suffixes for x in srcdir.glob('**/*.' + suff)):
if f.is_dir():
@@ -32,9 +33,9 @@ def clangformat(exelist: T.List[str], srcdir_name: str, builddir_name: str) -> i
strf = str(f)
if strf.startswith(builddir_name):
continue
- futures.append(e.submit(subprocess.check_call, exelist + ['-style=file', '-i', strf]))
- [x.result() for x in futures]
- return 0
+ futures.append(e.submit(subprocess.run, exelist + ['-style=file', '-i', strf]))
+ returncode = max([x.result().returncode for x in futures])
+ return returncode
def run(args: T.List[str]) -> int:
srcdir_name = args[0]
diff --git a/mesonbuild/scripts/clangtidy.py b/mesonbuild/scripts/clangtidy.py
index f920126..8d366c8 100644
--- a/mesonbuild/scripts/clangtidy.py
+++ b/mesonbuild/scripts/clangtidy.py
@@ -36,7 +36,7 @@ def manual_clangtidy(srcdir_name: str, builddir_name: str) -> int:
if strf.startswith(builddir_name):
continue
futures.append(e.submit(subprocess.run, ['clang-tidy', '-p', builddir_name, strf]))
- [max(returncode, x.result().returncode) for x in futures]
+ returncode = max([x.result().returncode for x in futures])
return returncode
def clangtidy(srcdir_name: str, builddir_name: str) -> int: