aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
AgeCommit message (Collapse)AuthorFilesLines
2021-05-19compilers: Add `get_debug_args` to base CompilerDylan Baker1-0/+4
This was missed, there should be an implementation in the base Compiler class, if for nothing else to help mypy
2021-05-19rust: override get_linker_always_argsDylan Baker1-0/+6
instead of opencoding what should be there in the rust compile rule
2021-05-19.C files are now treated as C++ codeVolker-Weissmann1-2/+4
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-15Add gnuXX stds to Objective C.Jussi Pakkanen1-1/+1
2021-05-11Make objective C use C standard version. Closes #5495.Jussi Pakkanen2-2/+39
2021-05-10deactivate intrinsic functions if no optimizations are requestedAlexander Neumann1-1/+1
2021-05-02Clean up unused importsRalf Gommers2-4/+2
2021-05-02Use sanity_check_impl for objc/objppRalf Gommers3-48/+5
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-04-01environment: get environment variables for both host and build machinesDylan Baker1-8/+15
Fixes #8605
2021-03-30Split environment variable and command line cflagsDylan Baker1-4/+7
They are supposed to have different behavior. The environment variables apply to both the compiler and linker when the compiler acts as a linker, but the command line ones do not. Fixes #8345
2021-03-28Strip host-compiler -std flag from NVCC line.cudafix0572Olexa Bilaniuk1-1/+12
Closes #8523.
2021-03-28Retract "DQSQ" merging in NVCC arguments handling.Olexa Bilaniuk1-15/+0
No coverage, no tests, unreadable, unused, likely premature optimization.
2021-03-28Canonicalize and merge consecutive -Xcompiler flags together.Olexa Bilaniuk1-1/+47
Makes command-line more readable.
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 Pakkanen2-7/+1
2021-03-19split program related classes and functions out of dependenciesDylan Baker9-9/+14
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-17Fix D lib search path translationRemi Thebault1-15/+49
This requires quite a complex and messy logic. As @dcbaker suggested in #8491, this could be replaced by an abstraction over linker flags instead of having GNU flags translated.
2021-03-14ninjabackend: Use rsp_file_syntax methodDylan Baker1-3/+4
This also makes us of the new enum value in the backend, for better type saftey.
2021-03-14compilers/linkers: Add a methhod for getting the rspfile syntaxDylan Baker3-3/+27
2021-03-09Add address sanitizer support for Visual Studio.Jussi Pakkanen2-1/+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-04compilers: Use EnvironmentException not EnvironmentError/OSErrorDylan Baker1-8/+8
The latter is a python built-in exception, the former is a meson exception.
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz15-62/+62
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04various python neatness cleanupsEli Schwartz4-26/+26
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-03-04raw string literals are next to godlinessEli Schwartz1-2/+2
Invalid escape sequences are deprecated and will be removed from a future version of python. Use r"" to define them so they remain readable.
2021-03-02fix missing versions with generated sourceRemi Thebault1-0/+6
2021-03-01D add build dir to -J switchRemi Thebault1-2/+6
2021-02-22[CUDA] Bugfix: Forward sanitizer_*_args() methods to host compiler.Olexa Bilaniuk1-0/+6
Enables -Db_sanitize=undefined and company. Also serves as a testcase for NVCC comma-shielding: Because the test- case declares `b_sanitize=address,undefined`, the host GCC compiler needs `-fsanitize=address,undefined`, but this stands a danger of being split by NVCC when wrapped with `-Xcompiler=args,args`. Special, already-existing comma-shielding codepaths activate to prevent this splitting. Closes #8394.
2021-02-19Ensure that $lang_args and $lang_link_args are properly parsedDylan Baker1-16/+12
Currently we don't handle things correctly if we get a string we should split, and the linker and needs compiler arguments. It would result in two unsplit strings in a list, instead of the split arguments in a list Fixes: #8348
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 Baker3-3/+9
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-16Add optional -Dcuda_ccbindir= option and -ccbin flag to CUDA compiler.Olexa Bilaniuk1-8/+32
Closes #8110.
2021-02-16Armour-grade quoting to account for NVCC's -Xcompiler peculiarities.Olexa Bilaniuk1-14/+84
2021-02-16Extensive rewrite of GCC/MVSC flag translation to NVCC flags.Olexa Bilaniuk1-31/+313
2021-02-16Add default debug flags for two configurations to NVCC.Olexa Bilaniuk1-2/+2
2021-02-14Add custom entyr to cuda buildtype dict. Closes #8336.Jussi Pakkanen1-0/+1
2021-02-02Add support for LLVM's thinLTODylan Baker3-8/+21
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 Baker3-5/+42
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-23split mesonlib into a packageDylan Baker1-1/+2
Currently mesonlib does some import tricks to figure out whether it needs to use windows or posix specific functions. This is a little hacky, but works fine. However, the way the typing stubs are implemented for the msvcrt and fnctl modules will cause mypy to fail on the other platform, since the functions are not implemented. To aleviate this (and for slightly cleaner design), I've split mesonlib into a pacakge with three modules. A universal module contains all of the platform agnositc code, a win32 module contains window specific code, a posix module contains the posix specific code, and a platform module contains no-op implementations. Then the package's __init__ file imports all of the universal functions and all of the functions from the approriate platform module, or the no-op versions as fallbacks. This makes mypy happy, and avoids `if`ing all over the code to switch between the platform specific code.
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écimo3-6/+6
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-11move handling of CFLAGS and friends to environmentDylan Baker3-64/+17
This has a bunch of nice features. It obviously centralizes everything, which is nice. It also means that env is only re-read at `meson --wipe`, not `meson --reconfigure`. And it's going to allow more cleanups.
2021-01-11use PEP8 style naming for LANGUAGES_USING_* as wellDylan Baker2-5/+5
2021-01-11rename cflags_mapping to CFLAGS_MAPPINGDylan Baker1-14/+18
This is PEP8 convention for a const variable. Also, make the type Mapping, which doesn't have mutation methods. This means mypy will warn us if someone tries to change this.
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 Baker14-87/+94
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 Baker7-15/+16
There's starting to be a lot of things including coredata that coredata needs to itself include. putting it in mesonlib makes more sense