diff options
| author | Tristan Partin <tristan@partin.io> | 2024-07-11 10:11:27 -0500 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-11-18 08:22:34 -0800 |
| commit | ccbc91c23393ad9754e1019c4ce5853cf5c8a8e3 (patch) | |
| tree | 27543d9a13b1dd22531d18845b3e1f4ba762a35a /test cases/common | |
| parent | bf45777a1d979465abea3cd1ade8ff227eacdf9a (diff) | |
| download | meson-ccbc91c23393ad9754e1019c4ce5853cf5c8a8e3.tar.gz | |
Add support for the `counted_by` attribute
This is a new attribute released in GCC 15 and clang 18. It isn't
supported in C++ compilers at the moment.
Diffstat (limited to 'test cases/common')
| -rw-r--r-- | test cases/common/197 function attributes/meson.build | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/test cases/common/197 function attributes/meson.build b/test cases/common/197 function attributes/meson.build index db7e3af32..a2dc5b76f 100644 --- a/test cases/common/197 function attributes/meson.build +++ b/test cases/common/197 function attributes/meson.build @@ -117,7 +117,16 @@ if ['gcc', 'intel'].contains(c.get_id()) endif endif +if c.get_id() == 'clang' + if c.version().version_compare('>= 18.0.0') + attributes += 'counted_by' + endif +endif + if c.get_id() == 'gcc' + if c.version().version_compare('>= 15.1') + attributes += 'counted_by' + endif if c.version().version_compare('>= 14.1') attributes += 'null_terminated_string_arg' endif @@ -128,19 +137,27 @@ if get_option('mode') == 'single' x = c.has_function_attribute(a) expected_result = expected.get(a, expected_default) assert(x == expected_result, '@0@: @1@'.format(c.get_id(), a)) - x = cpp.has_function_attribute(a) - assert(x == expected_result, '@0@: @1@'.format(cpp.get_id(), a)) + # counted_by is not currently supported by GCC or clang on C++ + if a != 'counted_by' + x = cpp.has_function_attribute(a) + assert(x == expected_result, '@0@: @1@'.format(cpp.get_id(), a)) + endif endforeach else - multi_expected = [] + multi_expected_c = [] + multi_expected_cpp = [] foreach a : attributes if expected.get(a, expected_default) - multi_expected += a + multi_expected_c += a + # counted_by is not currently supported by GCC or clang on C++ + if a != 'counted_by' + multi_expected_cpp += a + endif endif endforeach multi_check = c.get_supported_function_attributes(attributes) - assert(multi_check == multi_expected, 'get_supported_function_arguments works (C)') + assert(multi_check == multi_expected_c, 'get_supported_function_arguments works (C)') multi_check = cpp.get_supported_function_attributes(attributes) - assert(multi_check == multi_expected, 'get_supported_function_arguments works (C++)') + assert(multi_check == multi_expected_cpp, 'get_supported_function_arguments works (C++)') endif |
