Skip to content

Commit 9946baf

Browse files
committed
patch msvc detection: enable CTRE_FORCE_INLINE when clang or gcc is integrated in MSVC
1 parent 0e646f3 commit 9946baf

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

include/ctll/utilities.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
#include <type_traits>
55

6-
#ifdef _MSC_VER
6+
#if defined(__clang__) || defined(__GNUC__)
7+
#define CTLL_FORCE_INLINE __attribute__((always_inline))
8+
#elif defined(_MSC_VER)
79
#define CTLL_FORCE_INLINE __forceinline
810
#else
911
#define CTLL_FORCE_INLINE __attribute__((always_inline))

include/ctre/evaluation.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <iterator>
1313

1414
// remove me when MSVC fix the constexpr bug
15-
#ifdef _MSC_VER
15+
#if defined(_MSC_VER) && !defined(__clang__) && !defined(__GNUC__)
1616
#ifndef CTRE_MSVC_GREEDY_WORKAROUND
1717
#define CTRE_MSVC_GREEDY_WORKAROUND
1818
#endif

include/ctre/utility.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
#define CTRE_UNLIKELY
1919
#endif
2020

21-
#ifdef _MSC_VER
21+
#if defined(__clang__) || defined(__GNUC__)
22+
#define CTRE_FORCE_INLINE inline __attribute__((always_inline))
23+
#define CTRE_FLATTEN __attribute__((flatten))
24+
#elif defined(_MSC_VER)
2225
#define CTRE_FORCE_INLINE __forceinline
2326
#define CTRE_FLATTEN
2427
#else

0 commit comments

Comments
 (0)