aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/__init__.py2
-rw-r--r--mesonbuild/compilers/compilers.py5
-rw-r--r--mesonbuild/compilers/mixins/clike.py15
3 files changed, 17 insertions, 5 deletions
diff --git a/mesonbuild/compilers/__init__.py b/mesonbuild/compilers/__init__.py
index aab761a..f645090 100644
--- a/mesonbuild/compilers/__init__.py
+++ b/mesonbuild/compilers/__init__.py
@@ -18,6 +18,7 @@ __all__ = [
'is_library',
'is_llvm_ir',
'is_object',
+ 'is_separate_compile',
'is_source',
'is_java',
'is_known_suffix',
@@ -62,6 +63,7 @@ from .compilers import (
is_object,
is_library,
is_known_suffix,
+ is_separate_compile,
lang_suffixes,
LANGUAGES_USING_LDFLAGS,
sort_clink,
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 76d8d72..3b7f066 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -84,7 +84,7 @@ clib_langs = ('objcpp', 'cpp', 'objc', 'c', 'nasm', 'fortran')
# List of languages that can be linked with C code directly by the linker
# used in build.py:process_compilers() and build.py:get_dynamic_linker()
# This must be sorted, see sort_clink().
-clink_langs = ('d', 'cuda') + clib_langs
+clink_langs = ('rust', 'd', 'cuda') + clib_langs
SUFFIX_TO_LANG = dict(itertools.chain(*(
[(suffix, lang) for suffix in v] for lang, v in lang_suffixes.items())))
@@ -154,6 +154,9 @@ def is_java(fname: mesonlib.FileOrString) -> bool:
suffix = fname.split('.')[-1]
return suffix in lang_suffixes['java']
+def is_separate_compile(fname: mesonlib.FileOrString) -> bool:
+ return not fname.endswith('.rs')
+
def is_llvm_ir(fname: 'mesonlib.FileOrString') -> bool:
if isinstance(fname, mesonlib.File):
fname = fname.fname
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index 1c875a3..d2eb611 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -1272,12 +1272,19 @@ class CLikeCompiler(Compiler):
# check the equivalent enable flag too "-Wforgotten-towel".
if arg.startswith('-Wno-'):
# Make an exception for -Wno-attributes=x as -Wattributes=x is invalid
- # for GCC at least. Also, the opposite of -Wno-vla-larger-than is
- # -Wvla-larger-than=N
+ # for GCC at least. Also, the positive form of some flags require a
+ # value to be specified, i.e. we need to pass -Wfoo=N rather than just
+ # -Wfoo.
if arg.startswith('-Wno-attributes='):
pass
- elif arg == '-Wno-vla-larger-than':
- new_args.append('-Wvla-larger-than=1000')
+ elif arg in {'-Wno-alloc-size-larger-than',
+ '-Wno-alloca-larger-than',
+ '-Wno-frame-larger-than',
+ '-Wno-stack-usage',
+ '-Wno-vla-larger-than'}:
+ # Pass an arbitrary value to the enabling flag; since the test program
+ # is trivial, it is unlikely to provoke any of these warnings.
+ new_args.append('-W' + arg[5:] + '=1000')
else:
new_args.append('-W' + arg[5:])
if arg.startswith('-Wl,'):