Add cc.has_function_attribute('section')

pull/9752/head
Tristan Partin 3 years ago committed by Eli Schwartz
parent 8afdecb039
commit 5d438b6aed
  1. 3
      docs/markdown/Reference-tables.md
  2. 6
      mesonbuild/compilers/c_function_attributes.py
  3. 1
      test cases/common/197 function attributes/meson.build

@ -246,6 +246,7 @@ which are supported by GCC, Clang, and other compilers.
| pure |
| retain⁴ |
| returns_nonnull |
| section⁵ |
| unused |
| used |
| visibility* |
@ -268,6 +269,8 @@ which are supported by GCC, Clang, and other compilers.
⁴ *New in 0.62.0*
⁵ *New in 0.63.0*
### MSVC __declspec
These values are supported using the MSVC style `__declspec` annotation,

@ -88,6 +88,12 @@ C_FUNC_ATTRIBUTES = {
'int foo(void) __attribute__((pure));',
'returns_nonnull':
'int *foo(void) __attribute__((returns_nonnull));',
'section': '''
#if defined(__APPLE__) && defined(__MACH__)
extern int foo __attribute__((section("__BAR,__bar")));
#else
extern int foo __attribute__((section(".bar")));
#endif''',
'unused':
'int foo(void) __attribute__((unused));',
'used':

@ -49,6 +49,7 @@ attributes = [
'noreturn',
'nothrow',
'pure',
'section',
'unused',
'used',
'warn_unused_result',

Loading…
Cancel
Save