aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/mixins
AgeCommit message (Collapse)AuthorFilesLines
2021-09-14apply flake8 fixes for unused imports and missing importsEli Schwartz1-6/+1
2021-09-04Support for appleframeworks with GCC and IntelEvan Miller1-3/+1
Fixes #8792 Fixes #8733
2021-09-01Clang should error for all implicit function checks (#9165)Dylan Baker1-1/+5
* compilers: improve docstring to `get_compiler_check_args()` There was an incomplete list, which wasn't useful as it now takes an enum anyway. Also add a new entry to the list of reasons to use this function. * clang: Add -Werror=implicit-function-declarations to check_args Unlike GCC, clang warns but doesn't error when an implicit function declaration happens. This means in checks like `compiler.has_header_symbol('string.h', 'strlcat')` (on Linux, at least) that GCC will fail, as there is no such function; clang will emit a warning, but since it exists with a 0 status Meson interprets that as success. To fix this, add `-Werror=implicit-function-declarations` to clang's check arguments. There seems to be something specific about functions that _may_ exist in a header on a given system, as `cc.has_header_symbol('string.h', 'foobar')` will return false with clang, but `strlcat` will return true, even though it's not defined. It is however, defined in some OSes, like Solaris and the BSDs. Fixes #9140
2021-09-01msvc: Assume UTF8 source by defaultXavier Claessens1-2/+11
Currently every project that uses UTF8 for its source files must add '/utf-8' argument otherwise they don't work non-English locale MSVC. Since meson.build itself is assumed to be UTF8 by default, seems better to assume it for source files by default too. For example: - https://gitlab.freedesktop.org/gstreamer/gst-build/-/blob/master/meson.build#L62 - https://gitlab.gnome.org/GNOME/glib/-/blob/main/meson.build#L29
2021-08-31pylint: turn on superflous-parensDylan Baker2-3/+3
We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
2021-08-16compilers: Fix extra_args parameterDylan Baker1-13/+14
which can also be a callable taking a CompileChekcMode as an argumetn and returning a list of strings.
2021-08-16compilers: Fix annotations for run and cached_compileDylan Baker1-1/+1
Which absolutely should accept `str | File`, but the annotations claim that only strings are accepted.
2021-08-08Add support for finding Javascript source libraries with Emscripten.Jussi Pakkanen1-0/+34
2021-07-25C2000 compiler also accepts *.cla filesmiebka1-2/+4
2021-07-14linkers: remove is_shared_module argument to get_soname_argsPaolo Bonzini1-2/+1
The argument is now unused, drop it.
2021-07-13Clang: Apply `-O0`Pamplemousse1-1/+1
Fix #8986
2021-07-06Fix unsupported linker error messageAndrea Pappacoda1-1/+1
An `f` was dropped in bd6f46e723813dfadaba1f7c87d3b0b751d05219
2021-07-05condense linesEli Schwartz2-8/+4
2021-07-05simplify mesonlib imports for the sake of line lengthsEli Schwartz1-7/+7
2021-07-05more f-strings too complex to be caught by pyupgradeEli Schwartz2-3/+3
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger1-1/+1
2021-06-25Split compiler detection from EnvironmentDaniel Mensinger1-4/+1
This moves all the compiler detection logic into the new compilers.detect module. This dramatically reduces the size and complexity of Environment.
2021-06-09compilers: Fix missing functions in Compiler base classDaniel Mensinger1-3/+0
2021-06-07upgrade percent formatted strings pyupgrade did not catchEli Schwartz1-13/+11
2021-06-07condense linesEli Schwartz1-8/+4
2021-06-07more f-strings everywhereEli Schwartz1-73/+57
pyupgrade didn't catch many .format() methods which were too complex (e.g. multiline or applied to templates rather than string literals)
2021-06-02use an immutable list for an lru_cached functionsDylan Baker2-4/+6
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 ```
2021-05-15Visual Studio Address Sanitizer updatesPeter Harris1-1/+1
* Allow address sanitizer for Visual Studio 2019 version 16.9 Address Sanitizer was first supported with the current syntax in Visual Studio 16.9.0 (cl version 19.28.29910). * VS: Convert /fsanitize=address to project file setting
2021-05-10deactivate intrinsic functions if no optimizations are requestedAlexander Neumann1-1/+1
2021-05-02Use sanity_check_impl for objc/objppRalf Gommers1-1/+1
This gets rid of compile warnings, and simplifies the code. Note that `work_dir` in sanity_check_impl was incorrect, it was used both to prepend to file names and as cwd=work_dir argument to Popen. This is fixed here. Closes gh-7344
2021-03-24compilers: clang-cl: Also accept .s files (#8520)D Scott Phillips1-0/+3
* compilers: clang-cl: Also accept .s files clang-cl has support for gas-compatible assembly files. * Add clang-cl to '128 generated assembly' test
2021-03-23Remove -pipe from default list of args. Closes #8508.Jussi Pakkanen1-1/+1
2021-03-19split program related classes and functions out of dependenciesDylan Baker1-1/+2
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-09Add address sanitizer support for Visual Studio.Jussi Pakkanen1-0/+9
2021-03-08Add /Od flag to msvc optimization 0 argsVili Väinölä1-1/+1
Without specifying optimization the used optimization depends on vs runtime-library. With mdd it is /Od but with md it is /O2.
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz8-18/+18
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04various python neatness cleanupsEli Schwartz1-3/+3
All changes were created by running "pyupgrade --py3-only --keep-percent-format" and committing the results. I have not touched string formatting for now. - use set literals - simplify .format() parameter naming - remove __future__ - remove default "r" mode for open() - use OSError rather than compatibility aliases - remove stray parentheses in function(generator) scopes
2021-02-18compilers: clang: Drop -Xclang before -fcolor-diagnostics flagKrzysztof Małysa1-3/+3
Using -Xclang -fcolor-diagnostics provides no advantage to using just -fcolor-diagnostics option and sometimes causes problems: * uncolored diagnostics on Arch Linux: https://bugs.archlinux.org/task/69662 * simple problem with removing flag -fcolor-diagnostics: https://github.com/clangd/clangd/issues/279
2021-02-17compilers: Only insert -flto-jobs in clang's link argumentsDylan Baker2-1/+5
Clang has a hand `-Wunused-command-line-argument` switch, which when turned to an error, gets very grump about `-flto-jobs=0` being set in the compiler arguments (although `-flto=` belongs there). We'll refactor a bit to put that only in the link arguments. GCC doesn't have this probably because, a) it doesn't have an equivalent warning, and b) it uses `-flto=<$numthreads. Fixes: #8347
2021-02-02Add support for LLVM's thinLTODylan Baker2-6/+15
This uses a separate option, b_lto_mode. It works in conjunction with b_lto_threads. Fixes #7493
2021-02-02compilers: Add support for using multiple threads with ltoDylan Baker2-3/+24
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
2021-01-20MSVC and Clang-Cl Compiler Argument CleanupMarios Staikopoulos1-27/+6
This commit performs some cleanup for the msvc and clang-cl arguments. * "Disable Debug" (`/Od`) is no longer manually specified for optimization levels {`0`,`g`} (it is already the default for MSVC). * "Run Time Checking" (`/RTC1`) removed from `debug` buildtype by default * Clang-CL `debug` buildtype arguments now match MSVC arguments * There is now no difference between `buildtype` flags and `debug` + `optimization` flags
2021-01-20Avoid accidental use of STANDALONE_WASM mode on compiler testsBrion Vibber1-1/+1
Compiler tests, such as checking for atomics support, could fail when compiling to WebAssembly multithreaded targets because the compiler tests got compiled to 'output.wasm'. Using the '.wasm' suffix in recent versions of emscripten engages STANDALONE_WASM mode, which disables features that require a JS runtime like shared memory. This created false negatives on support of those features when building a library to be linked into an executable that is not in STANDALONE_WASM mode. Changing these to 'output.o' will continue to produce WebAssembly object files, but they will no longer be configured for standalone runtime mode.
2021-01-17Removal of /ZI on MSVC DebugMarios Staikopoulos1-2/+2
The /ZI flag adds in "Edit and Continue" debug information, which will cause massive slowdown. It is not a flag that we should be adding by default to debug builds. /Zi will still be added.
2021-01-13Fix misspellsAntonin Décimo1-2/+2
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-04Use a single coredata dictionary for optionsDylan Baker2-3/+3
This patches takes the options work to it's logical conclusion: A single flat dictionary of OptionKey: UserOptions. This allows us to simplify a large number of cases, as we don't need to check if an option is in this dict or that one (or any of 5 or 6, actually).
2021-01-04use OptionKey for builtin and base optionsDylan Baker9-22/+31
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.
2021-01-04move OptionKey to mesonlibDylan Baker1-2/+3
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-04use OptionKey for compiler_optionsDylan Baker2-6/+7
2020-12-14Propagate Windows target checks upLaurin-Luis Lehning2-5/+3
2020-12-14Give get_gui_app_args access to the EnvironmentLaurin-Luis Lehning1-1/+1
2020-12-14Slight consistency changes to get_gui_app_argsLaurin-Luis Lehning1-8/+0
2020-12-14Make win_subsystem a linker propertyLaurin-Luis Lehning3-23/+0
2020-12-13Add support for driving lld-link indirectly through clang on WindowsLaurin-Luis Lehning1-1/+7
2020-12-03Add prelinking support for static libraries.Jussi Pakkanen1-0/+3