Commit Graph

38 Commits

Author SHA1 Message Date
Josh Soref cf9fd56bc9 fix various spelling issues
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-11 19:21:05 -04:00
Eli Schwartz 83b4f14fce emit FeatureNew warning for compiler.preprocess used multiple times
In commit c2a55bfe43 multiple bugs were
fixed, but a FeatureNew was only added for the one that was mentioned in
the commit message.

Make sure to warn users about the reliability of the one that wasn't
mentioned, too.
2023-03-09 22:04:38 -05:00
Eli Schwartz d897c300f1 compiler.preprocess should only update the private name per directory
We add a unique ID to each rule we create, to work around the use of
an entire build target with private directory named "preprocess" per use
of the preprocess() method.

But this ID doesn't need to increment every time it is used anywhere --
only when it is used in the same subdir as a previous time. That is the
only case where it could conflict.

By making the increment counter per-subdir, we can avoid potential
frivolous rebuilds when a new preprocess() is added in a different
directory, the build is reconfigured, and all uses in the entire project
tree suddenly get new output paths even if they haven't changed.
2023-03-09 22:04:38 -05:00
Dylan Baker 162ac25beb build: fully type CompileTarget
Which is pretty trivial
2023-03-09 15:03:03 -05:00
Andres Freund 808d5934dd Use caching in Compiler.sizeof() and Compiler.alignment() 2023-02-27 20:09:32 -05:00
Andres Freund ba72fc7f40 interpreter: bolden result of compiler.alignment(), compiler.sizeof()
This is more in line with other tests. It also looks better when introducing
caching, as a subsequent commit will.
2023-02-27 20:09:32 -05:00
Xavier Claessens d21b64487e preprocess: Add dependencies kwarg 2023-02-15 15:12:34 -05:00
Xavier Claessens c2a55bfe43 preprocess: Allow custom_tgt, custom_idx and generated_list
It was documented to be supported but only File and str were actually
working.
2023-02-15 15:12:34 -05:00
Eli Schwartz 680b5ff819
treewide: add future annotations import 2023-02-01 17:01:30 -05:00
Marvin Scholz 85a58f12f0 interpreter: compiler: Allow array for the prefix kwarg 2022-12-06 10:59:00 -05:00
Xavier Claessens 65590e6e4b Add cc.preprocess() method for c-like compilers
This introduce a new type of BuildTarget: CompileTarget. From ninja
backend POV it is the same thing as any other build target, except that
it skips the final link step. It could be used in the future for
transpilers too.
2022-10-23 12:21:46 +02:00
Nirbheek Chauhan 9b33885c2d interpreter: Fix msg when none of the dependencies have names
This case is identical to the case when there's no dependencies
specified, so it should behave the same way.
2022-10-12 08:13:02 -04:00
Nirbheek Chauhan c50d837a0c interpreter: Don't say we're using -lfoo args when we're not
cc.compiles(), and other compiler checks that use cc.compiles() under
the hood, do not use link args at all when doing the compile check, so
messages like this:

```
Checking if "have zlib" with dependency -lz compiles: YES
```

is very misleading. The compiler check command-line for that is:

```
cc [...]/testfile.c -o [...]/output.obj -c -D_FILE_OFFSET_BITS=64 -O0
```

Note the lack of linker args.
2022-10-12 08:13:02 -04:00
Peter Eisentraut 8e4fecdd0f Tweak "header has symbol" message
Change message

    Header <foo.h> has symbol "BAR"

to

    Header "foo.h" has symbol "BAR"

with the first part also now in bold.  This is more consistent with
other messages like

    Has header "foo.h"

and

    Checking whether type "foo" has member "bar"
2022-05-24 20:18:19 +03:00
Dudemanguy 557680f7d6 add prefer_static built-in option
By default, meson will try to look for shared libraries first before
static ones. In the meson.build itself, one can use the static keyword
to control if a static library will be tried first but there's no simple
way for an end user performing a build to switch back and forth at will.
Let's cover this usecase by adding an option that allows a user to
specify if they want dependency lookups to try static or shared
libraries first. The writer of the meson.build can manually specify the
static keyword where appropriate which will override the value of this
option.
2022-05-03 23:03:56 -04:00
Paolo Bonzini 06b76f7c9d dependencies: extract code to get all leaf dependencies
Extract to a separate function the code that resolves dependencies
for compiler methods.  We will reuse it for add_project_dependencies().

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-05-03 02:00:29 -04:00
Eli Schwartz 3ca61a6aa7
fix UI regression in compiler.compiles logging
In commit b30dddd4e5, various refactorings
were done, during which a kwarg got accidentally dropped from the
function that determined part of the log message. As a result, a ':'
suddenly appeared in the log message where none should be.

Example expected output:

Checking if "-Werror=shadow with local shadowing" compiles: YES

