aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/cpp.py
AgeCommit message (Collapse)AuthorFilesLines
2019-07-15compilers: move ccrx compiler abstraction into mixinsDylan Baker1-1/+2
2019-07-15compilers: Move clike into a mixins directoryDylan Baker1-1/+1
The compilers module is rather large and confusing, with spaghetti dependencies going every which way. I'm planning to start breaking out the internal representations into a mixins submodule, for things that shouldn't be required outside of the compilers module itself.
2019-07-14Do not fail on passing `-Werror=unused-parameter` from environmentDavid Seifert1-1/+1
2019-07-08Add (v)c++latest to VC_VERSION_MAPRobin Kertels1-0/+2
2019-06-11compilers/cpp: Fix removal of name from Combo options for Armclangsompen1-2/+1
2019-06-09Purge `is_cross` and friends without changing user interfacesJohn Ericson1-25/+25
In most cases instead pass `for_machine`, the name of the relevant machines (what compilers target, what targets run on, etc). This allows us to use the cross code path in the native case, deduplicating the code. As one can see, environment got bigger as more information is kept structured there, while ninjabackend got a smaller. Overall a few amount of lines were added, but the hope is what's added is a lot simpler than what's removed.
2019-05-15UserOption no longer has a name field.John Ericson1-27/+17
This avoids the duplication where the option is stored in a dict at its name, and also contains its own name. In general, the maxim in programming is things shouldn't know their own name, so removed the name field just leaving the option's position in the dictionary as its name.
2019-05-14Merge pull request #5331 from dcbaker/iclJussi Pakkanen1-34/+77
ICL (Intel for Windows) support
2019-05-13compilers: Add basic ICL abstractionsDylan Baker1-0/+13
2019-05-13compilers: rename IntelCompiler to IntelGnuLikeCompilerDylan Baker1-3/+3
The Intel compiler is strange. On Linux and macOS it's called ICC, and it tries to mostly behave like gcc/clang. On Windows it's called ICL, and tries to behave like MSVC. This makes the code that's used to implement ICC support useless for supporting ICL, because their command line interfaces are completely different.
2019-05-13compilers/cpp: Split code out of VisualStudioLikeCPPCompiler for treating ↵Dylan Baker1-30/+60
c++11 as c++14 This restrictuion exists for MSVC and clang-cl, but not for ICL which actually does support C++11 as a distinct standard. This commmit pulls that behavior out into a mixin class for ClangClCPPCompiler and VisualStudioCPPCompiler, as well as moving the MSVC specific functionality into the VisualStudioCPPCompiler class.
2019-05-13Allow MSVC-style `cpp_eh` for backwards-compatibility purposesnicole mazzuca1-12/+22
2019-05-10compilers: make keyword args to Compiler.compile keyword onlyDylan Baker1-1/+1
Becuase treating args as either keyword or positional makes inheritance really awful to work with.
2019-05-05Merge pull request #5339 from dcbaker/clikeJussi Pakkanen1-37/+47
Split up the representations of the C and C++ compilers
2019-05-05add -fno-exceptions if cpp_eh=none is specified nicole mazzuca1-8/+38
2019-05-03compilers: Split C-Like functionality into a mixin classesDylan Baker1-33/+50
Currently C++ inherits C, which can lead to diamond problems. By pulling the code out into a standalone mixin class that the C, C++, ObjC, and Objc++ compilers can inherit and override as necessary we remove one source of diamonding. I've chosen to split this out into it's own file as the CLikeCompiler class is over 1000 lines by itself. This also breaks the VisualStudio derived classes inheriting from each other, to avoid the same C -> CPP inheritance problems. This is all one giant patch because there just isn't a clean way to separate this. I've done the same for Fortran since it effectively inherits the CCompiler (I say effectively because was it actually did was gross beyond explanation), it's probably not correct, but it seems to work for now. There really is a lot of layering violation going on in the Compilers, and a really good scrubbing would do this code a lot of good.
2019-05-02Revert "detect Intel ICL on windows"Dylan Baker1-8/+1
This reverts commit 3a75bb5259abbcae820b47f5f4633c564411893b.
2019-05-02Merge pull request #4952 from mensinda/cacheCompilesDylan Baker1-5/+6
Cache compilers.compile() in coredata
2019-05-02Add some type annotations and fix lintsJohn Ericson1-1/+0
Some things, like `method[...](...)` or `x: ... = ...` python 3.5 doesn't support, so I made a comment instead with the intention that it can someday be made into a real annotation.
2019-04-28Print '(cached)' when compiler result was cachedDaniel Mensinger1-5/+6
2019-04-27detect Intel ICL on windowsMichael Hirsch, Ph.D1-1/+8
ICL CPP working
2019-04-27better default order for fotran compiler searchMichael Hirsch, Ph.D1-2/+2
correct PGI windows detection doc cleanup PGI detect
2019-04-19Fix indentationmakise-homura1-3/+3
2019-04-19Add -std= remap support for Elbrus compilermakise-homura1-2/+2
2019-04-19Handle cpp_debugstl option for Elbrus compilermakise-homura1-2/+5
2019-02-19Add warning level zerojml17951-4/+8
2019-01-21Add PGI C and C++ compilers (#4803)Michael Hirsch, Ph.D1-0/+8
2018-12-06Store the target architecture for CL-like compilersJon Turney1-4/+4
Store the MSVC compiler target architecture ('x86', 'x64' or 'ARM' (this is ARM64, I believe)), rather than just if it's x64 or not. The regex used for target architecture should be ok, based on this list of [1] version outputs, but we assume x86 if no match, for safety's sake. [1] https://stackoverflow.com/a/1233332/1951600 Also detect arch even if cl outputs version to stdout. Ditto for clang-cl Future work: is_64 is now only used in get_instruction_set_args()
2018-11-19Fix flake8 'imported but unused' reportsJon Turney1-1/+0
$ flake8 | grep F401 ./run_unittests.py:43:1: F401 'mesonbuild.mesonlib.is_linux' imported but unused ./mesonbuild/compilers/c.py:32:1: F401 '.compilers.CompilerType' imported but unused ./mesonbuild/compilers/cpp.py:23:1: F401 '.compilers.CompilerType' imported but unused
2018-11-13compilers: Use keyword only arguments for compiler interfacesDylan Baker1-5/+10
Because we need to inherit them in some cases, and python's keyword-or-positional arguments make this really painful, especially with inheritance. They do this in two ways: 1) If you want to intercept the arguments you need to check for both a keyword and a positional argument, because you could get either. Then you need to make sure that you only pass one of those down to the next layer. 2) After you do that, if the layer below you decides to do the same thing, but uses the other form (you used keyword by the lower level uses positional or vice versa), then you'll get a TypeError since two layers down got the argument as both a positional and a keyword. All of this is bad. Fortunately python 3.x provides a mechanism to solve this, keyword only arguments. These arguments cannot be based positionally, the interpreter will give us an error in that case. I have made a best effort to do this correctly, and I've verified it with GCC, Clang, ICC, and MSVC, but there are other compilers like Arm and Elbrus that I don't have access to.
2018-11-08Add support for Renesas CC-RX toolchainPhillip Cao1-0/+29
2018-11-04Qualify checks of self.version by self.id in VisualStudioC/CPPCompilerJon Turney1-7/+10
2018-11-04Detect clang-cl as msvc-like, not clang-likeJon Turney1-1/+5
Handle clang's cl or clang-cl being in PATH, or set in CC/CXX Future work: checking the name of the executable here seems like a bad idea. These compilers will fail to be detected if they are renamed. v2: Update compiler.get_argument_type() test Fix comparisons of id inside CCompiler, backends and elsewhere v3: ClangClCPPCompiler should be a subclass of ClangClCCompier, as well Future work: mocking in test_find_library_patterns() is effected, as we now test for a subclass, rather than self.id in CCompiler.get_library_naming()
2018-10-30Generalize gnulike-targeting-windows checks.Josh Gao1-2/+2
Replace several checks against GCC_MINGW or (GCC_MINGW, GCC_CYGWIN) with is_windows_compiler instead, so that clang and other gcc-like compilers using MinGW work appropriately with vs_module_defs, c_winlibs, and cpp_winlibs. Fixes #4434.
2018-10-27add support for `/permissive-`Nicole Mazzuca1-8/+21
We do this with `std_ver=vc++NM` - `vc++` does not add `/permissive-`, while `std_ver=c++NM` adds `/permissive-`.
2018-10-22add cpp_std support for MSVCNicole Mazzuca1-3/+34
2018-10-07Adding "compiler_type" flag to ARM compilers.Mohammed Amer Khalidi1-4/+4
2018-09-17Abstract shared GCC/Clang/ICC methods in GnuLikeCompilerDavid Seifert1-4/+0
2018-09-16Fix ICC on macOSDavid Seifert1-4/+15
2018-09-16Use enum instead of `int` for compiler variantsDavid Seifert1-12/+12
* Enums are strongly typed and make the whole `gcc_type`/`clang_type`/`icc_type` distinction redundant. * Enums also allow extending via member functions, which makes the code more generalisable.
2018-09-07Add method to check for C/C++ function attributesDylan Baker1-0/+6
It's fairly common on Linux and *BSD platforms to check for these attributes existence, so it makes sense to me to have this checking build into meson itself. Autotools also has a builtin for handling these, and by building them in we can short circuit cases that we know that these don't exist (MSVC). Additionally this adds support for two common MSVC __declspec attributes, dllimport and dllexport. This implements the declspec version (even though GCC has an __attribute__ version that both it and clang support), since GCC and Clang support the MSVC version as well. Thus it seems reasonable to assume that most projects will use the __declspec version over teh __attribute__ version.
2018-08-29Make `-std=` fallback remapping more robustDavid Seifert1-11/+54
* The current version matching logic is brittle with respect to Clang. LLVM and Apple Clang use slightly different but nowadays overlapping version ranges. Instead, we now just check whether the compiler supports the given `-std=` variant and try its respective fallback instead of testing version ranges.
2018-08-20Remap -std=c++14 dialect names for older compilersDavid Seifert1-2/+10
* GCC 4.8 and Clang 3.2, 3.3, 3.4 only understand `-std={c,gnu}++1y` for enabling C++14 dialects. GCC 4.8 is especially important as it is the basis of RHEL/CentOS 7.
2018-08-18Convert buildtype to optimization and debug options (#3489)Jussi Pakkanen1-1/+1
2018-08-09Add support for c++2a and gnu++2aZachary Michaels1-4/+4
2018-07-13Avoid concatenating two options in listThomas Hindoe Paaboel Andersen1-1/+1
'c++17' and 'gnu++98' were concatenated due to a missing comma
2018-06-21Added ARMCLANG compiler support for C/C++ (#3717)Vasu Penugonda1-0/+29
2018-06-06Fix issues found by flake8Xavier Claessens1-1/+0
2018-06-06Compilers: Chain-up to parent class in get_options()Xavier Claessens1-29/+35
Parent class could have common options for all compilers, and we'll soon add some.
2018-05-02Can combine D and C++ in a single target. Closes #3125.Jussi Pakkanen1-0/+6