diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/markdown/Compiler-properties.md | 14 | ||||
-rw-r--r-- | docs/markdown/Reference-manual.md | 7 | ||||
-rw-r--r-- | docs/markdown/Reference-tables.md | 45 | ||||
-rw-r--r-- | docs/markdown/snippets/compiler_argument_syntax.md | 22 |
4 files changed, 63 insertions, 25 deletions
diff --git a/docs/markdown/Compiler-properties.md b/docs/markdown/Compiler-properties.md index 1228f42..4f5ebdb 100644 --- a/docs/markdown/Compiler-properties.md +++ b/docs/markdown/Compiler-properties.md @@ -29,9 +29,17 @@ Compiler id == The compiler object has a method called `get_id`, which returns a -lower case string describing the "family" of the compiler. See -[reference tables](Reference-tables.md) for a list of supported -compiler ids. +lower case string describing the "family" of the compiler. + +The compiler object also has a method `get_argument_syntax` which +returns a lower case string of `gcc`, `msvc`, or another undefined string +value; identifying whether the compiler arguments use the same syntax as +either `gcc` or `msvc`, or that its arguments are not like either. This should +only be used to select the syntax of the arguments, such as those to test +with `has_argument`. + +See [reference tables](Reference-tables.md#compiler-ids) for a list of supported compiler +ids and their argument type. Does code compile? == diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index f43f1f6..72e9609 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -1702,6 +1702,13 @@ the following methods: - `get_id()` returns a string identifying the compiler. For example, `gcc`, `msvc`, [and more](Reference-tables.md#compiler-ids). +- `get_argument_syntax()` *(new in 0.49.0)* returns a string identifying the type + of arguments the compiler takes. Can be one of `gcc`, `msvc`, or an undefined + string value. This method is useful for identifying compilers that are not + gcc or msvc, but use the same argument syntax as one of those two compilers + such as clang or icc, especially when they use different syntax on different + operating systems. + - `get_supported_arguments(list_of_string)` *(added 0.43.0)* returns an array containing only the arguments supported by the compiler, as if `has_argument` were called on them individually. diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md index ef5d24b..72dce4b 100644 --- a/docs/markdown/Reference-tables.md +++ b/docs/markdown/Reference-tables.md @@ -2,28 +2,29 @@ ## Compiler ids -These are return values of the `get_id` method in a compiler object. - -| Value | Compiler family | -| ----- | ---------------- | -| gcc | The GNU Compiler Collection | -| clang | The Clang compiler | -| msvc | Microsoft Visual Studio | -| intel | Intel compiler | -| llvm | LLVM-based compiler (Swift, D) | -| mono | Xamarin C# compiler | -| dmd | D lang reference compiler | -| rustc | Rust compiler | -| valac | Vala compiler | -| pathscale | The Pathscale Fortran compiler | -| pgi | The Portland Fortran compiler | -| sun | Sun Fortran compiler | -| g95 | The G95 Fortran compiler | -| open64 | The Open64 Fortran Compiler | -| nagfor | The NAG Fortran compiler | -| lcc | Elbrus C/C++/Fortran Compiler | -| arm | ARM compiler | -| armclang | ARMCLANG compiler | +These are return values of the `get_id` (Compiler family) and +`get_argument_syntax` (Argument syntax) method in a compiler object. + +| Value | Compiler family | Argument syntax | +| ----- | ---------------- | -------------------------------| +| gcc | The GNU Compiler Collection | gcc | +| clang | The Clang compiler | gcc | +| msvc | Microsoft Visual Studio | msvc | +| intel | Intel compiler | msvc on windows, otherwise gcc | +| llvm | LLVM-based compiler (Swift, D) | | +| mono | Xamarin C# compiler | | +| dmd | D lang reference compiler | | +| rustc | Rust compiler | | +| valac | Vala compiler | | +| pathscale | The Pathscale Fortran compiler | | +| pgi | The Portland Fortran compiler | | +| sun | Sun Fortran compiler | | +| g95 | The G95 Fortran compiler | | +| open64 | The Open64 Fortran Compiler | | +| nagfor | The NAG Fortran compiler | | +| lcc | Elbrus C/C++/Fortran Compiler | | +| arm | ARM compiler | | +| armclang | ARMCLANG compiler | | ## Script environment variables diff --git a/docs/markdown/snippets/compiler_argument_syntax.md b/docs/markdown/snippets/compiler_argument_syntax.md new file mode 100644 index 0000000..6ae32d4 --- /dev/null +++ b/docs/markdown/snippets/compiler_argument_syntax.md @@ -0,0 +1,22 @@ +## new compiler method `get_argument_syntax` + +The compiler object now has `get_argument_syntax` method, which returns a +string value of `gcc`, `msvc`, or an undefined value string value. This can be +used to determine if a compiler uses gcc syntax (`-Wfoo`), msvc syntax +(`/w1234`), or some other kind of arguments. + +```meson +cc = meson.get_compiler('c') + +if cc.get_argument_syntax() == 'msvc' + if cc.has_argument('/w1235') + add_project_arguments('/w1235', language : ['c']) + endif +elif cc.get_argument_syntax() == 'gcc' + if cc.has_argument('-Wfoo') + add_project_arguments('-Wfoo', language : ['c']) + endif +elif cc.get_id() == 'some other compiler' + add_project_arguments('--error-on-foo', language : ['c']) +endif +``` |