What actually happened:

Checking if "-Werror=shadow with local shadowing" : compiles: YES

Fixes #9974
2022-02-09 19:42:16 -05:00
Eli Schwartz c6862744cb
add FeatureNew check for compiler.* methods with dependency on internal dep
In commit 0deab2ee9e we added the ability
to pass a declare_dependency() to any compiler method that accepts
"dependencies", but we never marked the version it is available since.

Fixes #9957
2022-02-06 23:19:03 -05:00
Eli Schwartz 3990dc6d64 flake8: fix indentation style 2022-01-27 10:48:01 -08:00
Eli Schwartz bea735dd76
make sure files arguments to compiler.compiles and friends, performs rebuild
If the compiler check is updated as a string in meson.build, we force
rebuild, which is a good thing since the outcome of that check changes
the configuration context and can enable or disable parts of the build.

If the compiler check came from a files() object then we didn't add a
regen rule on those files.

Fixes #1656
2021-11-28 11:52:36 -05:00
Eli Schwartz 038b31e72b
various manual conversion of percent-formatted strings to f-strings 2021-11-01 20:26:18 -04:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Eli Schwartz d06cc042eb
f-strings 2021-10-04 16:29:32 -04:00
Eli Schwartz e8a85fa8a2
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only"

and committing the results. Although this has been performed in the
past, newer versions of pyupgrade can automatically catch more
opportunities, notably list comprehensions can use generators instead,
in the following cases:
- unpacking into function arguments as function(*generator)
- unpacking into assignments of the form x, y = generator
- as the argument to some builtin functions such as min/max/sorted

Also catch a few creeping cases of new code added using older styles.
2021-10-04 16:29:30 -04:00
Daniel Mensinger c10e228371
docs: Fixes found during the YAML conversion process 2021-10-03 11:51:37 +02:00
Paolo Bonzini 8596b3bcd1 interpreter: detect and pass compiler to be used for linker tests
Allow using the links method to test that the C++ driver (e.g. g++) can be used to
link C objects.  One usecase is that the C compiler's libsanitizer might not be
compatible with the one included by the C++ driver.

This is theoretically backwards-incompatible, but it should be treated as a
bugfix in my opinion. There is no way in Meson to compile a .c file with the
C++ driver as part of a build target, therefore there would be no reason to
do something like meson.get_compiler(meson.get_compiler('cpp').links(files('main.c')).

Fixes: #7703
2021-09-07 14:18:33 +02:00
Dylan Baker 11fbaf29d8 interpreter: fix cases of `KwargInfo(..., T, default=None)`
The correct way to mark these is `KwargInfo(..., (T, type(None)))`.
There's also a few cases of `(T, None)` which is invalid, as `None`
isn't a type
2021-08-27 14:54:29 -07:00
Dylan Baker aa895b383c interpreter: Add a helper for checking constrained inputs
This is quite valuable for enum-like inputs, where only a certain set
of values is allowed.
2021-08-27 14:49:23 -07:00
Dylan Baker 272674e792 interpreter/compiler: make helper methods protected 2021-08-16 16:21:51 -07:00
Dylan Baker b30dddd4e5 interpreter/compiler: Add type checking for the Compiler object
This adds a full set of `typed_pos_args` and `typed_kwarg` decorations,
as well as fixing all of the typing errors reported by mypy.
2021-08-16 16:21:51 -07:00
Dylan Baker bcb5400e34 interpreter/compiler: Add type annotations to TryRunResultHolder 2021-08-16 16:21:51 -07:00
Dylan Baker 7dda90f1bf interpreter/compiler: remove unittest_args method
It's not documented, and it's been marked deprecated for who knows how
long.
2021-08-16 16:21:51 -07:00
Dylan Baker 32d3b5c9e2 interpreter/compiler: Replace permittedKwargs({}) with noKwargs
The former isn't really correct, as it wants a set and is getting a
dict, the other is also conceptually clearer I think.
2021-08-16 16:21:51 -07:00
Laurin-Luis Lehning 281f5abee3 interpreter: Replace manual kwarg validation in compiler.get_supported_arguments with @typed_kwargs 2021-06-22 07:59:08 +02:00
Laurin-Luis Lehning d5ed8f61a5 interpreter: Move argument checks from add_*_arguments to compiler.get_supported_arguments 2021-06-21 09:15:13 +02:00
Daniel Mensinger 7c757dff71 holders: Fix the remaining code to respect the holder changes 2021-06-18 23:48:33 +02:00
Daniel Mensinger 202e345dfb interpreter: Refactor interpreter.compiler to use ObjectHolder 2021-06-18 23:48:33 +02:00
Xavier Claessens 558a7bc6ff interpreter: Move to its own folder and split it 2021-04-01 14:26:33 -04:00