Skip to content

Commit c49b292

Browse files
committed
conditional flatten
1 parent e9483b6 commit c49b292

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

include/ctre/utility.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@
2424

2525
#ifdef _MSC_VER
2626
#define CTRE_FORCE_INLINE __forceinline
27+
#if _MSC_VER >= 1930
2728
#define CTRE_FLATTEN [[msvc::flatten]]
2829
#else
30+
#define CTRE_FLATTEN
31+
#endif
32+
#else
2933
#define CTRE_FORCE_INLINE inline __attribute__((always_inline))
3034
#define CTRE_FLATTEN __attribute__((flatten))
3135
#endif

single-header/ctre-unicode.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,8 +1408,12 @@ struct pcre {
14081408

14091409
#ifdef _MSC_VER
14101410
#define CTRE_FORCE_INLINE __forceinline
1411+
#if _MSC_VER >= 1930
14111412
#define CTRE_FLATTEN [[msvc::flatten]]
14121413
#else
1414+
#define CTRE_FLATTEN
1415+
#endif
1416+
#else
14131417
#define CTRE_FORCE_INLINE inline __attribute__((always_inline))
14141418
#define CTRE_FLATTEN __attribute__((flatten))
14151419
#endif

single-header/ctre.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,8 +1405,12 @@ struct pcre {
14051405

14061406
#ifdef _MSC_VER
14071407
#define CTRE_FORCE_INLINE __forceinline
1408+
#if _MSC_VER >= 1930
14081409
#define CTRE_FLATTEN [[msvc::flatten]]
14091410
#else
1411+
#define CTRE_FLATTEN
1412+
#endif
1413+
#else
14101414
#define CTRE_FORCE_INLINE inline __attribute__((always_inline))
14111415
#define CTRE_FLATTEN __attribute__((flatten))
14121416
#endif

0 commit comments

Comments
 (0)