From 51e9db370a0ebccaf220e171c3444a0f2c4e1723 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 29 Sep 2017 11:52:06 -0700 Subject: Add method to check for C/C++ function attributes It's fairly common on Linux and *BSD platforms to check for these attributes existence, so it makes sense to me to have this checking build into meson itself. Autotools also has a builtin for handling these, and by building them in we can short circuit cases that we know that these don't exist (MSVC). Additionally this adds support for two common MSVC __declspec attributes, dllimport and dllexport. This implements the declspec version (even though GCC has an __attribute__ version that both it and clang support), since GCC and Clang support the MSVC version as well. Thus it seems reasonable to assume that most projects will use the __declspec version over teh __attribute__ version. --- docs/markdown/Reference-tables.md | 63 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'docs/markdown/Reference-tables.md') diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md index 46bcc3d7c..ab79abd57 100644 --- a/docs/markdown/Reference-tables.md +++ b/docs/markdown/Reference-tables.md @@ -99,3 +99,66 @@ These are the parameter names for passing language specific arguments to your bu | Objective C++ | objcpp_args | | Rust | rust_args | | Vala | vala_args | + + +## Function Attributes + +These are the parameters names that are supported using +`compiler.has_function_attribute()` or +`compiler.get_supported_function_attributes()` + +### GCC __attribute__ + +These values are supported using the GCC style `__attribute__` annotations, +which are supported by GCC, Clang, and other compilers. + + +| Name | +|----------------------| +| alias | +| aligned | +| alloc_size | +| always_inline | +| artificial | +| cold | +| const | +| constructor | +| constructor_priority | +| deprecated | +| destructor | +| error | +| externally_visible | +| fallthrough | +| flatten | +| format | +| format_arg | +| gnu_inline | +| hot | +| ifunc | +| malloc | +| noclone | +| noinline | +| nonnull | +| noreturn | +| nothrow | +| optimize | +| packed | +| pure | +| returns_nonnull | +| unused | +| used | +| visibility | +| warning | +| warn_unused_result | +| weak | +| weakreaf | + +### MSVC __declspec + +These values are supported using the MSVC style `__declspec` annotation, +which are supported by MSVC, GCC, Clang, and other compilers. + +| Name | +|----------------------| +| dllexport | +| dllimport | -- cgit v1.2.3