aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/c.py
AgeCommit message (Collapse)AuthorFilesLines
2022-12-27emscripten: enforce version 1.39.19 or higherKleis Auke Wolthuizen1-0/+2
2022-11-27Add warning_level=everythingDavid Robillard1-7/+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.
2022-10-25Compilers: Keep ccache and exelist separatedXavier Claessens1-32/+32
Only combine them in the Compiler base class, this will make easier to run compiler without ccache.
2022-10-24basic support for oneapi compilersRobert Cohn1-0/+10
2022-08-29flake8: move typing-only imports into T.TYPE_CHECKINGEli Schwartz1-1/+3
2022-05-19Fix invalid Python overridesTristan Partin1-3/+1
- mismatched method type - mismatched parameter names
2022-03-22OptionOverrideProxy: Make it immutable to avoid copiesXavier Claessens1-16/+16
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-02-02Genericise TI compiler and add MSP430 supportWilliam Toohey1-19/+6
2022-01-10compilers: push the compiler id to a class variableDylan Baker1-5/+7
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-03armltdclang: add support for ARM Ltd.'s `armclang` toolchainBen Boeckel1-0/+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
2021-12-16armclang: clarify that this is support for the Keil cross-compilerBen Boeckel1-0/+4
2021-11-16Support ancient (<3.4.0) gcc versionsWilliam Toohey1-1/+4
2021-10-27fix various flake8 whitespace errorsEli Schwartz1-3/+3
2021-10-04fix extra whitespaceEli Schwartz1-1/+0
discovered via flake8 --select E303
2021-09-29compilers/elbrus: Deal with C/C++/Fortran stds more correctlymakise-homura1-6/+12
2021-09-29compilers/elbrus: Fix incorrect inheritance model of Elbrus*Compilermakise-homura1-5/+3
2021-08-16compilers: Fix extra_args parameterDylan Baker1-1/+2
which can also be a callable taking a CompileChekcMode as an argumetn and returning a list of strings.
2021-06-07upgrade percent formatted strings pyupgrade did not catchEli Schwartz1-3/+3
2021-03-19split program related classes and functions out of dependenciesDylan Baker1-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.
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz1-3/+3
performed by running "pyupgrade --py36-plus" and committing the results
2021-01-23split mesonlib into a packageDylan Baker1-1/+2
Currently mesonlib does some import tricks to figure out whether it needs to use windows or posix specific functions. This is a little hacky, but works fine. However, the way the typing stubs are implemented for the msvcrt and fnctl modules will cause mypy to fail on the other platform, since the functions are not implemented. To aleviate this (and for slightly cleaner design), I've split mesonlib into a pacakge with three modules. A universal module contains all of the platform agnositc code, a win32 module contains window specific code, a posix module contains the posix specific code, and a platform module contains no-op implementations. Then the package's __init__ file imports all of the universal functions and all of the functions from the approriate platform module, or the no-op versions as fallbacks. This makes mypy happy, and avoids `if`ing all over the code to switch between the platform specific code.
2021-01-13Fix misspellsAntonin Décimo1-1/+1
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-11move handling of CFLAGS and friends to environmentDylan Baker1-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.
2021-01-04move OptionKey to mesonlibDylan Baker1-2/+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
2021-01-04use OptionKey for compiler_optionsDylan Baker1-62/+79
2021-01-04Add choices to OptionProxyDylan Baker1-12/+12
they're probably not strictly needed, but it makes mypy happy.
2020-11-13msvc: enable /std:c17 flagjpark371-8/+19
Increase allowed c_std options, and check compiler version. Also update mlog pattern to not crash.
2020-11-12clang-cl: Allow clang-cl (when compiling C) to pass std to underlying clang)Dylan Baker1-34/+33
This allows a wider array of standard support than would be available directly from clang-cl, emulating MSVC stds.
2020-11-12compilers/c: Log that MSVC doesn't support gnu stdsDylan Baker1-1/+13
Since the current approach of demoting to the nearest C standard *might* work, but might not. For projects like Glib that detect which standard is used and fall back this is fine. For projects like libdrm that only work with gnu standards, this wont. We're nog tusing a warning because this shouldn't be fatal if --meson-fatal-warnings is used. Also demote a similar message in IntelCl from warning to log.
2020-11-12compilers: define standards in the base language compilerDylan Baker1-84/+28
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.
2020-11-12compilers: Standardize the names of compiler optionsDylan Baker1-9/+9
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
2020-11-12compilers/c: Clang-cl also needs specific handling for standardsDylan Baker1-0/+19
2020-11-12Make MSVC accept gnu11 as a language standard version. Closes: #7611.Jussi Pakkanen1-3/+7
Fixes: #7611
2020-10-01compilers: fully type annotate the C compilersDylan Baker1-120/+196
2020-09-24compilers: make is_cross part of the base Compiler classDylan Baker1-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.
2020-09-24compilers: make sanity_check_impl a protected methodDylan Baker1-1/+1
It's an implementation detail after all
2020-09-15Add support for the CompCert C CompilerSebastian Meyer1-0/+31
* Add preliminary support for the CompCert C Compiler The intention is to use this with the picolibc, so some GCC flags are automatically filtered. Since CompCert uses GCC is for linking, those GCC-linker flags which are used by picolibc, are automatically prefixed with '-WUl', so that they're passed to GCC. Squashed commit of the following: commit 4e0ad66dca9de301d2e41e74aea4142afbd1da7d Author: Sebastian Meyer <meyer@absint.com> Date: Mon Aug 31 14:20:39 2020 +0200 remove '-fall' from default arguments, also filter -ftls-model=.* commit 41afa3ccc62ae72824eb319cb8b34b7e6693cb67 Author: Sebastian Meyer <meyer@absint.com> Date: Mon Aug 31 14:13:55 2020 +0200 use regex for filtering ccomp args commit d68d242d0ad22f8bf53923ce849da9b86b696a75 Author: Sebastian Meyer <meyer@absint.com> Date: Mon Aug 31 13:54:36 2020 +0200 filter some gcc arguments commit 982a01756266bddbbd211c54e8dbfa2f43dec38f Author: Sebastian Meyer <meyer@absint.com> Date: Fri Aug 28 15:03:14 2020 +0200 fix ccomp meson configuration commit dce0bea00b1caa094b1ed0c6c77cf6c12f0f58d9 Author: Sebastian Meyer <meyer@absint.com> Date: Thu Aug 27 13:02:19 2020 +0200 add CompCert to meson (does not fully work, yet) * remove unused import and s/cls/self/ fixes the two obvious LGTM warnings * CompCert: Do not ignore unsupported GCC flags Some are safe to ignore, however, as per https://github.com/mesonbuild/meson/pull/7674, they should not be ignored by meson itself. Instead the meson.build should take care to select only those which are actually supported by the compiler. * remove unused variable * Only add arguments once. * Apply suggestions from code review Co-authored-by: Dylan Baker <dylan@pnwbakers.com> * Remove erroneous ' ' from '-o {}'.format() As noticed by @dcbaker * added release note snippet for compcert * properly split parameters As suggested by @dcbaker, these parameters should be properly split into multiple strings. Co-authored-by: Dylan Baker <dylan@pnwbakers.com> * Update add_compcert_compiler.md Added a sentence about the state of the implementation (experimental); use proper markdown * properly separate arguments Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2020-08-23Merge pull request #7600 from alexrp/masterJussi Pakkanen1-2/+13
Add C2x option support.
2020-08-22Add C2x option support.Alex Rønne Petersen1-2/+13
2020-08-22Merge pull request #7447 from scivision/nvcJussi Pakkanen1-0/+9
Add support for NVidia HPC SDK compilers
2020-08-09msvc: enable /std:c11 flagMichael Hirsch1-0/+20
2020-07-13add Nvidia HPC SDK compilersMichael Hirsch, Ph.D1-0/+9
2020-05-22compilers: add fetching of define list for clangYevhenii Kolesnikov1-2/+3
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-04-20Compiler options per langJohn Ericson1-43/+86
A current rather untyped storage of options is one of the things that contributes to the options code being so complex. This takes a small step in synching down by storing the compiler options in dicts per language. Future work might be replacing the langauge strings with an enum, and defaultdict with a custom struct, just like `PerMachine` and `MachineChoice`.
2020-03-23Fix legacy env var support with crossJohn Ericson1-1/+1
Fix #3969
2020-03-21-Add xc16 and c2000 C,Cpp toolchain supportalanNz1-0/+91
2020-03-08Merge pull request #6688 from dcbaker/emcc-linker-bugsJussi Pakkanen1-2/+2
Emcc linker bugs and improvments
2020-03-03Set c_winlibs/cpp_winlibs for Clang in the same way as for GCCMartin Storsjö1-0/+6
clang-cl is handled as a separate case (ClangClCCompiler), which already gets c_winlibs from VisualStudioLikeCCompilerMixin.
2020-02-27compilers/linkers: Add a representation for wasm-ldDylan Baker1-2/+2
Emscripten does have a stand alone linker, wasm-ld. This patch adds the linker, adds detection for the linker, and removes the IsLinkerMixin for emscripten. This is a little more correct, and makes the code a lot cleaner and more robust.
2020-02-27compilers/mixins/emscripten: Implement thread supportDylan Baker1-1/+1
Emscripten has pthread support (as well as C++ threads), but we don't currently implement them. This fixes that by adding the necessary code. The one thing I'm not sure about is setting the pool size. The docs suggest that you really want to do this to ensure that your code works correctly, but the number should really be configurable, not sure how to set that. Fixes #6684