From e01d53b816c9fba25a068039e62d8ac9e5e2a971 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 2 Mar 2023 11:59:28 -0500 Subject: 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 --- .../snippets/required_keyword_for_has_functions.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/markdown/snippets/required_keyword_for_has_functions.md (limited to 'docs/markdown') 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) +``` -- cgit v1.1