diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-10-16 10:03:13 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-11-03 18:10:36 +0200 |
commit | 63f4f9481ebc865b11a06aeecf0c624104d46afd (patch) | |
tree | 13ff86bcf410ae872ebc1c33cac851104d21ecf0 /test cases/common/206 argument syntax | |
parent | 8cd7f7871bc99e5ed709d4f0ec54997047f3e335 (diff) | |
download | meson-63f4f9481ebc865b11a06aeecf0c624104d46afd.zip meson-63f4f9481ebc865b11a06aeecf0c624104d46afd.tar.gz meson-63f4f9481ebc865b11a06aeecf0c624104d46afd.tar.bz2 |
Add new compiler.get_argument_syntax method
Some compilers try very had to pretend they're another compiler (ICC
pretends to be GCC and Linux and MacOS, and MSVC on windows), Clang
behaves much like GCC, but now also has clang-cl, which behaves like MSVC.
This method provides an easy way to determine whether testing for MSVC
like arguments `/w1234` or gcc like arguments `-Wfoo` are likely to
succeed, without having to check for dozens of compilers and the host
operating system, (as you would otherwise have to do with ICC).
Diffstat (limited to 'test cases/common/206 argument syntax')
-rw-r--r-- | test cases/common/206 argument syntax/meson.build | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test cases/common/206 argument syntax/meson.build b/test cases/common/206 argument syntax/meson.build new file mode 100644 index 0000000..c884f90 --- /dev/null +++ b/test cases/common/206 argument syntax/meson.build @@ -0,0 +1,25 @@ +project( + 'argument syntax', + ['c'], +) + +cc = meson.get_compiler('c') + +if ['gcc', 'lcc', 'clang'].contains(cc.get_id()) + expected = 'gcc' +elif cc.get_id() == 'msvc' + expected = 'msvc' +elif cc.get_id() == 'intel' + if host_machine.system() == 'windows' + expected = 'msvc' + else + expected = 'gcc' + endif +else + # It's possible that other compilers end up here that shouldn't + expected = 'other' +endif + +assert(cc.get_argument_syntax() == expected, + 'Wrong output for compiler @0@. expected @1@ but got @2@'.format( + cc.get_id(), expected, cc.get_argument_syntax())) |