aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Getting-meson.md9
-rw-r--r--docs/markdown/snippets/thinlto.md27
-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/interpreter.py3
-rw-r--r--mesonbuild/linkers.py8
-rw-r--r--mesonbuild/mlog.py5
-rw-r--r--mesonbuild/modules/gnome.py2
-rw-r--r--mesonbuild/mtest.py21
-rw-r--r--mesonbuild/scripts/clangformat.py7
-rw-r--r--mesonbuild/scripts/clangtidy.py2
-rw-r--r--test cases/common/41 options/meson.build2
-rw-r--r--test cases/frameworks/7 gnome/mkenums/enums.c.in8
-rw-r--r--test cases/frameworks/7 gnome/mkenums/enums2.c.in8
-rw-r--r--test cases/frameworks/7 gnome/mkenums/meson.build8
-rw-r--r--test cases/vala/8 generated sources/dependency-generated/enum-types.c.template8
18 files changed, 59 insertions, 90 deletions
diff --git a/docs/markdown/Getting-meson.md b/docs/markdown/Getting-meson.md
index e0e5722..3568dfc 100644
--- a/docs/markdown/Getting-meson.md
+++ b/docs/markdown/Getting-meson.md
@@ -23,12 +23,17 @@ a pull-request process that runs CI and tests several platforms.
## Installing Meson with pip
Meson is available in the [Python Package Index] and can be installed with
-`pip3 install meson` which requires root and will install it system-wide.
+`sudo pip3 install meson` which requires root and will install it system-wide.
+
+If you have downloaded a copy of the meson sources already, you can install it
+with `sudo pip3 install path/to/source/root/`.
Alternatively, you can use `pip3 install --user meson` which will install it
for your user and does not require any special privileges. This will install
the package in `~/.local/`, so you will have to add `~/.local/bin` to your
-`PATH`.
+`PATH`, and `sudo meson install` will be completely broken since the
+program will not be available to root. Only use a user copy of meson if you
+do not care about installing projects as root.
## Installing Meson and Ninja with the MSI installer
diff --git a/docs/markdown/snippets/thinlto.md b/docs/markdown/snippets/thinlto.md
deleted file mode 100644
index 44bc972..0000000
--- a/docs/markdown/snippets/thinlto.md
+++ /dev/null
@@ -1,27 +0,0 @@
-## Add support for thin LTO
-
-The `b_lto` option has been updated and now can be set to the value
-`thin`. This enables [thin
-LTO](https://clang.llvm.org/docs/ThinLTO.html) on all compilers where
-it is supported. At the time of writing this means only Clang.
-
-This change is potentially backwards incompatible. If you have
-examined the value of `b_lto` in your build file, note that its type
-has changed from a boolean to a string. Thus comparisons like this:
-
-```meson
-if get_option('b_lto')
-...
-endif
-```
-
-need to be changed to something like this instead:
-
-```meson
-if get_option('b_lto') == 'true'
-...
-endif
-```
-
-This should not affect any command line invocations as configuring LTO
-with `-Db_lto=true` still works and behaves the same way as before.
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/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/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/mtest.py b/mesonbuild/mtest.py
index 35cb10a..e538992 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -918,20 +918,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:
diff --git a/test cases/common/41 options/meson.build b/test cases/common/41 options/meson.build
index 4b38c6f..2eccef7 100644
--- a/test cases/common/41 options/meson.build
+++ b/test cases/common/41 options/meson.build
@@ -18,7 +18,7 @@ if get_option('array_opt') != ['one', 'two']
endif
# If the default changes, update test cases/unit/13 reconfigure
-if get_option('b_lto') != 'false'
+if get_option('b_lto') != false
error('Incorrect value in base option.')
endif
diff --git a/test cases/frameworks/7 gnome/mkenums/enums.c.in b/test cases/frameworks/7 gnome/mkenums/enums.c.in
index 62e1adc..1c19d8f 100644
--- a/test cases/frameworks/7 gnome/mkenums/enums.c.in
+++ b/test cases/frameworks/7 gnome/mkenums/enums.c.in
@@ -13,9 +13,9 @@
/*** BEGIN value-header ***/
GType
@enum_name@_get_type(void) {
- static volatile gsize g_define_type_id__volatile = 0;
+ static gsize static_g_define_type_id = 0;
- if(g_once_init_enter(&g_define_type_id__volatile)) {
+ if(g_once_init_enter(&static_g_define_type_id)) {
static const G@Type@Value values [] = {
/*** END value-header ***/
@@ -29,10 +29,10 @@ GType
GType g_define_type_id =
g_@type@_register_static(g_intern_static_string("@EnumName@"), values);
- g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
+ g_once_init_leave(&static_g_define_type_id, g_define_type_id);
}
- return g_define_type_id__volatile;
+ return static_g_define_type_id;
}
/*** END value-tail ***/
diff --git a/test cases/frameworks/7 gnome/mkenums/enums2.c.in b/test cases/frameworks/7 gnome/mkenums/enums2.c.in
index 62e1adc..1c19d8f 100644
--- a/test cases/frameworks/7 gnome/mkenums/enums2.c.in
+++ b/test cases/frameworks/7 gnome/mkenums/enums2.c.in
@@ -13,9 +13,9 @@
/*** BEGIN value-header ***/
GType
@enum_name@_get_type(void) {
- static volatile gsize g_define_type_id__volatile = 0;
+ static gsize static_g_define_type_id = 0;
- if(g_once_init_enter(&g_define_type_id__volatile)) {
+ if(g_once_init_enter(&static_g_define_type_id)) {
static const G@Type@Value values [] = {
/*** END value-header ***/
@@ -29,10 +29,10 @@ GType
GType g_define_type_id =
g_@type@_register_static(g_intern_static_string("@EnumName@"), values);
- g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
+ g_once_init_leave(&static_g_define_type_id, g_define_type_id);
}
- return g_define_type_id__volatile;
+ return static_g_define_type_id;
}
/*** END value-tail ***/
diff --git a/test cases/frameworks/7 gnome/mkenums/meson.build b/test cases/frameworks/7 gnome/mkenums/meson.build
index 3d7adf0..8ff05ba 100644
--- a/test cases/frameworks/7 gnome/mkenums/meson.build
+++ b/test cases/frameworks/7 gnome/mkenums/meson.build
@@ -89,9 +89,9 @@ enums_c3 = gnome.mkenums('enums3.c',
vhead : '''
GType
@enum_name@_get_type(void) {
- static volatile gsize g_define_type_id__volatile = 0;
+ static gsize static_g_define_type_id = 0;
- if(g_once_init_enter(&g_define_type_id__volatile)) {
+ if(g_once_init_enter(&static_g_define_type_id)) {
static const G@Type@Value values [] = {
''',
vprod : ''' { @VALUENAME@, "@VALUENAME@", "@valuenick@" },''',
@@ -100,10 +100,10 @@ GType
GType g_define_type_id =
g_@type@_register_static(g_intern_static_string("@EnumName@"), values);
- g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
+ g_once_init_leave(&static_g_define_type_id, g_define_type_id);
}
- return g_define_type_id__volatile;
+ return static_g_define_type_id;
}
''')
diff --git a/test cases/vala/8 generated sources/dependency-generated/enum-types.c.template b/test cases/vala/8 generated sources/dependency-generated/enum-types.c.template
index 5ecdd2d..85d74d1 100644
--- a/test cases/vala/8 generated sources/dependency-generated/enum-types.c.template
+++ b/test cases/vala/8 generated sources/dependency-generated/enum-types.c.template
@@ -14,9 +14,9 @@
GType
@enum_name@_get_type (void)
{
- static volatile gsize g_define_type_id__volatile = 0;
+ static gsize static_g_define_type_id = 0;
- if (g_once_init_enter (&g_define_type_id__volatile)) {
+ if (g_once_init_enter (&static_g_define_type_id)) {
static const G@Type@Value values[] = {
/*** END value-header ***/
@@ -30,10 +30,10 @@ GType
GType g_define_type_id =
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
- g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+ g_once_init_leave (&static_g_define_type_id, g_define_type_id);
}
- return g_define_type_id__volatile;
+ return static_g_define_type_id;
}
/*** END value-tail ***/