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. --- mesonbuild/compilers/cpp.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mesonbuild/compilers/cpp.py') diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 85766f7ef..217365549 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -31,8 +31,14 @@ from .compilers import ( ArmCompiler, ArmclangCompiler, ) +from .c_function_attributes import CXX_FUNC_ATTRIBUTES class CPPCompiler(CCompiler): + + @classmethod + def attribute_check_func(cls, name): + return CXX_FUNC_ATTRIBUTES.get(name, super().attribute_check_func(name)) + def __init__(self, exelist, version, is_cross, exe_wrap, **kwargs): # If a child ObjCPP class has already set it, don't set it ourselves if not hasattr(self, 'language'): -- cgit v1.2.3