mirror of
https://github.com/gabime/spdlog.git
synced 2025-10-02 03:19:02 +08:00
Add an optional final qualifier to types
When building with GCC's -Wfinal-types, a lot of types of spdlog are marked as being more optimizable if they were marked final. This patch adds a possibility for the user of the library to `#define SPDLOG_FINAL final` and enjoy potentially better performance : GCC is then able to replace virtual calls by true function calls if it can ensure that there are no derived types). By default SPDLOG_FINAL is defined to nothing to not break existing code that may be inheriting of some of these types for some reason.
This commit is contained in:
@@ -29,6 +29,12 @@
|
||||
#define SPDLOG_CONSTEXPR constexpr
|
||||
#endif
|
||||
|
||||
// If an user of the library is not inheriting from the types provided by it,
|
||||
// he can #define SPDLOG_FINAL final to get additional optimizations
|
||||
#if !defined(SPDLOG_FINAL)
|
||||
#define SPDLOG_FINAL
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define SPDLOG_DEPRECATED __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
|
Reference in New Issue
Block a user