diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-06-24 14:02:26 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-06-25 00:02:26 +0300 |
commit | e2039da5d99dc8fe4255069ef8ab14459766bf2d (patch) | |
tree | c6598d9778cd27a8d172ab2eac8ae745deeb986c | |
parent | 42bef8d418a8f981889a54e6e4b120f6243e54bc (diff) | |
download | meson-e2039da5d99dc8fe4255069ef8ab14459766bf2d.zip meson-e2039da5d99dc8fe4255069ef8ab14459766bf2d.tar.gz meson-e2039da5d99dc8fe4255069ef8ab14459766bf2d.tar.bz2 |
Split attribute visibility
* c_function_attributes: remove 'protected' from 'visibility'
This doesn't exist on macos with the apple compiler, which always causes
failures.
Fixes #5530
* compilers: Add split visibility checks to has_function_attribute
These check for a single visibility at a time, rather than all four at
once. This allows for finer grained searches, and should make using
these checks safer across operating systems.
-rw-r--r-- | docs/markdown/Reference-tables.md | 12 | ||||
-rw-r--r-- | docs/markdown/snippets/split-visibility-attributes.md | 14 | ||||
-rw-r--r-- | mesonbuild/compilers/c_function_attributes.py | 11 |
3 files changed, 34 insertions, 3 deletions
diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md index 682e508..84ce06f 100644 --- a/docs/markdown/Reference-tables.md +++ b/docs/markdown/Reference-tables.md @@ -182,12 +182,22 @@ which are supported by GCC, Clang, and other compilers. | returns_nonnull | | unused | | used | -| visibility | +| visibility* | +| visibility:defaultâ | +| visibility:hiddenâ | +| visibility:internalâ | +| visibility:protectedâ | | warning | | warn_unused_result | | weak | | weakreaf | +\* *Changed in 0.52.0* the "visibility" target no longer includes +"protected", which is not present in Apple's clang. + +â *New in 0.52.0* These split visibility attributes are preferred to the plain +"visibility" as they provide narrower checks. + ### MSVC __declspec These values are supported using the MSVC style `__declspec` annotation, diff --git a/docs/markdown/snippets/split-visibility-attributes.md b/docs/markdown/snippets/split-visibility-attributes.md new file mode 100644 index 0000000..e8cd152 --- /dev/null +++ b/docs/markdown/snippets/split-visibility-attributes.md @@ -0,0 +1,14 @@ +## Splitting of Compiler.get_function_attribute('visibility') + +On macOS there is no `protected` visibility, which results in the visbility +check always failing. 0.52.0 introduces two changes to improve this situation: + +1. the "visibility" check no longer includes "protected" +2. a new set of "split" checks are introduced which check for a single + attribute instead of all attributes. + +These new attributes are: +* visibility:default +* visibility:hidden +* visibility:internal +* visibility:protected
\ No newline at end of file diff --git a/mesonbuild/compilers/c_function_attributes.py b/mesonbuild/compilers/c_function_attributes.py index a522a1a..e5de485 100644 --- a/mesonbuild/compilers/c_function_attributes.py +++ b/mesonbuild/compilers/c_function_attributes.py @@ -93,8 +93,15 @@ C_FUNC_ATTRIBUTES = { 'visibility': ''' int foo_def(void) __attribute__((visibility("default"))); int foo_hid(void) __attribute__((visibility("hidden"))); - int foo_int(void) __attribute__((visibility("internal"))); - int foo_pro(void) __attribute__((visibility("protected")));''', + int foo_int(void) __attribute__((visibility("internal")));''', + 'visibility:default': + 'int foo(void) __attribute__((visibility("default")));', + 'visibility:hidden': + 'int foo(void) __attribute__((visibility("hidden")));', + 'visibility:internal': + 'int foo(void) __attribute__((visibility("internal")));', + 'visibility:protected': + 'int foo(void) __attribute__((visibility("protected")));', 'warning': 'int foo(void) __attribute__((warning("")));', 'warn_unused_result': |