We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
apple clang does not have visibility "protected"
This results in the attribute check function returning false on apple clang, but symbol visibility otherwise working.

so something like:
```meson
args = []
if cc.has_function_attribute('visibility')
  args += '-DEXPORT=__attribute__((visibility("default")))
endif

library(
  'foo.c',
  c_args : args,
  gnu_symbol_visibility : 'hidden',
)
```

will fail with missing symbols because args is `[]`

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mesonbuild/compilers/c_function_attributes.py`
Content:
```
1 # These functions are based on the following code:
2 # https://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_gcc_func_attribute.m4,
3 # which is licensed under the following terms:
4 #
5 #   Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>
6 #
7 #   Copying and distribution of this file, with or without modification, are
8 #   permitted in any medium without royalty provided the copyright notice
9 #   and this notice are preserved.  This file is offered as-is, without any
10 #   warranty.
11 #
12 
13 C_FUNC_ATTRIBUTES = {
14     'alias': '''
15         int foo(void) { return 0; }
16         int bar(void) __attribute__((alias("foo")));''',
17     'aligned':
18         'int foo(void) __attribute__((aligned(32)));',
19     'alloc_size':
20         'void *foo(int a) __attribute__((alloc_size(1)));',
21     'always_inline':
22         'inline __attribute__((always_inline)) int foo(void) { return 0; }',
23     'artificial':
24         'inline __attribute__((artificial)) int foo(void) { return 0; }',
25     'cold':
26         'int foo(void) __attribute__((cold));',
27     'const':
28         'int foo(void) __attribute__((const));',
29     'constructor':
30         'int foo(void) __attribute__((constructor));',
31     'constructor_priority':
32         'int foo( void ) __attribute__((__constructor__(65535/2)));',
33     'deprecated':
34         'int foo(void) __attribute__((deprecated("")));',
35     'destructor':
36         'int foo(void) __attribute__((destructor));',
37     'dllexport':
38         '__declspec(dllexport) int foo(void) { return 0; }',
39     'dllimport':
40         '__declspec(dllimport) int foo(void);',
41     'error':
42         'int foo(void) __attribute__((error("")));',
43     'externally_visible':
44         'int foo(void) __attribute__((externally_visible));',
45     'fallthrough': '''
46         int foo( void ) {
47           switch (0) {
48             case 1: __attribute__((fallthrough));
49             case 2: break;
50           }
51           return 0;
52         };''',
53     'flatten':
54         'int foo(void) __attribute__((flatten));',
55     'format':
56         'int foo(const char * p, ...) __attribute__((format(printf, 1, 2)));',
57     'format_arg':
58         'char * foo(const char * p) __attribute__((format_arg(1)));',
59     'gnu_inline':
60         'inline __attribute__((gnu_inline)) int foo(void) { return 0; }',
61     'hot':
62         'int foo(void) __attribute__((hot));',
63     'ifunc':
64         ('int my_foo(void) { return 0; }'
65          'static int (*resolve_foo(void))(void) { return my_foo; }'
66          'int foo(void) __attribute__((ifunc("resolve_foo")));'),
67     'leaf':
68         '__attribute__((leaf)) int foo(void) { return 0; }',
69     'malloc':
70         'int *foo(void) __attribute__((malloc));',
71     'noclone':
72         'int foo(void) __attribute__((noclone));',
73     'noinline':
74         '__attribute__((noinline)) int foo(void) { return 0; }',
75     'nonnull':
76         'int foo(char * p) __attribute__((nonnull(1)));',
77     'noreturn':
78         'int foo(void) __attribute__((noreturn));',
79     'nothrow':
80         'int foo(void) __attribute__((nothrow));',
81     'optimize':
82         '__attribute__((optimize(3))) int foo(void) { return 0; }',
83     'packed':
84         'struct __attribute__((packed)) foo { int bar; };',
85     'pure':
86         'int foo(void) __attribute__((pure));',
87     'returns_nonnull':
88         'int *foo(void) __attribute__((returns_nonnull));',
89     'unused':
90         'int foo(void) __attribute__((unused));',
91     'used':
92         'int foo(void) __attribute__((used));',
93     'visibility': '''
94         int foo_def(void) __attribute__((visibility("default")));
95         int foo_hid(void) __attribute__((visibility("hidden")));
96         int foo_int(void) __attribute__((visibility("internal")));
97         int foo_pro(void) __attribute__((visibility("protected")));''',
98     'warning':
99         'int foo(void) __attribute__((warning("")));',
100     'warn_unused_result':
101         'int foo(void) __attribute__((warn_unused_result));',
102     'weak':
103         'int foo(void) __attribute__((weak));',
104     'weakref': '''
105         static int foo(void) { return 0; }
106         static int var(void) __attribute__((weakref("foo")));''',
107 }
108 
109 CXX_FUNC_ATTRIBUTES = {
110     # Alias must be applied to the mangled name in C++
111     'alias':
112         ('extern "C" {'
113          'int foo(void) { return 0; }'
114          '}'
115          'int bar(void) __attribute__((alias("foo")));'
116          ),
117     'ifunc':
118         ('extern "C" {'
119          'int my_foo(void) { return 0; }'
120          'static int (*resolve_foo(void))(void) { return my_foo; }'
121          '}'
122          'int foo(void) __attribute__((ifunc("resolve_foo")));'),
123 }
124
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mesonbuild/compilers/c_function_attributes.py b/mesonbuild/compilers/c_function_attributes.py
--- a/mesonbuild/compilers/c_function_attributes.py
+++ b/mesonbuild/compilers/c_function_attributes.py
@@ -93,8 +93,15 @@
     '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':

