diff options
-rw-r--r-- | docs/markdown/Reference-tables.md | 3 | ||||
-rw-r--r-- | mesonbuild/compilers/c_function_attributes.py | 1 | ||||
-rw-r--r-- | test cases/common/197 function attributes/meson.build | 6 |
3 files changed, 10 insertions, 0 deletions
diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md index 553b67c..81117bc 100644 --- a/docs/markdown/Reference-tables.md +++ b/docs/markdown/Reference-tables.md @@ -240,6 +240,7 @@ which are supported by GCC, Clang, and other compilers. | optimize | | packed | | pure | +| retainⓠ| | returns_nonnull | | unused | | used | @@ -261,6 +262,8 @@ which are supported by GCC, Clang, and other compilers. ³ *New in 0.55.0* +ⓠ*New in 0.62.0* + ### MSVC __declspec These values are supported using the MSVC style `__declspec` annotation, diff --git a/mesonbuild/compilers/c_function_attributes.py b/mesonbuild/compilers/c_function_attributes.py index f31229e..ac145d8 100644 --- a/mesonbuild/compilers/c_function_attributes.py +++ b/mesonbuild/compilers/c_function_attributes.py @@ -113,6 +113,7 @@ C_FUNC_ATTRIBUTES = { 'weakref': ''' static int foo(void) { return 0; } static int var(void) __attribute__((weakref("foo")));''', + 'retain': '__attribute__((retain)) int x;', } CXX_FUNC_ATTRIBUTES = { diff --git a/test cases/common/197 function attributes/meson.build b/test cases/common/197 function attributes/meson.build index 9817309..9ec6388 100644 --- a/test cases/common/197 function attributes/meson.build +++ b/test cases/common/197 function attributes/meson.build @@ -80,6 +80,12 @@ if ['gcc', 'intel'].contains(c.get_id()) if c.get_id() == 'gcc' and c.version().version_compare('>= 7.0.0') attributes += 'fallthrough' endif + + # XXX(arsen): limited to clang 13+ even though gcc 11 has it, since gcc + # detects support for it at compile time based on binutils version + if c.get_id() == 'clang' and c.version().version_compare('>= 13.0.0') + attributes += 'retain' + endif endif if get_option('mode') == 'single' |