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

@ -88,6 +88,12 @@ C_FUNC_ATTRIBUTES = {
'int foo(void) __attribute__((pure));', 'int foo(void) __attribute__((pure));',
'returns_nonnull': 'returns_nonnull':
'int *foo(void) __attribute__((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': 'unused':
'int foo(void) __attribute__((unused));', 'int foo(void) __attribute__((unused));',
'used': 'used':

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

Loading…
Cancel
Save