Commit Graph

1079 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
Kleis Auke Wolthuizen 4e1d0e4784 emscripten: remove redundant `thread_flags` implementation
Since it's the same as the one in `CLikeCompiler`.
2022-12-27 06:59:55 -05:00
Kleis Auke Wolthuizen 51ac9ed317 emscripten: use single arguments when specifying options
i.e. without a space between the "-s" and option name. See:
https://github.com/emscripten-core/emscripten/issues/11463

This is supported since Emscripten 1.39.19, see:
f45bea21f3
2022-12-27 06:59:55 -05:00
Kleis Auke Wolthuizen 898e85d847 emscripten: prefer `-pthread` over `-s USE_PTHREADS=1`
See: https://github.com/emscripten-core/emscripten/issues/12346

This is supported since Emscripten 1.38.33, see:
24350798a8
2022-12-27 06:59:55 -05:00
Nirbheek Chauhan 5dd3413b71 meson: Cache os.path.realpath in CLikeCompilerArgs
Profiling showed that we were spending 25s inside os.path.realpath()
on Windows while generating compile lines for build.ninja, inside
NinjaBackend.generate()

The real path for these will not (should not) change during a single
meson invocation, so cache all these.

Brings build.ninja generation from 73s to 47s on my machine.
2022-12-22 23:14:25 +05:30
Dylan Baker 2d349eae8c
pylint: enable the set_membership plugin
Which adds the `use-set-for-membership` check. It's generally faster in
python to use a set with the `in` keyword, because it's a hash check
instead of a linear walk, this is especially true with strings, where
it's actually O(n^2), one loop over the container, and an inner loop of
the strings (as string comparison works by checking that `a[n] == b[n]`,
in a loop).