{"golden_diff": "diff --git a/mesonbuild/compilers/c_function_attributes.py b/mesonbuild/compilers/c_function_attributes.py\n--- a/mesonbuild/compilers/c_function_attributes.py\n+++ b/mesonbuild/compilers/c_function_attributes.py\n@@ -93,8 +93,15 @@\n     'visibility': '''\n         int foo_def(void) __attribute__((visibility(\"default\")));\n         int foo_hid(void) __attribute__((visibility(\"hidden\")));\n-        int foo_int(void) __attribute__((visibility(\"internal\")));\n-        int foo_pro(void) __attribute__((visibility(\"protected\")));''',\n+        int foo_int(void) __attribute__((visibility(\"internal\")));''',\n+    'visibility:default':\n+        'int foo(void) __attribute__((visibility(\"default\")));',\n+    'visibility:hidden':\n+        'int foo(void) __attribute__((visibility(\"hidden\")));',\n+    'visibility:internal':\n+        'int foo(void) __attribute__((visibility(\"internal\")));',\n+    'visibility:protected':\n+        'int foo(void) __attribute__((visibility(\"protected\")));',\n     'warning':\n         'int foo(void) __attribute__((warning(\"\")));',\n     'warn_unused_result':\n", "issue": "apple clang does not have visibility \"protected\"\nThis results in the attribute check function returning false on apple clang, but symbol visibility otherwise working.\r\n\r\nso something like:\r\n```meson\r\nargs = []\r\nif cc.has_function_attribute('visibility')\r\n  args += '-DEXPORT=__attribute__((visibility(\"default\")))\r\nendif\r\n\r\nlibrary(\r\n  'foo.c',\r\n  c_args : args,\r\n  gnu_symbol_visibility : 'hidden',\r\n)\r\n```\r\n\r\nwill fail with missing symbols because args is `[]`\n", "before_files": [{"content": "# These functions are based on the following code:\n# https://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_gcc_func_attribute.m4,\n# which is licensed under the following terms:\n#\n#   Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>\n#\n#   Copying and distribution of this file, with or without modification, are\n#   permitted in any medium without royalty provided the copyright notice\n#   and this notice are preserved.  This file is offered as-is, without any\n#   warranty.\n#\n\nC_FUNC_ATTRIBUTES = {\n    'alias': '''\n        int foo(void) { return 0; }\n        int bar(void) __attribute__((alias(\"foo\")));''',\n    'aligned':\n        'int foo(void) __attribute__((aligned(32)));',\n    'alloc_size':\n        'void *foo(int a) __attribute__((alloc_size(1)));',\n    'always_inline':\n        'inline __attribute__((always_inline)) int foo(void) { return 0; }',\n    'artificial':\n        'inline __attribute__((artificial)) int foo(void) { return 0; }',\n    'cold':\n        'int foo(void) __attribute__((cold));',\n    'const':\n        'int foo(void) __attribute__((const));',\n    'constructor':\n        'int foo(void) __attribute__((constructor));',\n    'constructor_priority':\n        'int foo( void ) __attribute__((__constructor__(65535/2)));',\n    'deprecated':\n        'int foo(void) __attribute__((deprecated(\"\")));',\n    'destructor':\n        'int foo(void) __attribute__((destructor));',\n    'dllexport':\n        '__declspec(dllexport) int foo(void) { return 0; }',\n    'dllimport':\n        '__declspec(dllimport) int foo(void);',\n    'error':\n        'int foo(void) __attribute__((error(\"\")));',\n    'externally_visible':\n        'int foo(void) __attribute__((externally_visible));',\n    'fallthrough': '''\n        int foo( void ) {\n          switch (0) {\n            case 1: __attribute__((fallthrough));\n            case 2: break;\n          }\n          return 0;\n        };''',\n    'flatten':\n        'int foo(void) __attribute__((flatten));',\n    'format':\n        'int foo(const char * p, ...) __attribute__((format(printf, 1, 2)));',\n    'format_arg':\n        'char * foo(const char * p) __attribute__((format_arg(1)));',\n    'gnu_inline':\n        'inline __attribute__((gnu_inline)) int foo(void) { return 0; }',\n    'hot':\n        'int foo(void) __attribute__((hot));',\n    'ifunc':\n        ('int my_foo(void) { return 0; }'\n         'static int (*resolve_foo(void))(void) { return my_foo; }'\n         'int foo(void) __attribute__((ifunc(\"resolve_foo\")));'),\n    'leaf':\n        '__attribute__((leaf)) int foo(void) { return 0; }',\n    'malloc':\n        'int *foo(void) __attribute__((malloc));',\n    'noclone':\n        'int foo(void) __attribute__((noclone));',\n    'noinline':\n        '__attribute__((noinline)) int foo(void) { return 0; }',\n    'nonnull':\n        'int foo(char * p) __attribute__((nonnull(1)));',\n    'noreturn':\n        'int foo(void) __attribute__((noreturn));',\n    'nothrow':\n        'int foo(void) __attribute__((nothrow));',\n    'optimize':\n        '__attribute__((optimize(3))) int foo(void) { return 0; }',\n    'packed':\n        'struct __attribute__((packed)) foo { int bar; };',\n    'pure':\n        'int foo(void) __attribute__((pure));',\n    'returns_nonnull':\n        'int *foo(void) __attribute__((returns_nonnull));',\n    'unused':\n        'int foo(void) __attribute__((unused));',\n    'used':\n        'int foo(void) __attribute__((used));',\n    'visibility': '''\n        int foo_def(void) __attribute__((visibility(\"default\")));\n        int foo_hid(void) __attribute__((visibility(\"hidden\")));\n        int foo_int(void) __attribute__((visibility(\"internal\")));\n        int foo_pro(void) __attribute__((visibility(\"protected\")));''',\n    'warning':\n        'int foo(void) __attribute__((warning(\"\")));',\n    'warn_unused_result':\n        'int foo(void) __attribute__((warn_unused_result));',\n    'weak':\n        'int foo(void) __attribute__((weak));',\n    'weakref': '''\n        static int foo(void) { return 0; }\n        static int var(void) __attribute__((weakref(\"foo\")));''',\n}\n\nCXX_FUNC_ATTRIBUTES = {\n    # Alias must be applied to the mangled name in C++\n    'alias':\n        ('extern \"C\" {'\n         'int foo(void) { return 0; }'\n         '}'\n         'int bar(void) __attribute__((alias(\"foo\")));'\n         ),\n    'ifunc':\n        ('extern \"C\" {'\n         'int my_foo(void) { return 0; }'\n         'static int (*resolve_foo(void))(void) { return my_foo; }'\n         '}'\n         'int foo(void) __attribute__((ifunc(\"resolve_foo\")));'),\n}\n", "path": "mesonbuild/compilers/c_function_attributes.py"}], "after_files": [{"content": "# These functions are based on the following code:\n# https://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_gcc_func_attribute.m4,\n# which is licensed under the following terms:\n#\n#   Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>\n#\n#   Copying and distribution of this file, with or without modification, are\n#   permitted in any medium without royalty provided the copyright notice\n#   and this notice are preserved.  This file is offered as-is, without any\n#   warranty.\n#\n\nC_FUNC_ATTRIBUTES = {\n    'alias': '''\n        int foo(void) { return 0; }\n        int bar(void) __attribute__((alias(\"foo\")));''',\n    'aligned':\n        'int foo(void) __attribute__((aligned(32)));',\n    'alloc_size':\n        'void *foo(int a) __attribute__((alloc_size(1)));',\n    'always_inline':\n        'inline __attribute__((always_inline)) int foo(void) { return 0; }',\n    'artificial':\n        'inline __attribute__((artificial)) int foo(void) { return 0; }',\n    'cold':\n        'int foo(void) __attribute__((cold));',\n    'const':\n        'int foo(void) __attribute__((const));',\n    'constructor':\n        'int foo(void) __attribute__((constructor));',\n    'constructor_priority':\n        'int foo( void ) __attribute__((__constructor__(65535/2)));',\n    'deprecated':\n        'int foo(void) __attribute__((deprecated(\"\")));',\n    'destructor':\n        'int foo(void) __attribute__((destructor));',\n    'dllexport':\n        '__declspec(dllexport) int foo(void) { return 0; }',\n    'dllimport':\n        '__declspec(dllimport) int foo(void);',\n    'error':\n        'int foo(void) __attribute__((error(\"\")));',\n    'externally_visible':\n        'int foo(void) __attribute__((externally_visible));',\n    'fallthrough': '''\n        int foo( void ) {\n          switch (0) {\n            case 1: __attribute__((fallthrough));\n            case 2: break;\n          }\n          return 0;\n        };''',\n    'flatten':\n        'int foo(void) __attribute__((flatten));',\n    'format':\n        'int foo(const char * p, ...) __attribute__((format(printf, 1, 2)));',\n    'format_arg':\n        'char * foo(const char * p) __attribute__((format_arg(1)));',\n    'gnu_inline':\n        'inline __attribute__((gnu_inline)) int foo(void) { return 0; }',\n    'hot':\n        'int foo(void) __attribute__((hot));',\n    'ifunc':\n        ('int my_foo(void) { return 0; }'\n         'static int (*resolve_foo(void))(void) { return my_foo; }'\n         'int foo(void) __attribute__((ifunc(\"resolve_foo\")));'),\n    'leaf':\n        '__attribute__((leaf)) int foo(void) { return 0; }',\n    'malloc':\n        'int *foo(void) __attribute__((malloc));',\n    'noclone':\n        'int foo(void) __attribute__((noclone));',\n    'noinline':\n        '__attribute__((noinline)) int foo(void) { return 0; }',\n    'nonnull':\n        'int foo(char * p) __attribute__((nonnull(1)));',\n    'noreturn':\n        'int foo(void) __attribute__((noreturn));',\n    'nothrow':\n        'int foo(void) __attribute__((nothrow));',\n    'optimize':\n        '__attribute__((optimize(3))) int foo(void) { return 0; }',\n    'packed':\n        'struct __attribute__((packed)) foo { int bar; };',\n    'pure':\n        'int foo(void) __attribute__((pure));',\n    'returns_nonnull':\n        'int *foo(void) __attribute__((returns_nonnull));',\n    'unused':\n        'int foo(void) __attribute__((unused));',\n    'used':\n        'int foo(void) __attribute__((used));',\n    'visibility': '''\n        int foo_def(void) __attribute__((visibility(\"default\")));\n        int foo_hid(void) __attribute__((visibility(\"hidden\")));\n        int foo_int(void) __attribute__((visibility(\"internal\")));''',\n    'visibility:default':\n        'int foo(void) __attribute__((visibility(\"default\")));',\n    'visibility:hidden':\n        'int foo(void) __attribute__((visibility(\"hidden\")));',\n    'visibility:internal':\n        'int foo(void) __attribute__((visibility(\"internal\")));',\n    'visibility:protected':\n        'int foo(void) __attribute__((visibility(\"protected\")));',\n    'warning':\n        'int foo(void) __attribute__((warning(\"\")));',\n    'warn_unused_result':\n        'int foo(void) __attribute__((warn_unused_result));',\n    'weak':\n        'int foo(void) __attribute__((weak));',\n    'weakref': '''\n        static int foo(void) { return 0; }\n        static int var(void) __attribute__((weakref(\"foo\")));''',\n}\n\nCXX_FUNC_ATTRIBUTES = {\n    # Alias must be applied to the mangled name in C++\n    'alias':\n        ('extern \"C\" {'\n         'int foo(void) { return 0; }'\n         '}'\n         'int bar(void) __attribute__((alias(\"foo\")));'\n         ),\n    'ifunc':\n        ('extern \"C\" {'\n         'int my_foo(void) { return 0; }'\n         'static int (*resolve_foo(void))(void) { return my_foo; }'\n         '}'\n         'int foo(void) __attribute__((ifunc(\"resolve_foo\")));'),\n}\n", "path": "mesonbuild/compilers/c_function_attributes.py"}]}