aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
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/markdown/snippets
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/markdown/snippets')
-rw-r--r--docs/markdown/snippets/required_keyword_for_has_functions.md19
1 files changed, 19 insertions, 0 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)
+```