summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/mixins/gnu.py
Commit message (Collapse)AuthorAgeFilesLines
* asm: Add sx extensionRenan Lavarec2023-03-231-0/+1
| | | | | | | | | | docs: gcc https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html scons: https://scons.org/doc/3.0.5/HTML/scons-user/apb.html .S Windows: assembly language file ARM: CodeSourcery Sourcery Lite .sx assembly language file + C pre-processor POSIX: assembly language file + C pre-processor
* Fix warning_level=everything with GCC 8David Robillard2023-03-121-1/+3
| | | | | | | | | | This option was introduced with GCC 8.1.0 as in the original commit, but the value wasn't right initially and was volatile during the 8 series. To avoid this, this commit moves the warning to 9.1.0 (the next version we generally care about), since we don't want to get too deep into the weeds of point releases, and a warning not being used yet in some particular version of GCC isn't a big deal.
* compilers: -fprofile-correction is only a valid switch with gcc itself.Luke Elliott2023-02-171-1/+4
| | | | | | clang++ main.cpp -fprofile-correction clang-15: warning: optimization flag '-fprofile-correction' is not supported [-Wignored-optimization-argument]
* treewide: add future annotations importEli Schwartz2023-02-011-0/+1
|
* Add warning_level=everythingDavid Robillard2022-11-271-0/+239
| | | | | | | | | | | | | | | | | | | | | | 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: Make sure to not use ccache in compiler checksXavier Claessens2022-10-251-1/+1
| | | | | | | | | | ccache was used in all command lines but disabled using CCACHE_DISABLE in Compiler.compile() method. Wrapping invokations still has a cost, especially on Windows. With sccache things are even worse because CCACHE_DISABLE was not respected at all, making configure *extremely* slow on Windows when sccache is installed.
* gnulike: Fix preprocessing files with any extensionXavier Claessens2022-10-231-0/+6
|
* compilers: Add optimization=plain optionJan Tojnar2022-10-091-0/+1
| | | | | | | | | | | | | | https://github.com/mesonbuild/meson/pull/9287 changed the `optimization=0` to pass `-O0` to the compiler. This change is reasonable by itself but unfortunately, it breaks `buildtype=plain`, which promises that “no extra build flags are used”. `buildtype=plain` is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves. Let’s introduce a new optimization level that does nothing and set it as the default for `buildtype=plain`.
* compilers/gnu: demote visibilty inlineshidden to hidden for unsupported ↔Eli Schwartz2022-05-091-0/+2
| | | | | | | | | | | | | | | compilers This option is only valid for C++ and ObjC++, but the kwarg is useful for mixed language targets. Asking for inlines as well, when the compiler driver is trying to build the C components of a target, results in gcc emitting: ``` cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C ``` Squelch this warning by filtering it out on Meson's side of things.
* linkers: Add support for mold linkerFini Jastrow2022-04-301-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | [why] Support for the relatively new mold linker is missing. If someone wants to use mold as linker `LDFLAGS="-B/path/to/mold"` has to be added instead of the usual `CC_LD=mold meson ...` or `CXX_LD=mold meson ...`. [how] Allow `mold' as linker for clang and newer GCC versions (that versions that have support). The error message can be a bit off, because it is generic for all GNU like compilers, but I guess that is ok. (i.e. 'mold' is not listed as possible linker, even if it would be possible for the given compiler.) [note] GCC Version 12.0.1 is not sufficient to say `mold` is supported. The expected release with support will be 12.1.0. On the other hand people that use the un-released 12.0.1 will probably have built it from trunk. Allowing 12.0.1 is helping bleeding edge developers to use mold in Meson already now. Fixes: #9072 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
* compilers/gnu: use Popen_safe to prevent resource leaksMarvin Scholz2022-03-301-8/+1
| | | | | | | | | | | | Fixes the following ResourceWarnings: ResourceWarning: subprocess 25556 is still running _warn("subprocess %s is still running" % self.pid, ResourceWarning: Enable tracemalloc to get the object allocation traceback mesonbuild/compilers/mixins/gnu.py:195: ResourceWarning: unclosed file <_io.BufferedReader name=4> return gnulike_default_include_dirs(tuple(self.exelist), self.language).copy() ResourceWarning: Enable tracemalloc to get the object allocation traceback
* compilers/gnu: set level 0 optimization to '-O0'Dylan Baker2022-03-021-1/+1
| | | | | | | GCC with optimization set to 0 does not actually result in no optimizations, which can be annoying when trying to use a debugger like gdb, and finding that your variable has been optimized out. We already do this with clang, so gcc is a bit of an outlier here.
* compilers: push the compiler id to a class variableDylan Baker2022-01-101-1/+1
| | | | | | 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
* Fix unsupported linker error messageAndrea Pappacoda2021-07-061-1/+1
| | | | An `f` was dropped in bd6f46e723813dfadaba1f7c87d3b0b751d05219
* condense linesEli Schwartz2021-07-051-2/+1
|
* more f-strings too complex to be caught by pyupgradeEli Schwartz2021-07-051-1/+1
|
* use an immutable list for an lru_cached functionsDylan Baker2021-06-021-2/+3
| | | | | | | | | | | | | | | | | | | | When mutable items are stored in an lru cache, changing the returned items changes the cached items as well. Therefore we want to ensure that we're not mutating them. Using the ImmutableListProtocol allows mypy to find mutations and reject them. This doesn't solve the problem of mutable values inside the values, so you could have to do things like: ```python ImmutableListProtocol[ImmutableListProtocol[str]] ``` or equally hacky. It can also be used for input types and acts a bit like C's const: ```python def foo(arg: ImmutableListProtocol[str]) -> T.List[str]: arg[1] = 'foo' # works while running, but mypy errors ```
* mass rewrite of string formatting to use f-strings everywhereEli Schwartz2021-03-041-2/+2
| | | | performed by running "pyupgrade --py36-plus" and committing the results
* Add support for LLVM's thinLTODylan Baker2021-02-021-2/+2
| | | | | | | This uses a separate option, b_lto_mode. It works in conjunction with b_lto_threads. Fixes #7493
* compilers: Add support for using multiple threads with ltoDylan Baker2021-02-021-2/+15
| | | | | | | | Both Clang and GCC support using multiple threads for preforming link time optimizaions, and they can now be configured using the `-Db_lto_threads` option. Fixes #7820
* use OptionKey for builtin and base optionsDylan Baker2021-01-041-6/+8
| | | | | | | | 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.
* Propagate Windows target checks upLaurin-Luis Lehning2020-12-141-4/+2
|
* Give get_gui_app_args access to the EnvironmentLaurin-Luis Lehning2020-12-141-1/+1
|
* Make win_subsystem a linker propertyLaurin-Luis Lehning2020-12-141-14/+0
|
* Add prelinking support for static libraries.Jussi Pakkanen2020-12-031-0/+3
|
* Revert "Add thinlto support. Closes #7493."Jussi Pakkanen2020-11-171-4/+2
| | | | This reverts commit 3e6fbde94c1cb8d4e01b7daf0282c315ff0e6c7d.
* Add thinlto support. Closes #7493.Jussi Pakkanen2020-11-081-2/+4
|
* Add win_subsystem kwarg. Closes #7765.Jussi Pakkanen2020-10-071-0/+14
|
* compilers/gnu: Don't pretend to inherit CLikeDylan Baker2020-10-011-1/+1
| | | | | We don't need it anymore, and it would be problematic for the D compilers.
* compilers: Tell mypy that the compiler mixins are just thatDylan Baker2020-09-241-25/+9
| | | | | | We do this by making the mixins inherit the Compiler class only when mypy is examining the code (using some clever inheritance shenanigans). This caught a bunch of issues, and also lets us delete a ton of code.
* compilers/mixings/gnu: make type safeDylan Baker2020-09-241-11/+34
|
* compilers: Use a distinct type for compile/link resultsDylan Baker2020-09-241-4/+3
| | | | | | | Currently we do some crazy hackery where we add extra properties to a Popen object and return that. That's crazy. Especially since some of our hackery is to delete attributes off of the Popen we don't want. Instead, let's just have a discrete type that has exactly the properties we want.
* compilers: Cache gnu-mixins has_arguments() checksNirbheek Chauhan2020-07-231-1/+1
| | | | | want_output gives us the output file. We don't need the file. We just need the compiler stderr, which is always stored.
* compilers: Silence warning about gnu_inline with clangNirbheek Chauhan2020-04-201-0/+5
| | | | | | | | | | The warning is due to a change in behaviour in Clang 10 and newer: https://releases.llvm.org/10.0.0/tools/clang/docs/ReleaseNotes.html#c-language-changes-in-clang This was already fixed for clang++, but not for clang for some reason. It was also fixed incorrectly; by adding `extern` instead of moving from `-Werror` to `-Werror=attributes`.
* compilers: Move things out of clikeDylan Baker2020-04-101-0/+3
| | | | | One method belongs in the base Compiler class, the other belongs in the GnuLikeCompiler class.
* compilers: disable b_sanitize on hurdPino Toscano2020-04-101-1/+3
| | | | ASAN is not supported on the Hurd yet.
* compilers: Error if invalid linker selectedDylan Baker2020-03-171-0/+4
|
* types: import typing as T (fixes #6333)Daniel Mensinger2020-01-081-38/+38
|
* default inc dirs: Fix warning on MSYS (fixes #6336)Daniel Mensinger2019-12-151-5/+8
|
* Allow selecting the dynamic linkerDylan Baker2019-12-021-0/+4
| | | | | | | This uses the normal meson mechanisms, an LD environment variable or via cross/native files. Fixes: #6057
* default inc dirs: fix warning for unsupporte lang (fixes #6050)Daniel Mensinger2019-10-181-2/+9
|
* Fix for issue 5355Michael Lenczewski2019-10-091-0/+12
| | | | | | | compiler.get_supported_arguments reports success for certain unsupported flags when using the gnu C/ObjC, C++/ObjC++ compilers. This fix reads the stderr on the has_arguments check to ensure the arguments really are supported and not valid for the language selection
* compilers: replace CompilerType with MachineInfoDylan Baker2019-10-071-10/+8
| | | | | | 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
* cache all gnulike_default_include_dirs invocationsDaniel Mensinger2019-10-031-5/+4
|
* compilers: Move the compiler argument to proxy linker flags to the compiler ↔Dylan Baker2019-08-301-0/+4
| | | | | | | | | | | | class Instead of the DynamicLinker returning a hardcoded value like `-Wl,-foo`, it now is passed a value that could be '-Wl,', or could be something '-Xlinker=' This makes a few things cleaner, and will make it possible to fix using clang (not clang-cl) on windows, where it invokes either link.exe or lld-link.exe instead of a gnu-ld compatible linker.
* Fix gcc include dotDylan Baker2019-08-281-0/+2
|
* compilers: Dispatch to dynamic linker classDylan Baker2019-08-141-109/+14
| | | | | Most of the cuda code is from Olexa Bilaniuk. Most of the PGI code is from Michael Hirsc
* compilers: pull sanitzier args into compiler classesDylan Baker2019-07-231-0/+13
| | | | This simplifies and cleans things up.
* compilers: return as-needed args as a listDylan Baker2019-07-231-3/+3
|
* compilers: Move lto args into compiler classDylan Baker2019-07-231-0/+6
| | | | | | | | | There are two problems, one is that it assumes -flto is the argument to do LTO/WPO, which isn't true of ICC and MSVC (and presumably) others. It's also incorrect because it assumes that the compiler and linker will always be the same, which isn't necessarily true. You could combine GCC with Apple's linker, or clang with link.exe, which use different arguments.