summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/objcpp.py
Commit message (Collapse)AuthorAgeFilesLines
* Add warning_level=everythingDavid Robillard2022-11-271-3/+7
| | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -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-6/+6
| | | | | Only combine them in the Compiler base class, this will make easier to run compiler without ccache.
* flake8: move typing-only imports into T.TYPE_CHECKINGEli Schwartz2022-08-291-1/+3
|
* OptionOverrideProxy: Make it immutable to avoid copiesXavier Claessens2022-03-221-1/+1
| | | | | | 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 various flake8 whitespace errorsEli Schwartz2021-10-271-2/+2
|
* fix extra whitespaceEli Schwartz2021-10-041-1/+0
| | | | discovered via flake8 --select E303
* objc/objcpp compiler: accept all gnu stds corresponding to c/c++ stdsEli Schwartz2021-09-101-1/+1
| | | | | | | | | | | | | | | | | 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
* Make objective C use C standard version. Closes #5495.Jussi Pakkanen2021-05-111-1/+20
|
* Clean up unused importsRalf Gommers2021-05-021-2/+1
|
* Use sanity_check_impl for objc/objppRalf Gommers2021-05-021-24/+2
| | | | | | | | | 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
* split program related classes and functions out of dependenciesDylan Baker2021-03-191-1/+1
| | | | | | 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.
* use OptionKey for compiler_optionsDylan Baker2021-01-041-1/+1
|
* compilers/objcpp: add type annotationsDylan Baker2020-09-241-14/+30
|
* compilers: make is_cross part of the base Compiler classDylan Baker2020-09-241-2/+2
| | | | | | | 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.
* compilers: Add Apple subclasses for ObjC and ObjC++Dylan Baker2020-08-221-0/+6
| | | | | These are needed because in some cases we need to be able to know if we're using vanilla clang or Apple's clang.
* compilers: add fetching of define list for clangYevhenii Kolesnikov2020-05-221-1/+1
| | | | | | | | | | | | | | | 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>
* compilers: Fix accidental coredata mutationsOle André Vadla RavnÄs2020-03-291-1/+2
|
* types: import typing as T (fixes #6333)Daniel Mensinger2020-01-081-3/+3
|
* compilers: Make get_display_language a class or static methodDylan Baker2019-12-121-1/+2
| | | | | | | | 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.
* compilers: move language attribute to the class levelDylan Baker2019-12-121-1/+3
| | | | | 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.
* Use strict function prototypesMichael Hirsch, Ph.D2019-11-181-1/+1
|
* compilers: replace CompilerType with MachineInfoDylan Baker2019-10-071-8/+17
| | | | | | 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
* compilers/objc[pp]: Pass extra keyword arguments to Compiler constructorDylan Baker2019-08-141-6/+6
|
* compilers: Put clang mixin in a moduleDylan Baker2019-07-151-1/+2
|
* compilers: split gnu and gnulike compilers out of compilersDylan Baker2019-07-151-1/+2
| | | | | I debated a bit whether both classes really belong in the same module, and decided that they do because the share a number of helpers.
* compilers: Move clike into a mixins directoryDylan Baker2019-07-151-1/+1
| | | | | | | The compilers module is rather large and confusing, with spaghetti dependencies going every which way. I'm planning to start breaking out the internal representations into a mixins submodule, for things that shouldn't be required outside of the compilers module itself.
* Do not fail on passing `-Werror=unused-parameter` from environmentDavid Seifert2019-07-141-1/+1
|
* compilers: Fix bitcode and other options for objc codeNirbheek Chauhan2019-06-231-1/+0
| | | | | | | | | | | | We were setting the base options for the Objective-C compiler manually, due to which options such as b_bitcode and b_ndebug were not getting set at all. The base options here are the same as for C code with the Clang compiler, so just use the same inherited list. Also expand the bitcode test to ObjC and ObjC++ so this doesn't happen again.
* Purge `is_cross` and friends without changing user interfacesJohn Ericson2019-06-091-12/+8
| | | | | | | | | | | | In most cases instead pass `for_machine`, the name of the relevant machines (what compilers target, what targets run on, etc). This allows us to use the cross code path in the native case, deduplicating the code. As one can see, environment got bigger as more information is kept structured there, while ninjabackend got a smaller. Overall a few amount of lines were added, but the hope is what's added is a lot simpler than what's removed.
* compilers: Split C-Like functionality into a mixin classesDylan Baker2019-05-031-5/+7
| | | | | | | | | | | | | | | | | Currently C++ inherits C, which can lead to diamond problems. By pulling the code out into a standalone mixin class that the C, C++, ObjC, and Objc++ compilers can inherit and override as necessary we remove one source of diamonding. I've chosen to split this out into it's own file as the CLikeCompiler class is over 1000 lines by itself. This also breaks the VisualStudio derived classes inheriting from each other, to avoid the same C -> CPP inheritance problems. This is all one giant patch because there just isn't a clean way to separate this. I've done the same for Fortran since it effectively inherits the CCompiler (I say effectively because was it actually did was gross beyond explanation), it's probably not correct, but it seems to work for now. There really is a lot of layering violation going on in the Compilers, and a really good scrubbing would do this code a lot of good.
* Sanity check with external argsJohn Ericson2019-03-271-2/+11
| | | | | | | | | Previously cross, but not native, external args were used. Then in d451a4bd97f827bb492fd0c0e357cb20b6056ed9 the cross special cases were removed, so external args are never used. This commit switches that so they are always used. Sanity checking works just the same as compiler checks like has header / has library.
* Add warning level zerojml17952019-02-191-2/+4
|
* Remove get_cross_extra_flagsJohn Ericson2019-02-151-4/+1
| | | | This is no longer needed, we just remove conditionals around it.
* Use enum instead of `int` for compiler variantsDavid Seifert2018-09-161-6/+10
| | | | | | | | * Enums are strongly typed and make the whole `gcc_type`/`clang_type`/`icc_type` distinction redundant. * Enums also allow extending via member functions, which makes the code more generalisable.
* Add 'Compiler.get_display_language'Guillaume Poirier-Morency2017-06-261-0/+3
| | | | | Use this when we print language-related information to the console and via the Ninja backend.
* Split out languages from compilers.pyAlistair Thomas2017-06-231-0/+65