From 737e8ed789d7a77cce897ab7ec464f6aac4901be Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Thu, 31 Oct 2024 10:57:43 +0100 Subject: [PATCH] config.hh: Use c++11 attribute when C++11 is activated --- config.hh.cmake | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/config.hh.cmake b/config.hh.cmake index d3b4a367b..c8a9269b3 100644 --- a/config.hh.cmake +++ b/config.hh.cmake @@ -50,13 +50,22 @@ # else // On Linux, for GCC >= 4, tag symbols using GCC extension. # if __GNUC__ >= 4 -# define @LIBRARY_NAME@_DLLIMPORT __attribute__ ((visibility("default"))) -# define @LIBRARY_NAME@_DLLEXPORT __attribute__ ((visibility("default"))) -# define @LIBRARY_NAME@_DLLLOCAL __attribute__ ((visibility("hidden"))) -# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLIMPORT __attribute__ ((visibility("default"))) -# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLEXPORT __attribute__ ((visibility("default"))) -# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLIMPORT -# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLEXPORT +# if defined(__cplusplus) && (__cplusplus >= 201103L) +# define @LIBRARY_NAME@_DLLIMPORT [[gnu::visibility("default")]] +# define @LIBRARY_NAME@_DLLEXPORT [[gnu::visibility("default")]] +# define @LIBRARY_NAME@_DLLLOCAL [[gnu::visibility("hidden")]] +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLIMPORT [[gnu::visibility("default")]] +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLEXPORT [[gnu::visibility("default")]] +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLIMPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLEXPORT +# else +# define @LIBRARY_NAME@_DLLIMPORT __attribute__ ((visibility("default"))) +# define @LIBRARY_NAME@_DLLEXPORT __attribute__ ((visibility("default"))) +# define @LIBRARY_NAME@_DLLLOCAL __attribute__ ((visibility("hidden"))) +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLIMPORT __attribute__ ((visibility("default"))) +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DECLARATION_DLLEXPORT __attribute__ ((visibility("default"))) +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLIMPORT +# define @LIBRARY_NAME@_EXPLICIT_INSTANTIATION_DEFINITION_DLLEXPORT # else // Otherwise (GCC < 4 or another compiler is used), export everything. # define @LIBRARY_NAME@_DLLIMPORT