Skip to content

Commit

Permalink
common/Compiler.h: refactor constexpr preprocessor code
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed May 27, 2024
1 parent e8186c6 commit 48f6f07
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/common/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,24 +260,21 @@ definition to detect its implementation was only added in C++17. */
#define NOEXCEPT_EXPR(x) x
#endif

// Uses SD-6 Feature Test Recommendations
#if defined(__cpp_constexpr)
#define CONSTEXPR constexpr
#else
#define CONSTEXPR
#endif
#define CONSTEXPR_FUNCTION constexpr

// Uses SD-6 Feature Test Recommendations
#ifdef __cpp_constexpr
# if __cpp_constexpr >= 201304
# define CONSTEXPR_FUNCTION_RELAXED constexpr
# else
# define CONSTEXPR_FUNCTION_RELAXED
# endif
# define CONSTEXPR_FUNCTION constexpr
#if __cpp_constexpr >= 201304
#define CONSTEXPR_FUNCTION_RELAXED constexpr
#else
#define CONSTEXPR_FUNCTION_RELAXED
#endif
#else
// Work around lack of constexpr
# define CONSTEXPR_FUNCTION
# define CONSTEXPR_FUNCTION_RELAXED
// Work around lack of constexpr
#define CONSTEXPR
#define CONSTEXPR_FUNCTION
#define CONSTEXPR_FUNCTION_RELAXED
#endif

// Compiler specificities we can't disable.
Expand Down

0 comments on commit 48f6f07

Please sign in to comment.