aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
AgeCommit message (Collapse)AuthorFilesLines
2023-03-18Small fix on how cc.sizeof (and similar functions) use the 'prefix' kwargVolker Weißmann1-14/+14
2023-03-16prevent lib prefix warning from pkg-configCharles Brunet6-13/+13
2023-03-12Fix warning_level=everything with GCC 8David Robillard1-1/+3
This option was introduced with GCC 8.1.0 as in the original commit, but the value wasn't right initially and was volatile during the 8 series. To avoid this, this commit moves the warning to 9.1.0 (the next version we generally care about), since we don't want to get too deep into the weeds of point releases, and a warning not being used yet in some particular version of GCC isn't a big deal.
2023-03-09detect.py: Be more precise about detecting xtensa gcc toolchainsKhem Raj1-1/+1
clang --version can yield a string like below when its installed into such a directory clang version 14.0.0 (https://github.com/llvm/llvm-project 3f43d803382d57e3fc010ca19833077d1023e9c9) Target: aarch64-yoe-linux Thread model: posix InstalledDir: /mnt/b/yoe/master/build/tmp/work/cortexa72-yoe-linux/gnome-text-editor/42.0-r0/recipe-sysroot-native/usr/bin/aarch64-yoe-linux as you can see InstallDir has 'xt-' subtring and this trips the check to guess gcc if 'Free Software Foundation' in out or 'xt-' in out: Therefore, check if compiler output starts with xt- then assume it to be gcc Signed-off-by: Khem Raj <raj.khem@gmail.com>
2023-02-27Use caching in Compiler.sizeof() and Compiler.alignment()Andres Freund3-23/+25
2023-02-27Add Compiler.cached_run()Andres Freund1-1/+29
Caching Compiler.run() seems likely to cause problems, but some users, like .sizeof(), we know enough about the program run to make it safe. This commit just adds the Compiler.cached_run(), a subsequent commit makes use of it.
2023-02-25Misleading comment mtribiere1-1/+1
Code moved to detect.py in recent version
2023-02-20nasm: Detect and use MSVC linker if presentL. E. Segovia1-0/+3
Fixes #11082
2023-02-20nasm: Link with windows CRT libs when nasm is used as linker languageXavier Claessens2-2/+51
2023-02-17compilers: -fprofile-correction is only a valid switch with gcc itself.Luke Elliott1-1/+4
clang++ main.cpp -fprofile-correction clang-15: warning: optimization flag '-fprofile-correction' is not supported [-Wignored-optimization-argument]
2023-02-14asm: Use more backward-compatible invocation syntax for nasmSimon McVittie1-1/+1
Before version 2.14.01, -MD required an output filename argument, with `-MD outfile` equivalent to later versions' `-MD -MF outfile`. The older syntax is still supported, and is still listed as the preferred syntax in documentation. Reference: https://github.com/netwide-assembler/nasm/commit/3475462e Resolves: https://github.com/mesonbuild/meson/issues/11395 Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-10cython: wire up support for emitting and using depfilesEli Schwartz1-1/+9
This solves rebuild issues when e.g. importing a .pxd header from a .pyx file, just like C/C++ source headers. The transpiler needs to run again in this case. This functionality is present in the 3.0.0 alphas of cython, and is also backported to 0.29.33. Fixes #9049
2023-02-08compilers: Optimize the /Zc:__cplusplus codeDylan Baker1-10/+6
This could also be handled once, in the initializer
2023-02-08compilers: Remove /utf-8 from Visual Studio command args onceDylan Baker1-3/+9
Instead of looking at it each time get_always_args() is called, do it once. Also avoid mutating global state.
2023-02-08compilers: Copy const always_args before returningDylan Baker1-1/+2
Eventually we would probably be better served (to avoid unnecessary copies) to use the ImmutableListProtocol here, but for the moment this is effective, it's also what we do in every other case.
2023-02-07Visual Studio: Drop /utf-8 if it is not supportedChun-wei Fan1-0/+10
We assume /utf-8 for all C builds unless /source-charset or /execution-charset is specified, but then this will cause trouble for Visual Studio 2013 or earler since the /utf-8 flag is only supported since Visual Studio 2015. Specifically, if we try to check whether compiler flags are supported, those checks will fail since /utf-8 is never supported on these older Visual Studio versions. Drop /utf-8 from get_always_args() if we are using Visual Studio 2013 or earlier.
2023-02-01pylint 2.16: join iterables without repeated appendEli Schwartz1-3/+1
We do += style joining in a loop, but we could just join with `''.join()` which is faster, neater, and simpler.
2023-02-01remove unneeded type commentEli Schwartz1-1/+1
2023-02-01treewide: add future annotations importEli Schwartz11-0/+11
2023-02-01add cc.has_function_attribute('vector_size')Dudemanguy1-0/+2
2023-02-01remove /utf-8 option when /validate-charset- is presentCharles Brunet1-1/+3
2023-01-31cuda: enable C++20 for CUDA 12David Seifert1-2/+15
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-compilers
2023-01-18 Fix nasm when target has threads as added dependencyGijs Peskens1-0/+8
2023-01-04clang-cl: supports /std:c++20 now.Luke Elliott1-1/+1
See https://github.com/llvm/llvm-project/commit/a8f75d49
2023-01-03Add fatal=False to many mlog.warnings()Dylan Baker1-3/+4
There are lots of warnings that become fatal, that are simply unfixable by the end user. Things like using old versions of software (because they're using some kind of LTS release), warnings about compilers not supporting certain kinds of checks, or standards being upgraded due to skipped implementations (MSVC has c++98 and c++14, but not c++11). None of these should be fatal, they're informative, and too important to reduce to notices, but not important enough to stop meson if they're printed.
2023-01-03reformat some warnings for better code readabilityDylan Baker1-1/+1
2022-12-27emscripten: remove no longer relevant commentKleis Auke Wolthuizen1-2/+1
This was fixed in Emscripten 1.39.16, see: https://github.com/emscripten-core/emscripten/commit/d4fabf3da40e7f556700b16950739d5960a91559
2022-12-27emscripten: enforce version 1.39.19 or higherKleis Auke Wolthuizen2-0/+4
2022-12-27emscripten: remove redundant `thread_flags` implementationKleis Auke Wolthuizen1-3/+0
Since it's the same as the one in `CLikeCompiler`.
2022-12-27emscripten: use single arguments when specifying optionsKleis Auke Wolthuizen1-1/+1
i.e. without a space between the "-s" and option name. See: https://github.com/emscripten-core/emscripten/issues/11463 This is supported since Emscripten 1.39.19, see: https://github.com/emscripten-core/emscripten/commit/f45bea21f3a8f74a68ed4e3e3d7e290807ee2aff
2022-12-27emscripten: prefer `-pthread` over `-s USE_PTHREADS=1`Kleis Auke Wolthuizen1-2/+2
See: https://github.com/emscripten-core/emscripten/issues/12346 This is supported since Emscripten 1.38.33, see: https://github.com/emscripten-core/emscripten/commit/24350798a8570f567327f873cf1efb0361aec284
2022-12-22meson: Cache os.path.realpath in CLikeCompilerArgsNirbheek Chauhan1-4/+9
Profiling showed that we were spending 25s inside os.path.realpath() on Windows while generating compile lines for build.ninja, inside NinjaBackend.generate() The real path for these will not (should not) change during a single meson invocation, so cache all these. Brings build.ninja generation from 73s to 47s on my machine.
2022-11-30pylint: enable the set_membership pluginDylan Baker6-9/+9
Which adds the `use-set-for-membership` check. It's generally faster in python to use a set with the `in` keyword, because it's a hash check instead of a linear walk, this is especially true with strings, where it's actually O(n^2), one loop over the container, and an inner loop of the strings (as string comparison works by checking that `a[n] == b[n]`, in a loop). Also, I'm tired of complaining about this in reviews, let the tools do it for me :)
2022-11-29Don't ignore documentation-related flags for D compilersAxel Ricard1-1/+3
Fixes #11085
2022-11-27Add warning_level=everythingDavid Robillard15-40/+321
Adds a new maximum warning level that is roughly equivalent to "all warnings". This adds a way to use `/Wall` with MSVC (without the previous broken warning), `-Weverything` with clang, and almost all general warnings in GCC with strictness roughly equivalent to clang's `-Weverything`. The GCC case must be implemented by meson since GCC doesn't provide a similar option. To avoid maintenance headaches for meson, this warning level is defined objectively: all warnings are included except those that require specific values or are specific to particular language revisions. This warning level is mainly intended for new code, and it is expected (nearly guaranteed) that projects will need to add some suppressions to build cleanly with it. More commonly, it's just a handy way to occasionally take a look at what warnings are present with some compiler, in case anything interesting shows up you might want to enable in general. Since the warnings enabled at this level are inherently unstable with respect to compiler versions, it is intended for use by developers and not to be set as the default.
2022-11-22compilers: remove opinionated c++ warning flagEli Schwartz2-6/+6
-Wnon-virtual-dtor is not what people think of as a standard warning flag. It was previously removed from -Wall in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16190 on the grounds that people didn't like it and were refusing to use -Wall at all because it forced this warning. Instead, it is enabled by -Weffc++ which is typically not enabled and even comes with GCC documentation warnings stating that the standard library doesn't obey it, and you might need to `grep -v` and filter out warnings. (!!!) It doesn't fit into the typical semantics of Meson's warning_level option, which usually aligns with compiler standard warning levels rather than a niche ideological warning level. It was originally added in commit 22af56e05aa9cba4740d2ff303d876bb0c3cfb2b, but without any specific rationale included, and has gone unquestioned since then -- except by the Meson users who see it, assume there is a finely crafted design behind it, and quietly opt out by rolling their own warning options with `add_project_arguments('-Wall', ...)`. Furthermore a GCC component maintainer for the C++ standard library opened a Meson bug report specially to tell us that this warning flag is a "dumb option" and "broken by design" and "doesn't warn about the right thing anyway", thus it should not be used. This is a reasonably authoritative source that maybe, just maybe, this flag... is too opinionated to force upon Meson users without recourse. It's gone beyond opinionated and into the realm of compiler vendors seem to think that the state of the language would be better if the flag did not exist at all, whether default or not. Fixes #11096
2022-11-05nasm: Fix get_optimization_args()Ole André Vadla Ravnås1-1/+11
2022-11-01nasm: Implement get_crt_compile_args()Xavier Claessens1-0/+3
This fix a crash when using NASM on Windows.
2022-10-25compilers: Make sure to not use ccache in compiler checksXavier Claessens5-12/+10
ccache was used in all command lines but disabled using CCACHE_DISABLE in Compiler.compile() method. Wrapping invokations still has a cost, especially on Windows. With sccache things are even worse because CCACHE_DISABLE was not respected at all, making configure *extremely* slow on Windows when sccache is installed.
2022-10-25Compilers: Keep ccache and exelist separatedXavier Claessens15-112/+110
Only combine them in the Compiler base class, this will make easier to run compiler without ccache.
2022-10-24Fix mismatched param names between Compiler and BasicLinkerIsCompilerMixinTristan Partin2-6/+10
2022-10-24Use f-strings in JavaCompilerTristan Partin1-2/+2
2022-10-24Add missing compiler functions to JavaCompilerTristan Partin1-0/+6
Fixes #2571
2022-10-24basic support for oneapi compilersRobert Cohn4-4/+65
2022-10-24Add MASM compilerXavier Claessens3-1/+159
ml and armasm are Microsoft's Macro Assembler, part of MSVC.
2022-10-24Not all compilers support depfileXavier Claessens2-2/+2
2022-10-24nasm: Harcode default path on WindowsXavier Claessens1-0/+4
NASM's installer does not add itself into PATH, even when installed by choco.
2022-10-24Add yasm as fallback for nasm languageXavier Claessens2-3/+25
2022-10-24Add NASM compilerXavier Claessens3-1/+110
2022-10-23gnulike: Fix preprocessing files with any extensionXavier Claessens1-0/+6