Also, I'm tired of complaining about this in reviews, let the tools do
it for me :)
2022-11-30 16:23:29 -05:00
Axel Ricard 23fcea16e5 Don't ignore documentation-related flags for D compilers
Fixes #11085
2022-11-29 01:45:23 +02: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
Eli Schwartz 0404ad5601
compilers: remove opinionated c++ warning flag
-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 22af56e05a,
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-11-22 23:27:33 -05:00
Ole André Vadla Ravnås fa86a9d96d nasm: Fix get_optimization_args() 2022-11-05 19:02:27 -04:00
Xavier Claessens 64a6969def nasm: Implement get_crt_compile_args()
This fix a crash when using NASM on Windows.
2022-11-01 18:51:10 +02:00
Xavier Claessens e68fcac919 compilers: Make sure to not use ccache in compiler checks
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.
2022-10-25 17:24:56 -04: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
Tristan Partin 5a7427cebb Fix mismatched param names between Compiler and BasicLinkerIsCompilerMixin 2022-10-24 21:43:25 +03:00
Tristan Partin e05a88835a Use f-strings in JavaCompiler 2022-10-24 21:43:25 +03:00
Tristan Partin e87259f4a7 Add missing compiler functions to JavaCompiler
Fixes #2571
2022-10-24 21:43:25 +03:00
Robert Cohn 1939e567d6 basic support for oneapi compilers 2022-10-24 18:55:22 +03:00
Xavier Claessens 942aea230f Add MASM compiler
ml and armasm are Microsoft's Macro Assembler, part of MSVC.
2022-10-24 14:52:13 +02:00
Xavier Claessens e04bce3f04 Not all compilers support depfile 2022-10-24 14:52:13 +02:00
Xavier Claessens 4f4076bfc0 nasm: Harcode default path on Windows
NASM's installer does not add itself into PATH, even when installed by
choco.
2022-10-24 11:06:57 +02:00
Xavier Claessens d29ef2b128 Add yasm as fallback for nasm language 2022-10-24 11:06:57 +02:00
Xavier Claessens 01ee141339 Add NASM compiler 2022-10-24 11:06:57 +02:00
Xavier Claessens ebbaeec51b gnulike: Fix preprocessing files with any extension 2022-10-23 12:21:46 +02:00
Xavier Claessens 5e0f22896f Compilers: Add a preprocessor mode for clike compilers
A compiler object can now return a list of "modes", they are new
compiler object specialized for a specific task.
2022-10-23 12:21:46 +02:00
Tatsuyuki Ishi 673dca5c07 Add b_thinlto_cache for automatically configuring incremental ThinLTO 2022-10-13 04:18:13 -04:00
Tatsuyuki Ishi a0032480d6 clang: Support ThinLTO with mold 2022-10-13 04:18:13 -04:00
Jan Tojnar a590cfde0c compilers: Add optimization=plain option
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`.
2022-10-09 14:43:18 +03:00
Dylan Baker 676e66f853
pylint: enable consider-using-(min|max)-builtin
There's only one case of each, in the same function, so I've handled
both in the same commit.
2022-10-03 00:02:20 -04:00
Eli Schwartz 56a6ee1e5d find_library with argument beginning in "lib" is a bad idea, warn about it
We need to support cases where the library might be called "foo.so" and
therefore we check for exact matches too. But this also allows
`cc.find_library('libfoo')` to find libfoo.so, which is strange and
won't work in many cases. Emit a warning when this happens.

Fixes #10838
2022-09-28 12:53:46 +03:00
Xavier Claessens e1db50d4d9 compilers: Cleanup a bit languages/suffixes lists
Use set where order does not matter, fix is_source() to really mean only
source suffixes.
2022-09-27 11:15:07 -04:00
Eli Schwartz 30b1774628 compilers: unify fortran sanity check with its parent Clike handling
We *mostly* just need to do the same thing. Plug in one utility method
to make sanity_check_impl find the right compile args, and plug in
DEVNULL to the test run. It's that simple.

This solves a few inconsistencies. The main one is that fortran never
logged the sanity checks to the Meson debug log, making it hard to
debug.

There's also some interesting quirks we built up in the dedicated
fortran handling. For example:

- in commit 5b109c9ad2 we added cwd to
  building the fortran executable, with a wordy comment about how the
  compiler has defects. But the clike base has always done that on
  general principle anyway, so we would never have had that bug in the
  first place.

- in commit d6be7822a0 we added special
  deletion of an old "bad existing exe file" just for fortran. Looking
  at the PR discussion for this odd requirement, it turns out that the
  real problem is mixing WSL and native Windows without deleting the
  build directory. This is apparently fortran specific simply because
  "contemporary Windows 10 Fortran users" switch between the two?

  The actual problem is that this never used .exe as the output name, so
  Windows thinks you want to run something other than the thing you
  asked to run, because it's not even a Window executable. But... the
  common clike handling could have fixed that without needing special
  cases.
2022-09-22 18:15:25 -04:00
Eli Schwartz 332968da1b use simpler subprocess.run interface instead of manual Popen
This code dates back to 2012 and probably has no specific reason...
2022-09-22 18:15:25 -04:00
Eli Schwartz 0d354588ca compilers: make sanity checks log commands using join_args
It is more correct to join commands with a command joiner than a
whitespace joiner.
2022-09-22 18:15:25 -04:00
Dylan Baker 4da14918cd pylint: enable consider-using-in 2022-09-19 20:57:52 -04:00
Dylan Baker 188c552dcf pylint: enable use-maxsplit-arg
This finds a bunch of places where we can do more efficient string
splitting.
2022-09-19 20:57:52 -04:00
Eli Schwartz edc3e26369
fix odd mypy issue in unreachable code
This used to be fine, until imports were removed from this file. Now a
function annotated as T.NoReturn doesn't actually tell mypy that it
cannot return, though, so we manually do it.
2022-09-19 15:19:01 -04:00
Eli Schwartz 8277a1aba8
simplify type annotation 2022-09-19 15:19:00 -04:00
Eli Schwartz ab20eb5bbc
compilers: avoid importing compilers upfront for detect
We no longer need these upfront at all, since we now import the ones we
need for the language we are detecting, at the time of actual detection.

This avoids importing 28 files, consisting of just under 9,000 lines of
code, at interpreter startup. Now, it is only imported depending on
which languages are invoked by add_languages, which may not even be
anything. And even if we do end up importing a fair chunk of it for
C/C++ projects, spreading the import cost around the interpreter runtime
helps responsiveness.
2022-09-19 15:19:00 -04:00
Eli Schwartz cc5ef6478f
compilers: perform targeted imports for detect
Only import the ones we need for the language we are detecting, once we
actually detect that language.

This will allow finally dropping the main imports of these files in a
followup commit.
2022-09-19 15:19:00 -04:00
Eli Schwartz f6f876481f
compilers: use more direct checks for what kind of compiler we have
Instead of comparing against specific compiler classes, check the
logical compiler id or language etc.

In a couple cases, we seem to be missing a couple things by being a bit
too strict about the exact class type.
2022-09-19 15:19:00 -04:00
Eli Schwartz 775b67c5c1
compilers/detect: rename potentially conflicting name
Preparation for future commit.
2022-09-19 15:19:00 -04:00
Eli Schwartz 2b90152fe5
compilers: use consistent function signature for objc
e.g. for detect_c_or_cpp we just take the language itself as an
argument.
2022-09-19 15:19:00 -04:00
Eli Schwartz 4487a256e0
compilers: remove dead code
It doesn't matter whether the language is c or cpp, xc16 only has a C
compiler so that's what this has to be.
2022-09-19 15:19:00 -04:00
Eli Schwartz 5c4cd9162e
compilers: single-source compiler class as cls, consistently
It's the style for most, but not all, of this file.
2022-09-19 15:19:00 -04:00
Eli Schwartz d3dac3cfb2
compilers: don't export every compiler as a top-level property
This is wasteful and generally unneeded, since code can just use the
compiler they detected instead of manually poking at the internals of
this subpackage.

It also avoids importing an absolute ton of code the instant one runs
`from . import compilers`
2022-09-19 15:19:00 -04:00
Yang Bo 83d18d137d Use os.path.realpath for default include paths testing in -isystem.
This ensures correct removal of default include paths in -isystem
options when symbolic links are involved.

A test for this is also added.
2022-09-13 02:24:38 -04:00
Eli Schwartz 2a76afcef1 compilers: drop some useless info from CompileResult
text_mode was never set, nor used, and pid was set but never used.
2022-09-09 14:12:14 -07:00
Eli Schwartz e3a4dc7218 compilers: fix regression in logging cached compile commands
In commit d326c87fe2 we added a special
holder object for cached compilation results, with some broken
attributes:

- "command", that was never set, but used to print the log

- "args", that was set to some, but not all, of the information a fresh
  compilation would log, but never used

Remove the useless args attribute, call it command, and use it properly.
2022-09-09 14:12:14 -07:00
Eli Schwartz 167356aeab
compilers: correct the MSVC version comparison for turning on __cplusplus
We compared a Visual Studio (the IDE) version, but we wanted a MSVC (the
compiler) version. This caused the option to be passed for a few too
many versions of MSVC, and emit a "D9002 : ignoring unknown option" on
those systems.

Compare the correct version using the version mapping from
https://walbourn.github.io/vs-2017-15-7-update/

Fixes #10787

Co-authored-by: CorrodedCoder <38778644+CorrodedCoder@users.noreply.github.com>
2022-09-07 17:27:55 -04:00
Eli Schwartz 388cb0f805 env2mfile: reuse logical lists of interesting facts from meson itself
Meson internally knows about many languages and tools, and *FLAGS
variables, and which languages to use them for. Instead of duplicating
this logic, import it from mesonbuild.*

This logic was originally standalone, but now that it is merged into the
Meson tree we can have a single source of truth.
2022-09-01 01:05:48 +03:00
Eli Schwartz f4cc60bf20 flake8: move typing-only imports into T.TYPE_CHECKING 2022-08-29 23:32:43 +03:00
Alf Henrik Sauge 06bf9a5cda Fix purely white space issues reported by flake8 2022-08-26 17:12:40 -04:00
Eli Schwartz 27748f9cd1
fix linker regression for compilers that don't accept LDFLAGS directly
e.g. ldc -- the compiler needs to process args before consuming them.

Fixes #10693
2022-08-24 23:49:14 -04:00
Dylan Baker d6b9d431ec linkers: Add a representation for the Apple AR Linker
Which is old and annoying and doesn't expose global symbols by default,
so we need a work around.

see: https://github.com/mesonbuild/meson/pull/10587
see: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
2022-07-25 15:36:59 -07:00
Justin Blanchard ec388fe7c2 ar linker: detect the "osx ld" case (where generating thin archives won't work) based on host OS, not build OS. 2022-07-21 22:00:00 -07:00
Eli Schwartz 0eed99318b
compilers: add logging to obscure compiler defines scraper
If this command fails, for example when CXX is something not generic
enough to be a valid universal compiler command (clang -std=c++11
perhaps), we end up with two problems:

- it's impossible to figure out what Meson ran to get that error

- the error report isn't clear on what is stdout and what is stderr, or
  even that that is what the message is about.

  ```
  meson.build:1:0: ERROR: Unable to get clang pre-processor defines:
  error: invalid argument '-std=c++11' not allowed with 'C'
  ```

  What's C doing there and why is Meson talking about it? Answer: that's
  compiler stdout. Say so.
2022-07-21 16:45:01 -04:00
Eli Schwartz 1f527550c6
compilers: include compiler detection output in the debug logs
We do something similar when running get_compiler() method checks from
the DSL. This ensures that if errors happen, the log file we tell people
to check actually works.
2022-07-21 16:45:01 -04:00
Eli Schwartz 93ba937186
compilers: better reporting of command failures
Use join_args to ensure that commands are rendered correctly.
2022-07-21 16:45:00 -04:00
Eli Schwartz 46793145ba
Revert /utf-8 changes in the visualstudio mixin to the 0.62.0 state
Specifically, this is a combination of the following:

- Revert "visualstudio.py: Apply /utf-8 only on clang or VS2015+"

  This reverts commit 6e7c3efa79.

- Revert "Visual Studio: Only use /utf-8 on VS2015 or later or clang-cl"

  This reverts commit 8ed151bbd7.

The changes were broken and untested, although this is because of a lack
of general CI testing for all languages on Windows. At least, this broke
the use of ifort, and possibly more.

The changes are fundamentally a bit "exciting", as they step out of the
hierarchy of compiler definitions and apply arguments almost willy-nilly.

And apparently it's leaky all over the place. I don't understand all of
what is going on with it, but it plainly failed to achieve its desired
goal and needs to be rolled back ASAP.
2022-07-11 17:58:02 -04:00
Tristan Partin af846a109f Detect Cython and Vala compilers on the build machine always
Transpilers need to run on the build machine in order to generate their
output, which can then be taken by a cross-compiler to create the final
output.
2022-07-06 12:04:59 -07:00
Eli Schwartz 0703ee0aef
move various unused typing-only imports into type-checking blocks 2022-07-03 14:11:31 -04:00
Eli Schwartz 46148f923b
fix totally invalid import of an import
MachineChoice is a mesonlib object, not a compilers object, so it makes
no sense to import it from the latter simply because the latter imports
it too. This results in brittle module dependencies and everything
breaking when a refactor removes it from the latter.

... also it is a typing-only import so while we are fixing it to import
from the right place, we can also put it in a type-checking block.
2022-07-03 14:11:31 -04:00
Chun-wei Fan 6e7c3efa79 visualstudio.py: Apply /utf-8 only on clang or VS2015+
In PR 10263, we didn't account for that we may have initialize the Visual
Studio-like compiler two times, once for a C compiler and once for the
C++ compiler, so we end up with Meson breaking on Visual Studio 2013
or earlier, such as when building GLib.

Fix this by setting up the always_args member of
the VisualStudioLikeCompiler instance during __init__() as needed, so that
we avoid falling into modifying shared objects.
2022-06-21 21:08:06 +03:00
Stepan Nassyr b0158955b7 ACfL version detection with regex 2022-06-10 08:24:52 -07:00
Stepan Nassyr d045c9f79d Allow for 3-component ACfL versions 2022-06-10 08:24:52 -07:00
Eli Schwartz a49cd00d64 treewide: various cleanups to move imports for mypy into typechecking blocks
Along the way, add __future__ annotations where lacking.
2022-06-10 09:15:48 -04:00
Marco Trevisan (Treviño) 29c26d5b26 compilers: Add support for stand-alone leak sanitizer
Leak sanitizer can be enabled without the whole AddressSanitizer, this
can be done by passing -fsanitize=leak as documented at [1].

Meson doesn't support this, so add support for it.

[1] https://clang.llvm.org/docs/LeakSanitizer.html
2022-06-06 09:40:14 -07:00
Dylan Baker d553748b60 compiler: Add missing needs_static_linker to base Compiler class 2022-06-01 22:49:10 -04:00
Andreas Obergschwandtner bfc4e958b4 Fix optimization level 's' for the TI compiler 2022-05-25 07:12:02 -07:00
Eli Schwartz 1c52ac4e15
move various imports into TYPE_CHECKING blocks for neatness 2022-05-23 16:44:08 -04:00
Tristan Partin 5d0538d235 Fix invalid Python overrides
- mismatched method type
- mismatched parameter names
2022-05-19 15:05:53 -04:00
Tristan Partin 8d918e0147 Add cc.has_function_attribute('sentinel') 2022-05-19 15:05:53 -04:00
Tristan Partin 5d438b6aed Add cc.has_function_attribute('section') 2022-05-19 15:05:53 -04:00
Eli Schwartz 7c4087ace5 compilers/gnu: demote visibilty inlineshidden to hidden for unsupported 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.
2022-05-09 10:49:04 -04:00
Eli Schwartz 04c728a126 compilers/c++: Add MSVC option to make the __cplusplus define accurate
Otherwise it always returns the value for c++98, starting with MSVC 2017
15.7 or later. Earlier versions are not affected by this mis-feature.

See: https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-160

This was originally applied as 0b97d58548
but later reverted because it made the CI red. Try it again, now.

Original-patch-by: Dylan Baker <dylan@pnwbakers.com>
Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
2022-05-08 14:40:54 -04:00
Khairul Azhar Kasmiran 6b7bc608b7 compiler.has_argument: Add `-Werror=unknown-warning-option` to clang-cl cmd line 2022-05-06 23:09:52 +03:00
Remi Thebault f24ad87e05 implement and test a few compiler checks for D
- run
 - sizeof
 - alignment
 - has_header
2022-04-30 10:07:38 -04:00
Fini Jastrow c16fdaeeca linkers: Add support for mold linker
[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>
2022-04-30 10:06:22 -04:00
Chun-wei Fan 8ed151bbd7 Visual Studio: Only use /utf-8 on VS2015 or later or clang-cl
The compiler flag only exists on Visual Studio 2015 or later, or clang-cl,
and using this always can interfere with compiler feature detection when
this flag is not supported.

So, remove '/utf-8' from always_args if we are on Visual Studio 2013 or
earlier.
2022-04-25 20:29:16 +03:00
Eli Schwartz a0e7f93414 compilers: fix broken CompCert support for release flags
This has been broken ever since the original implementation. Due to a
typo, the optimization flag used a zero instead of an uppercase "o",
which the compiler then breaks on during argument parsing because it is
an invalid argument.

Fixes #10267
2022-04-13 21:11:09 +03:00
Jussi Pakkanen efc7604ca2
Merge pull request #9989 from ePirat/epirat-fix-uscore-prefix-detection
Fix underscore detection
2022-03-31 16:26:22 +03:00
Marvin Scholz 89620dc8e7 clike: print stderr instead of stdout for debugging
When something goes wrong with running the compiler in
_symbols_have_underscore_prefix_searchbin, print stderr instead,
as it actually contains helpful output while stdout is usually empty
in this case.
2022-03-31 10:55:55 +02:00
Marvin Scholz 1b03441bc4 visualstudio: do not query underscore define with MSVC
MSVC does not has the builtin define to check for the symbol
prefix, so do not try to query it at all, to save some time.
2022-03-31 10:55:55 +02:00
Marvin Scholz f02ffc007c clike: add more reliable ways to check underscore prefix
Fix #5482
2022-03-31 10:55:55 +02:00
Marvin Scholz 4b97c60650 compilers/gnu: use Popen_safe to prevent resource leaks
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
2022-03-30 16:04:23 -04:00
Xavier Claessens ebbe4425e7 Debian renamed cython to cython3, support both 2022-03-24 10:16: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
Dylan Baker 655746e8b4 compilers: fix mypy warning in Rust detection 2022-03-22 15:15:29 +02:00
Paolo Bonzini ff844f3a1f fix detection of language standard library paths
The code in the C++ and Fortran compilers' language_stdlib_only_link_flags
method is broken and cannot possibly have ever worked.  Instead of
splitting by line, it splits by whitespace and therefore, instead of
the last line of the compiler output:

 programs: =/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
libraries: =/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0

it is only the last field that has its first 11 characters removed.
Instead of reinventing the wheel with a new and brittle pattern,
reuse get_compiler_dirs.

Fixes: 64c267c49 ("compilers: Add default search path stdlib_only_link_flags", 2021-09-25)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-03-16 09:24:57 -07:00
Eli Schwartz bfdbf7bf65 remove unused type ignore that mypy 0.940 no longer needs
And now that it doesn't need it, it errors out when you use it.
2022-03-12 00:31:12 +02:00
Eli Schwartz a009eacc65
treewide: string-quote the first argument to T.cast
Using future annotations, type annotations become strings at runtime and
don't impact performance. This is not possible to do with T.cast though,
because it is a function argument instead of an annotation.

Quote the type argument everywhere in order to have the same effect as
future annotations. This also allows linters to better detect in some
cases that a given import is typing-only.
2022-03-07 19:01:04 -05:00
Dylan Baker f9bfeb2add compilers/gnu: set level 0 optimization to '-O0'
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.
2022-03-02 19:59:45 +02:00
Eli Schwartz 530338782c compilers/d: fix mangling of rpath-link in DMD-like compilers
We didn't consider that it has arguments following it, so the resulting
compiler command line ended up with stuff like:

-L=-rpath-link -L=-L=/path/to/directory -L=more-args

and the directory for rpath-link got eaten up as a regular -L path to
the compiler rather than being passed as -Xlinker to the linker.

Then the -rpath-link would consume the next -Xlinker argument, end up
with the wrong rpath-link (may or may not cause link errors) and then
disappear arguments we need.

As an example failure mode, if the next argument is -soname this treats
the soname text as an input file, which probably does not exist if it
was generated in a subdirectory, and also because it can never be
successfully built in the first place -- though if it did, it would link
to itself which is very wrong.
2022-03-01 18:34:58 -08:00
Eli Schwartz 9daaece785
flake8: fix various whitespace errors with badly aligned code 2022-02-16 23:00:31 -05:00
Eli Schwartz 60c893f1c2
flake8: remove some redundant separators 2022-02-16 18:19:13 -05:00
Eli Schwartz 07d9c72e17
flake8: fix wrong numbers of blank line separators 2022-02-16 18:19:13 -05:00
Eli Schwartz baecebda0e
flake8: fix typoed whitespace surrounding tokens 2022-02-16 18:19:13 -05:00
Tobias Pankrath 91ca3e2d58 dlang: fix #9250 invalid include flag for root directory 2022-02-06 14:16:51 -08:00
William Toohey b4d9b2551c Genericise TI compiler and add MSP430 support 2022-02-02 16:45:05 +02:00
Eli Schwartz ff7a30c0ea mark regex string as raw string to fix invalid escapes 2022-01-27 10:48:01 -08:00