Some warnings are out of the user's control, such as the RCC QT bug,
or the GNU windres bug, or our informational warning about
auto-disabling of options when -Db_bitcode is enabled.
Such warnings should not be fatal when --fatal-meson-warnings is
passed because there's no action that the user can take to fix it. The
only purpose it serves is to prevent people who use those features
from using --fatal-meson-warnings.
D lang compilers have an option -release (or similar) which turns off
asserts, contracts, and other runtime type checking. This patch wires
that up to the b_ndebug flag.
Fixes#7082
Currently, colourize_console is a constant, set at process
initialization.
To allow the actual stdout to be easily compared with the expected when
running tests, we want to allow colourization to be on for the test
driver, but not for the in-process configure done by run_configure,
which has stdout redirected from a tty to a pipe.
v2:
Cache _colorize_console per file object
v3:
Reset cache on setup_console()
getattr() requires a default (return if missing) value or it raises an
AttributeError. In a few cases I changed hasattr to getattr and didn't
set a default value, so those cases could except. This corrects that.
There were two things mypy was warning about:
1) it doesn't understand hasattr()
2) It was possible for mlog.{error,warning,deprecation} to get passed
multiple values for the once keyword argument.
Warnings have a location node object (with subdir and lineno
attributes), which is passed as a location: kwarg to mlog.warning() and
formatted in _log_error().
Re-purpose the subdir attribute (path relative to the source root dir,
with an implied filename of 'meson.build'), which is stored into the
node by parser(), to contain a pathname.
(Properly I should rename 'subdir' -> 'file' everywhere, but that's a
lot of churn just to see if this works)
Notes:
The warning location node may also have a colno attribute, which is
currently ignored by _log_error().
We can't currently issue warnings with locations in meson_options.txt
because the filename isn't part of the location (as it's assumed to be
'meson.build).
This adds a warnings counter for subprojects that passed. This is to
encourage developpers to check warnings in the logs and hopefully fix
them. Otherwise they could be hidden in hundreds lines of logs.
This also print the error message for subprojects that did not pass. The
error message is often enough to fix the issue (e.g. missing
dependency) and it's easier than searching in the logs why a subproject
failed.
It is a common idiom to look for a function or a specific type or
a header in various locations/libraries, and it can be confusing to
see the (seemingly) identical compiler check being done multiple
times.
Now we print the dependencies being used when a compiler check is run
Before:
Checking for function "fbGetDisplay": NO
Checking for type "GLeglImageOES": YES
Checking for function "asinh": YES
After:
Checking for function "fbGetDisplay" with dependency egl: NO
Checking for type "GLeglImageOES" with dependencies glesv2, gl: YES
Checking for function "asinh" with dependency -lm: YES
This makes any warning message printed by meson raise an exception,
intended to be used by CI and developpers to easily catch deprecation
warnings and other potential issues.
Instead of just printing the message in the exception, if it's
a MesonException, also print the file and the line number. If it's an
unknown exception, print the entire traceback so that we can pin-point
what the Meson bug causing it is.
This change still relies on the older 'ANSICON' environment check as a
fallback, in the event we're on "not Windows 10". (Calling
`SetConsoleMode` with unsupported values results in a 0 being returned)
As written in PR #2856, this code isn't quite right.
An ArgumentNode object can evaluate as False (if it's arguments attribute is
an empty sequence).
If that happens, we then try to hand the location kwarg down to print(),
rather than removing it, which causes an invalid keyword argument exception.
This failure can be seen e.g. when generating for gnome-twitch (See [1])
[1] https://travis-ci.org/jon-turney/meson-corpus-test/jobs/343017109
Examples:
meson.build:2:0: ERROR: Dependency is both required and not-found
meson.build:4: WARNING: Keyword argument "link_with" defined multiple times.
These are already matched by the default compilation-error-regexp-alist in
emacs.
Also:
Don't start 'red' markup until after the \n before an error
Unabsorb full-stop at end of warning with location from mlog.warning()
Update warning_location test
configure a detection method, for those types of dependencies that have
more than one means of detection.
The default detection methods are unchanged if 'method' is not
specified, and all dependencies support the method 'auto', which is the
same as not specifying a method.
The dependencies which do support multiple detection methods
additionally support other values, depending on the dependency.