aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
AgeCommit message (Collapse)AuthorFilesLines
2022-06-06compilers: Add support for stand-alone leak sanitizerMarco Trevisan (Treviño)1-1/+1
Leak sanitizer can be enabled without the whole AddressSanitizer, this can be done by passing -fsanitize=leak as documented at [1]. Meson doesn't support this, so add support for it. [1] https://clang.llvm.org/docs/LeakSanitizer.html
2022-06-01compiler: Add missing needs_static_linker to base Compiler classDylan Baker1-0/+3
2022-05-25Fix optimization level 's' for the TI compilerAndreas Obergschwandtner1-1/+1
2022-05-23move various imports into TYPE_CHECKING blocks for neatnessEli Schwartz1-8/+10
2022-05-19Fix invalid Python overridesTristan Partin3-10/+6
- mismatched method type - mismatched parameter names
2022-05-19Add cc.has_function_attribute('sentinel')Tristan Partin1-0/+2
2022-05-19Add cc.has_function_attribute('section')Tristan Partin1-0/+6
2022-05-09compilers/gnu: demote visibilty inlineshidden to hidden for unsupported ↵Eli Schwartz1-0/+2
compilers This option is only valid for C++ and ObjC++, but the kwarg is useful for mixed language targets. Asking for inlines as well, when the compiler driver is trying to build the C components of a target, results in gcc emitting: ``` cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C ``` Squelch this warning by filtering it out on Meson's side of things.
2022-05-08compilers/c++: Add MSVC option to make the __cplusplus define accurateEli Schwartz1-0/+10
Otherwise it always returns the value for c++98, starting with MSVC 2017 15.7 or later. Earlier versions are not affected by this mis-feature. See: https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-160 This was originally applied as 0b97d585480e973d8b149618901f7a4ddfa1a906 but later reverted because it made the CI red. Try it again, now. Original-patch-by: Dylan Baker <dylan@pnwbakers.com> Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2022-05-06compiler.has_argument: Add `-Werror=unknown-warning-option` to clang-cl cmd lineKhairul Azhar Kasmiran1-1/+1
2022-04-30implement and test a few compiler checks for DRemi Thebault1-2/+99
- run - sizeof - alignment - has_header
2022-04-30linkers: Add support for mold linkerFini Jastrow7-43/+51
[why] Support for the relatively new mold linker is missing. If someone wants to use mold as linker `LDFLAGS="-B/path/to/mold"` has to be added instead of the usual `CC_LD=mold meson ...` or `CXX_LD=mold meson ...`. [how] Allow `mold' as linker for clang and newer GCC versions (that versions that have support). The error message can be a bit off, because it is generic for all GNU like compilers, but I guess that is ok. (i.e. 'mold' is not listed as possible linker, even if it would be possible for the given compiler.) [note] GCC Version 12.0.1 is not sufficient to say `mold` is supported. The expected release with support will be 12.1.0. On the other hand people that use the un-released 12.0.1 will probably have built it from trunk. Allowing 12.0.1 is helping bleeding edge developers to use mold in Meson already now. Fixes: #9072 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-04-25Visual Studio: Only use /utf-8 on VS2015 or later or clang-clChun-wei Fan1-0/+4
The compiler flag only exists on Visual Studio 2015 or later, or clang-cl, and using this always can interfere with compiler feature detection when this flag is not supported. So, remove '/utf-8' from always_args if we are on Visual Studio 2013 or earlier.
2022-04-13compilers: fix broken CompCert support for release flagsEli Schwartz1-1/+1
This has been broken ever since the original implementation. Due to a typo, the optimization flag used a zero instead of an uppercase "o", which the compiler then breaks on during argument parsing because it is an invalid argument. Fixes #10267
2022-03-31Merge pull request #9989 from ePirat/epirat-fix-uscore-prefix-detectionJussi Pakkanen2-7/+91
Fix underscore detection
2022-03-31clike: print stderr instead of stdout for debuggingMarvin Scholz1-1/+1
When something goes wrong with running the compiler in _symbols_have_underscore_prefix_searchbin, print stderr instead, as it actually contains helpful output while stdout is usually empty in this case.
2022-03-31visualstudio: do not query underscore define with MSVCMarvin Scholz1-0/+17
MSVC does not has the builtin define to check for the symbol prefix, so do not try to query it at all, to save some time.
2022-03-31clike: add more reliable ways to check underscore prefixMarvin Scholz1-6/+73
Fix #5482
2022-03-30compilers/gnu: use Popen_safe to prevent resource leaksMarvin Scholz1-8/+1
Fixes the following ResourceWarnings: ResourceWarning: subprocess 25556 is still running _warn("subprocess %s is still running" % self.pid, ResourceWarning: Enable tracemalloc to get the object allocation traceback mesonbuild/compilers/mixins/gnu.py:195: ResourceWarning: unclosed file <_io.BufferedReader name=4> return gnulike_default_include_dirs(tuple(self.exelist), self.language).copy() ResourceWarning: Enable tracemalloc to get the object allocation traceback
2022-03-24Debian renamed cython to cython3, support bothXavier Claessens1-1/+1
2022-03-22OptionOverrideProxy: Make it immutable to avoid copiesXavier Claessens10-46/+46
It is always used as an immutable view so there is no point in doing copies. However, mypy insist it must implement the same APIs as Dict[OptionKey, UserOption[Any]] so keep faking it.
2022-03-22compilers: fix mypy warning in Rust detectionDylan Baker1-0/+1
2022-03-16fix detection of language standard library pathsPaolo Bonzini2-20/+10
The code in the C++ and Fortran compilers' language_stdlib_only_link_flags method is broken and cannot possibly have ever worked. Instead of splitting by line, it splits by whitespace and therefore, instead of the last line of the compiler output: programs: =/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin libraries: =/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0 it is only the last field that has its first 11 characters removed. Instead of reinventing the wheel with a new and brittle pattern, reuse get_compiler_dirs. Fixes: 64c267c49 ("compilers: Add default search path stdlib_only_link_flags", 2021-09-25) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-12remove unused type ignore that mypy 0.940 no longer needsEli Schwartz1-1/+1
And now that it doesn't need it, it errors out when you use it.
2022-03-07treewide: string-quote the first argument to T.castEli Schwartz1-1/+1
Using future annotations, type annotations become strings at runtime and don't impact performance. This is not possible to do with T.cast though, because it is a function argument instead of an annotation. Quote the type argument everywhere in order to have the same effect as future annotations. This also allows linters to better detect in some cases that a given import is typing-only.
2022-03-02compilers/gnu: set level 0 optimization to '-O0'Dylan Baker1-1/+1
GCC with optimization set to 0 does not actually result in no optimizations, which can be annoying when trying to use a debugger like gdb, and finding that your variable has been optimized out. We already do this with clang, so gcc is a bit of an outlier here.
2022-03-01compilers/d: fix mangling of rpath-link in DMD-like compilersEli Schwartz1-1/+1
We didn't consider that it has arguments following it, so the resulting compiler command line ended up with stuff like: -L=-rpath-link -L=-L=/path/to/directory -L=more-args and the directory for rpath-link got eaten up as a regular -L path to the compiler rather than being passed as -Xlinker to the linker. Then the -rpath-link would consume the next -Xlinker argument, end up with the wrong rpath-link (may or may not cause link errors) and then disappear arguments we need. As an example failure mode, if the next argument is -soname this treats the soname text as an input file, which probably does not exist if it was generated in a subdirectory, and also because it can never be successfully built in the first place -- though if it did, it would link to itself which is very wrong.
2022-02-16flake8: fix various whitespace errors with badly aligned codeEli Schwartz4-9/+9
2022-02-16flake8: remove some redundant separatorsEli Schwartz1-1/+1
2022-02-16flake8: fix wrong numbers of blank line separatorsEli Schwartz1-0/+3
2022-02-16flake8: fix typoed whitespace surrounding tokensEli Schwartz1-1/+1
2022-02-06dlang: fix #9250 invalid include flag for root directoryTobias Pankrath1-0/+2
2022-02-02Genericise TI compiler and add MSP430 supportWilliam Toohey5-62/+83
2022-01-27mark regex string as raw string to fix invalid escapesEli Schwartz1-2/+2
2022-01-27flake8: fix indentation styleEli Schwartz1-23/+23
2022-01-26compilers/c_function_attributes: add retainArsen Arsenović1-0/+1
retain is a relatively young attribute which has proven itself useful for working with --gc-sections -z start-stop-gc.
2022-01-15Fix system include arguments for clang-clGatgat1-0/+4
2022-01-10compilers: push the compiler id to a class variableDylan Baker21-74/+79
It really is a per class value, and shouldn't be set per instance. It also allows us to get rid of useless constructors, including those breaking mypy
2022-01-10Merge pull request #9739 from mathstuf/armclang-supportJussi Pakkanen5-1/+59
Armclang support
2022-01-03armltdclang: add support for ARM Ltd.'s `armclang` toolchainBen Boeckel4-1/+48
This is another toolchain also called `armclang`, but it is not a cross compiler like Keil's `armclang`. It is essentially the same as `clang` based on its interface and CMake's support of the toolchain. Use an `armltd` prefix for the compiler ID. Fixes: #7255
2021-12-30fix type annotations for compiler toolchain rpathsEli Schwartz4-4/+4
We pass around a tuple of rpaths, because rpaths *can* be more than one. But all the annotations said it would be a str instead.
2021-12-30Fix mypy 0.930 issuesTristan Partin1-1/+1
Removed errant "type: ignore". Fixed issue with "fetch" call. This issue was the following: Dict::get() and Dict::pop() have the following signature: T.Callable[[_T, _U], _U | None] OR T.Callable[[_T], _U | None] Note how the return type is _U here. When the fetch() function was actually being called, it had the following signature: T.Callable[[_T, T.List[_U]], T.Union[T.List[_U], _U]] This is incompatible with the previous definitions. The solution is simply to move where the default value is introduced if fetch() produces None.
2021-12-16armclang: clarify that this is support for the Keil cross-compilerBen Boeckel3-0/+11
2021-12-08clang-cl: add a translation pass for `-isystem` args to workSahnvour1-0/+14
2021-11-27Fix _calculate_toolset_version for VS2022.Luke Elliott1-0/+2
2021-11-27Add -g for debug builds.Nathanael Gray1-1/+1
2021-11-27Fix more code which appears copied from CcrxCompiler.Nathanael Gray1-4/+6
2021-11-22ldc2: invoke -Oz instead of -OsDenis Feklushkin1-1/+1
2021-11-16Support ancient (<3.4.0) gcc versionsWilliam Toohey1-1/+4
2021-11-15only pass clang LTO arguments when they are neededEli Schwartz1-2/+4
If the LTO threads == 0 clang will default to the same argument we manually pass, which meant we dropped support for admittedly ancient versions of clang that didn't yet add that option. Drop the extraneous argument, and add a specific error condition when too old versions of clang are detected. Fixes #9569