summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/objcpp.py
AgeCommit message (Collapse)Author
2025-11-19compilers: Remove Environment parameter from Compiler.get_option_std_argsDylan Baker
2025-11-19compilers: Remove Environment parameter from Compiler.sanity_checkDylan Baker
2025-11-19compilers: Remove Environment parameter from get_compileropt_valueDylan Baker
2025-11-19compilers: Stop passing `is_cross`Dylan Baker
This is calculated by `Environment().is_cross_build(for_machine)`. Since we have that in the Compiler class, just calculate it in the Compiler initializer
2025-11-19compilers: Pass Environment instead of MachineInfoDylan Baker
We end up needing it everywhere, so just store it. This patch is huge already, so it's just the conversion to passing Environment, more cleanups to come.
2025-10-06Revert "compilers: refactor sanity checking code"Dylan Baker
This reverts commit 806289a5d27958a084bc6cba41b7cf9ccee4ecf4.
2025-10-06compilers: refactor sanity checking codeDylan Baker
The goal is to reduce code duplication, and allow each language to implement as little as possible to get good checking. The main motivation is that half of the checks are fragile, as they add the work directory to the paths of the generated files they want to use. This works when run inside mesonmain because we always have an absolute build directory, but when put into run_project_tests.py it doesn't work because that gives a relative build directory.
2025-04-08coredata: move MutableKeyedOptionDict to optionsDylan Baker
2025-04-04compilers: move -std options to get_option_std_args, special-casing CUDAPaolo Bonzini
Move building the -std option to the new get_option_std_args method, special casing CUDA to never include the option from the host compiler. This fixes again #8523, which was broken by the option refactoring (unsurprisingly, since the fix was ripped out unceremoniously without a replacement). Fixes: #14365 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-03-10coredata: remove get_option_for_subprojectDylan Baker
This is just a wrapper around `OptionStore.get_option_for`, but without taking an `OptionKey`. This complicates the subproject passing, since `OptionKey` is designed to encapsulate the option name and subproject.
2025-02-13Make all Meson level options overridable per subproject.Jussi Pakkanen
2025-02-05compilers: remove Compiler.create_optionDylan Baker
This saves a *tiny* bit of typing, but at the cost of requiring either the current solution of throwing up our hands and saying "typing is too hard, better to have bugs!" or an extensive amount of `TypedDict`s, `overloads`, and a very new version of mypy. Let's get our type safety back, even if it means writing a little bit more code.
2025-01-27compilers: split Apple C++ version handling to a mixinDylan Baker
2025-01-27compilers/objcpp: Use the GnuCPPStdMixin for ObjC++Dylan Baker
2025-01-27compilers/objcpp: Use shared C++ standards with ClangCPPStandardDylan Baker
2024-07-30flake8: move unused typing-only imports to TYPE_CHECKINGEli Schwartz
2024-07-17Remove language (AKA compiler) type from OptionKey.Jussi Pakkanen
2024-07-11Move OptionKey in the option source file.Jussi Pakkanen
2024-06-14Replace direct indexing with named methods.Jussi Pakkanen
2024-05-23Refactor option classes to their own file.Jussi Pakkanen
2024-03-15Improve error messages for invalid option valuesCharles Brunet
By adding the option name to UserOption object, it is now possible to display the name of the affected option when the given option value is not valid. Fixes #12635
2024-03-15compilers: No need to pass exe_wrapper everywhereXavier Claessens
Places where compiler needs it already have access to Environment object and can use it directly. This fixes mypy complaining that not all compilers have self.exe_wrapper in run() method that got moved to base class.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-09-21objective-c++: add support for current supported standards in Apple ClangSteven Noonan
Pulled from this list on Xcode 15 beta: $ clang -E -dM -xobjective-c++ -std=arglbargle -o - /dev/null error: invalid value 'arglbargle' in '-std=arglbargle' note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard note: use 'c++11' for 'ISO C++ 2011 with amendments' standard note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard note: use 'c++14' for 'ISO C++ 2014 with amendments' standard note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard note: use 'c++17' for 'ISO C++ 2017 with amendments' standard note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard note: use 'c++20' for 'ISO C++ 2020 DIS' standard note: use 'gnu++20' for 'ISO C++ 2020 DIS with GNU extensions' standard note: use 'c++2b' for 'Working draft for ISO C++ 2023 DIS' standard note: use 'gnu++2b' for 'Working draft for ISO C++ 2023 DIS with GNU extensions' standard Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2023-06-26linkers: delay implementations import until detect is runEli Schwartz
This saves on a 1500-line import at startup and may be skipped entirely if no compiled languages are used. In exchange, we move the implementation to a new file that is imported instead. Followup to commit ab20eb5bbc21ae855bcd211131132d2778602bcf.
2022-11-27Add warning_level=everythingDavid Robillard
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 Schwartz
-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-10-25Compilers: Keep ccache and exelist separatedXavier Claessens
Only combine them in the Compiler base class, this will make easier to run compiler without ccache.
2022-08-29flake8: move typing-only imports into T.TYPE_CHECKINGEli Schwartz
2022-03-22OptionOverrideProxy: Make it immutable to avoid copiesXavier Claessens
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.
2021-10-27fix various flake8 whitespace errorsEli Schwartz
2021-10-04fix extra whitespaceEli Schwartz
discovered via flake8 --select E303
2021-09-10objc/objcpp compiler: accept all gnu stds corresponding to c/c++ stdsEli Schwartz
The clang compiler now reimplements and re-checks the c_std and cpp_std options in order to use them for objc as well, but it didn't consistently support the same options. First it completely excluded all the gnu ones, and then it added a handful of them but not for C++. Be fully consistent -- or at least as consistent as we can be, given a minimally working fix. (The C/C++ compiler mixin actually gates different stds depending on detected clang version, we do not do that here.) Fixes regression in c54dd63547b030e3d9feee694ec6f49c434f0df8 Fixes incomplete fix from #8766 (which didn't fix objcpp at all) Fixes #9237
2021-05-11Make objective C use C standard version. Closes #5495.Jussi Pakkanen
2021-05-02Clean up unused importsRalf Gommers
2021-05-02Use sanity_check_impl for objc/objppRalf Gommers
This gets rid of compile warnings, and simplifies the code. Note that `work_dir` in sanity_check_impl was incorrect, it was used both to prepend to file names and as cwd=work_dir argument to Popen. This is fixed here. Closes gh-7344
2021-03-19split program related classes and functions out of dependenciesDylan Baker
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.
2021-01-04use OptionKey for compiler_optionsDylan Baker
2020-09-24compilers/objcpp: add type annotationsDylan Baker
2020-09-24compilers: make is_cross part of the base Compiler classDylan Baker
Every class needs to set this, so it should be part of the base. For classes that require is_cross, the positional argument remains in their signature. For those that don't, they just allow the base class to set their value to it's default of False.
2020-08-22compilers: Add Apple subclasses for ObjC and ObjC++Dylan Baker
These are needed because in some cases we need to be able to know if we're using vanilla clang or Apple's clang.
2020-05-22compilers: add fetching of define list for clangYevhenii Kolesnikov
Simmilar to gcc, the list of pre-processor defines can be fetched with `-dM -E` option. The way cpu_family is determined on linux relies on this list. Fixes incorrect value of cpu_family on linux, when crosscompiling: ``` CC="clang -m32" meson ./build ``` Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com> Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-03-29compilers: Fix accidental coredata mutationsOle André Vadla Ravnås
2020-01-08types: import typing as T (fixes #6333)Daniel Mensinger
2019-12-12compilers: Make get_display_language a class or static methodDylan Baker
Currently this is done at the instance level, but we need it at the class level to allow compiler "lang" args to be gotten early enough. This patch also removes a couple of instance of branch/leaf classes providing their own implementation that is identical to the Compiler version.
2019-12-12compilers: move language attribute to the class levelDylan Baker
We know that if a compiler class inherits CCompiler it's language will be C, so doing this at the class level makes more sense.
2019-11-18Use strict function prototypesMichael Hirsch, Ph.D
2019-10-07compilers: replace CompilerType with MachineInfoDylan Baker
Now that the linkers are split out of the compilers this enum is only used to know what platform we're compiling for. Which is what the MachineInfo class is for
2019-08-14compilers/objc[pp]: Pass extra keyword arguments to Compiler constructorDylan Baker
2019-07-15compilers: Put clang mixin in a moduleDylan Baker