Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use c++11 attribute when C++11 is activated #725

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions config.hh.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,26 @@
# 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
// Use C++11 attribute if avaiable.
// This avoid issue when mixing old and C++11 attributes with GCC < 13
# 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")]]
// gnu::visibility is not working with clang and explicit template instantiation
# 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
# 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
# endif
# else
// Otherwise (GCC < 4 or another compiler is used), export everything.
# define @LIBRARY_NAME@_DLLIMPORT
Expand Down
Loading