aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-03-02 11:59:28 -0500
committerXavier Claessens <xclaesse@gmail.com>2023-08-05 07:14:08 -0400
commite01d53b816c9fba25a068039e62d8ac9e5e2a971 (patch)
tree7905b8adc6c81750daa160cccbe7738e636e59a5 /docs
parent50baf3c626267252a2d943a49d8e7c0402e23218 (diff)
downloadmeson-e01d53b816c9fba25a068039e62d8ac9e5e2a971.zip
meson-e01d53b816c9fba25a068039e62d8ac9e5e2a971.tar.gz
meson-e01d53b816c9fba25a068039e62d8ac9e5e2a971.tar.bz2
compiler: Add required keyword to has_* methods
add the "required" keyword to the functions has_function has_type has_member has_members has_argument has_multi_arguments has_link_argument has_multi_link_argument has_function_attribute Co-authored-by: Milan Hauth <milahu@gmail.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/markdown/snippets/required_keyword_for_has_functions.md19
-rw-r--r--docs/yaml/objects/compiler.yaml43
2 files changed, 54 insertions, 8 deletions
diff --git a/docs/markdown/snippets/required_keyword_for_has_functions.md b/docs/markdown/snippets/required_keyword_for_has_functions.md
new file mode 100644
index 0000000..0752ac7
--- /dev/null
+++ b/docs/markdown/snippets/required_keyword_for_has_functions.md
@@ -0,0 +1,19 @@
+## All compiler `has_*` methods support the `required` keyword
+
+Now instead of
+
+```meson
+assert(cc.has_function('some_function'))
+assert(cc.has_type('some_type'))
+assert(cc.has_member('struct some_type', 'x'))
+assert(cc.has_members('struct some_type', ['x', 'y']))
+```
+
+we can use
+
+```meson
+cc.has_function('some_function', required: true)
+cc.has_type('some_type', required: true)
+cc.has_member('struct some_type', 'x', required: true)
+cc.has_members('struct some_type', ['x', 'y'], required: true)
+```
diff --git a/docs/yaml/objects/compiler.yaml b/docs/yaml/objects/compiler.yaml
index 4bf69c3..14b61a8 100644
--- a/docs/yaml/objects/compiler.yaml
+++ b/docs/yaml/objects/compiler.yaml
@@ -143,6 +143,19 @@ methods:
When set to a [`feature`](Build-options.md#features) option, the feature
will control if it is searched and whether to fail if not found.
+- name: _required
+ returns: void
+ description: You have found a bug if you can see this!
+ kwargs:
+ required:
+ type: bool | feature
+ default: false
+ since: 1.1.0
+ description:
+ When set to `true`, Meson will halt if the check fails.
+
+ When set to a [`feature`](Build-options.md#features) option, the feature
+ will control if it is searched and whether to fail if not found.
# Star of the actual functions
- name: version
@@ -196,7 +209,9 @@ methods:
- name: has_member
returns: bool
description: Returns true if the type has the specified member.
- kwargs_inherit: compiler._common
+ kwargs_inherit:
+ - compiler._common
+ - compiler._required
posargs:
typename:
type: str
@@ -208,7 +223,9 @@ methods:
- name: has_members
returns: bool
description: Returns `true` if the type has *all* the specified members.
- kwargs_inherit: compiler._common
+ kwargs_inherit:
+ - compiler._common
+ - compiler._required
posargs:
typename:
type: str
@@ -225,7 +242,9 @@ methods:
Returns true if the given function is provided
by the standard library or a library passed in with the `args` keyword.
- kwargs_inherit: compiler._common
+ kwargs_inherit:
+ - compiler._common
+ - compiler._required
posargs:
funcname:
type: str
@@ -234,7 +253,9 @@ methods:
- name: has_type
returns: bool
description: Returns `true` if the specified token is a type.
- kwargs_inherit: compiler._common
+ kwargs_inherit:
+ - compiler._common
+ - compiler._required
posargs:
typename:
type: str
@@ -457,6 +478,8 @@ methods:
argument:
type: str
description: The argument to check.
+ kwargs_inherit:
+ - compiler._required
- name: has_multi_arguments
since: 0.37.0
@@ -469,6 +492,8 @@ methods:
name: arg
type: str
description: The arguments to check.
+ kwargs_inherit:
+ - compiler._required
- name: get_supported_arguments
returns: list[str]
@@ -515,6 +540,8 @@ methods:
argument:
type: str
description: The argument to check.
+ kwargs_inherit:
+ - compiler._required
- name: has_multi_link_arguments
since: 0.46.0
@@ -527,6 +554,8 @@ methods:
name: arg
type: str
description: The link arguments to check.
+ kwargs_inherit:
+ - compiler._required
- name: get_supported_link_arguments
returns: list[str]
@@ -556,10 +585,6 @@ methods:
Given a list of strings, returns the first argument that passes the
[[compiler.has_link_argument]] test or an empty array if none pass.
-
-
-
-
- name: has_function_attribute
returns: bool
since: 0.48.0
@@ -573,6 +598,8 @@ methods:
name:
type: str
description: The attribute name to check.
+ kwargs_inherit:
+ - compiler._required
- name: get_supported_function_attributes
returns: list[str]