summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/cpp.py
Commit message (Collapse)AuthorAgeFilesLines
* Initial support for Metrowerks C/C++ compilerNomura2023-04-241-0/+59
|
* Add c++23 to the list of C++ standards.Jussi Pakkanen2023-04-171-1/+5
|
* compilers: Optimize the /Zc:__cplusplus codeDylan Baker2023-02-081-10/+6
| | | | This could also be handled once, in the initializer
* clang-cl: supports /std:c++20 now.Luke Elliott2023-01-041-1/+1
| | | | See https://github.com/llvm/llvm-project/commit/a8f75d49
* Add fatal=False to many mlog.warnings()Dylan Baker2023-01-031-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.
* reformat some warnings for better code readabilityDylan Baker2023-01-031-1/+1
|
* emscripten: enforce version 1.39.19 or higherKleis Auke Wolthuizen2022-12-271-0/+2
|
* Add warning_level=everythingDavid Robillard2022-11-271-9/+14
| | | | | | | | | | | | | | | | | | | | | | 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.
* compilers: remove opinionated c++ warning flagEli Schwartz2022-11-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -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
* Compilers: Keep ccache and exelist separatedXavier Claessens2022-10-251-28/+28
| | | | | Only combine them in the Compiler base class, this will make easier to run compiler without ccache.
* basic support for oneapi compilersRobert Cohn2022-10-241-1/+11
|
* pylint: enable consider-using-inDylan Baker2022-09-191-1/+1
|
* compilers: correct the MSVC version comparison for turning on __cplusplusEli Schwartz2022-09-071-1/+1
| | | | | | | | | | | | | | We compared a Visual Studio (the IDE) version, but we wanted a MSVC (the compiler) version. This caused the option to be passed for a few too many versions of MSVC, and emit a "D9002 : ignoring unknown option" on those systems. Compare the correct version using the version mapping from https://walbourn.github.io/vs-2017-15-7-update/ Fixes #10787 Co-authored-by: CorrodedCoder <38778644+CorrodedCoder@users.noreply.github.com>
* move various unused typing-only imports into type-checking blocksEli Schwartz2022-07-031-2/+4
|
* Fix invalid Python overridesTristan Partin2022-05-191-3/+1
| | | | | - mismatched method type - mismatched parameter names
* compilers/c++: Add MSVC option to make the __cplusplus define accurateEli Schwartz2022-05-081-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>
* OptionOverrideProxy: Make it immutable to avoid copiesXavier Claessens2022-03-221-13/+13
| | | | | | 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.
* fix detection of language standard library pathsPaolo Bonzini2022-03-161-12/+6
| | | | | | | | | | | | | | | | | 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>
* treewide: string-quote the first argument to T.castEli Schwartz2022-03-071-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.
* Genericise TI compiler and add MSP430 supportWilliam Toohey2022-02-021-11/+10
|
* compilers: push the compiler id to a class variableDylan Baker2022-01-101-8/+14
| | | | | | 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
* armltdclang: add support for ARM Ltd.'s `armclang` toolchainBen Boeckel2022-01-031-1/+7
| | | | | | | | | | 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
* armclang: clarify that this is support for the Keil cross-compilerBen Boeckel2021-12-161-0/+4
|
* Remove incorrect arguments for C2000 C++ compiler. Add correct form for ↵Nathanael Gray2021-11-141-12/+13
| | | | output and include args.
* various manual conversion of percent-formatted strings to f-stringsEli Schwartz2021-11-011-2/+2
|
* fix various flake8 whitespace errorsEli Schwartz2021-10-271-2/+2
|
* Add stdc++20 support for Visual Studio 2019 v16.11Moroz Oleg2021-10-241-0/+4
| | | | fix #9242
* Fix typos discovered by codespellChristian Clauss2021-10-101-3/+3
|
* fix extra whitespaceEli Schwartz2021-10-041-1/+0
| | | | discovered via flake8 --select E303
* compilers/elbrus: Deal with C/C++/Fortran stds more correctlymakise-homura2021-09-291-8/+13
|
* compilers/elbrus: Fix incorrect inheritance model of Elbrus*Compilermakise-homura2021-09-291-4/+3
|
* compilers: Add default search path stdlib_only_link_flagsDylan Baker2021-09-251-5/+32
| | | | | | | | | This should be done in all cases of language_stdlib_only_link_flags, but I don't have access to all of the compilers to test it. This is required in cases where object files created by gfortran are linked using another compiler with a differen default search path, such as gfortran and clang together.
* pylint: check for duplicate importsDylan Baker2021-09-241-1/+1
| | | | | | I ran into one of these from LGTM, and it would be nice if pylint could warn me as part of my local development process instead of waiting for the CI to tell me.
* pylint: turn on superflous-parensDylan Baker2021-08-311-2/+2
| | | | | | | | We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
* compilers: Fix extra_args parameterDylan Baker2021-08-161-1/+1
| | | | | which can also be a callable taking a CompileChekcMode as an argumetn and returning a list of strings.
* Revert "compilers/c++: Add MSVC option to make the __cplusplus define accurate"Jussi Pakkanen2021-08-151-11/+0
| | | | This reverts commit 0b97d585480e973d8b149618901f7a4ddfa1a906.
* compilers/c++: Add MSVC option to make the __cplusplus define accurateDylan Baker2021-08-111-0/+11
| | | | | 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
* more f-strings too complex to be caught by pyupgradeEli Schwartz2021-07-051-4/+3
|
* split program related classes and functions out of dependenciesDylan Baker2021-03-191-1/+2
| | | | | | Dependencies is already a large and complicated package without adding programs to the list. This also allows us to untangle a bit of spaghetti that we have.
* Add address sanitizer support for Visual Studio.Jussi Pakkanen2021-03-091-1/+0
|
* mass rewrite of string formatting to use f-strings everywhereEli Schwartz2021-03-041-5/+5
| | | | performed by running "pyupgrade --py36-plus" and committing the results
* move handling of CFLAGS and friends to environmentDylan Baker2021-01-111-2/+1
| | | | | | This has a bunch of nice features. It obviously centralizes everything, which is nice. It also means that env is only re-read at `meson --wipe`, not `meson --reconfigure`. And it's going to allow more cleanups.
* use OptionKey for builtin and base optionsDylan Baker2021-01-041-1/+1
| | | | | | | | I would have prefered to do these seperatately, but they are combined in some cases, so it was much easier to convert them together. this eliminates the builtins_per_machine dict, as it's duplicated with the OptionKey's machine parameter.
* move OptionKey to mesonlibDylan Baker2021-01-041-3/+1
| | | | | There's starting to be a lot of things including coredata that coredata needs to itself include. putting it in mesonlib makes more sense
* use OptionKey for compiler_optionsDylan Baker2021-01-041-88/+114
|
* Add choices to OptionProxyDylan Baker2021-01-041-8/+8
| | | | they're probably not strictly needed, but it makes mypy happy.
* compilers: add support for c++20/gnu++20Florian Schmaus2020-12-101-4/+7
| | | | Fixes #8084.
* compilers: define standards in the base language compilerDylan Baker2020-11-121-45/+29
| | | | | | And then update the choices in each leaf class. This way we don't end up with another case where we implicitly allow an invalid standard to be set on a compiler that doesn't have a 'std' setting currently.
* compilers: Standardize the names of compiler optionsDylan Baker2020-11-121-3/+3
| | | | | | Most options don't use language prefaced options (std vs c_std) internally, as we don't need that due to namespacing. Let's do that across the board
* compilers: Enable C++20 for Intel C++ Compiler.Vinson Lee2020-10-061-0/+3
| | | | | | | | Intel C++ Compiler 19.1 has C++20 features. https://software.intel.com/content/www/us/en/develop/articles/intel-c-compiler-191-for-linux-release-notes-for-intel-parallel-studio-xe-2020.html Signed-off-by: Vinson Lee <vlee@freedesktop.org>