Commit Graph

252 Commits

Author SHA1 Message Date
Kleis Auke Wolthuizen cd6b67dea8 emscripten: enforce version 1.39.19 or higher 2022-12-27 06:59:55 -05:00
David Robillard 81d7c24a59 Add warning_level=everything
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-27 16:50:48 -05:00
Xavier Claessens 2961adb8c8 Compilers: Keep ccache and exelist separated
Only combine them in the Compiler base class, this will make easier to
run compiler without ccache.
2022-10-25 17:24:56 -04:00
Robert Cohn 1939e567d6 basic support for oneapi compilers 2022-10-24 18:55:22 +03:00
Eli Schwartz f4cc60bf20 flake8: move typing-only imports into T.TYPE_CHECKING 2022-08-29 23:32:43 +03:00
Tristan Partin 5d0538d235 Fix invalid Python overrides
- mismatched method type
- mismatched parameter names
2022-05-19 15:05:53 -04:00
Xavier Claessens 06d12064d0 OptionOverrideProxy: Make it immutable to avoid copies
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-03-22 17:20:48 -04:00
William Toohey b4d9b2551c Genericise TI compiler and add MSP430 support 2022-02-02 16:45:05 +02:00
Dylan Baker 1209b8820b compilers: push the compiler id to a class variable
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-10 15:53:26 -05:00
Ben Boeckel f30e83efd6 armltdclang: add support for ARM Ltd.'s `armclang` toolchain
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
2022-01-03 12:49:04 -05:00
Ben Boeckel 28de74c994 armclang: clarify that this is support for the Keil cross-compiler 2021-12-16 17:08:10 -05:00
William Toohey 679adc7bf5 Support ancient (<3.4.0) gcc versions 2021-11-16 06:45:33 -05:00
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Eli Schwartz 4ab70c5512
fix extra whitespace
discovered via flake8 --select E303
2021-10-04 16:29:31 -04:00
makise-homura 0021a21930 compilers/elbrus: Deal with C/C++/Fortran stds more correctly 2021-09-29 20:16:02 -07:00
makise-homura d9b379df87 compilers/elbrus: Fix incorrect inheritance model of Elbrus*Compiler 2021-09-29 20:16:02 -07:00
Dylan Baker e3c72ad7c7 compilers: Fix extra_args parameter
which can also be a callable taking a CompileChekcMode as an argumetn
and returning a list of strings.
2021-08-16 16:21:51 -07:00
Eli Schwartz 998076a192
upgrade percent formatted strings pyupgrade did not catch 2021-06-07 16:51:47 -04:00
Dylan Baker 40e3577a65 split program related classes and functions out of dependencies
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-19 08:47:10 -04:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Dylan Baker 23d3b98fc1 split mesonlib into a package
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-23 12:48:29 +01:00
Antonin Décimo 39ede12aa5 Fix misspells
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-13 12:53:10 -05:00
Dylan Baker 4b0b44afac move handling of CFLAGS and friends to environment
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-11 11:15:06 -08:00
Dylan Baker f9b19e73a5 move OptionKey to mesonlib
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-04 12:20:40 -08:00
Dylan Baker fe973d9fc4 use OptionKey for compiler_options 2021-01-04 12:20:39 -08:00
Dylan Baker bdca05e2e6 Add choices to OptionProxy
they're probably not strictly needed, but it makes mypy happy.
2021-01-04 12:15:41 -08:00
jpark37 2748c9fb3d msvc: enable /std:c17 flag
Increase allowed c_std options, and check compiler version.

Also update mlog pattern to not crash.
2020-11-13 16:13:02 -08:00
Dylan Baker f31acbe2a4 clang-cl: Allow clang-cl (when compiling C) to pass std to underlying clang)
This allows a wider array of standard support than would be available
directly from clang-cl, emulating MSVC stds.
2020-11-12 12:52:27 -08:00
Dylan Baker 0217faf13f compilers/c: Log that MSVC doesn't support gnu stds
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-12 10:06:11 -08:00
Dylan Baker 2844afedde compilers: define standards in the base language compiler
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-12 10:03:15 -08:00
Dylan Baker a28a34c684 compilers: Standardize the names of compiler options
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-12 10:03:14 -08:00
Dylan Baker 3e62307f3a compilers/c: Clang-cl also needs specific handling for standards 2020-11-12 10:03:14 -08:00
Jussi Pakkanen 333e0aeef4 Make MSVC accept gnu11 as a language standard version. Closes: #7611.
Fixes: #7611
2020-11-12 10:03:14 -08:00
Dylan Baker 96a1ae6dfe compilers: fully type annotate the C compilers 2020-10-01 15:05:00 -07:00
Dylan Baker 2c0fbe161d compilers: make is_cross part of the base Compiler class
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-24 12:14:13 -07:00
Dylan Baker 1592b7a800 compilers: make sanity_check_impl a protected method
It's an implementation detail after all
2020-09-24 12:14:13 -07:00
Sebastian Meyer a24fde6fde
Add support for the CompCert C Compiler
* 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-09-15 21:51:21 +03:00
Jussi Pakkanen fc13c90de3
Merge pull request #7600 from alexrp/master
Add C2x option support.
2020-08-23 00:26:44 +03:00
Alex Rønne Petersen 450155110c Add C2x option support. 2020-08-22 18:57:05 +02:00
Jussi Pakkanen c42298e146
Merge pull request #7447 from scivision/nvc
Add support for NVidia HPC SDK compilers
2020-08-22 18:31:56 +03:00
Michael Hirsch f2890cbf97 msvc: enable /std:c11 flag 2020-08-09 11:48:41 -07:00
Michael Hirsch, Ph.D f985bb7383
add Nvidia HPC SDK compilers 2020-07-13 00:16:52 -04:00
Yevhenii Kolesnikov 9dc3ca2c1c compilers: add fetching of define list for clang
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-05-22 16:58:12 +03:00
John Ericson 278c294aa4 Compiler options per lang
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-04-20 23:23:15 +03:00
John Ericson 3a4388e51d Fix legacy env var support with cross
Fix #3969
2020-03-23 17:51:36 +02:00
alanNz 7460292810 -Add xc16 and c2000 C,Cpp toolchain support 2020-03-21 00:47:24 +02:00
Jussi Pakkanen 7234316dc7
Merge pull request #6688 from dcbaker/emcc-linker-bugs
Emcc linker bugs and improvments
2020-03-08 14:04:48 +02:00
Martin Storsjö 58db8d5e11 Set c_winlibs/cpp_winlibs for Clang in the same way as for GCC
clang-cl is handled as a separate case (ClangClCCompiler), which already
gets c_winlibs from VisualStudioLikeCCompilerMixin.
2020-03-03 21:49:42 +02:00
Dylan Baker 654f427759 compilers/linkers: Add a representation for wasm-ld
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-27 16:35:02 -08:00
Dylan Baker 771b0d3ffb compilers/mixins/emscripten: Implement thread support
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
2020-02-27 16:35:02 -08:00