mirror of
https://github.com/nlohmann/json.git
synced 2026-10-16 11:17:13 +00:00
Do not force-inline the view's functions on MSVC
__forceinline makes MSVC report C4714 for function templates it cannot inline (get<std::string>), an error under /WX. The forced inlining is only a performance hint, so use plain inline there. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 file changed
+4
-1
@@ -28,7 +28,10 @@
|
|||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#define NLOHMANN_VIEW_LIKELY(x) (x)
|
#define NLOHMANN_VIEW_LIKELY(x) (x)
|
||||||
#define NLOHMANN_VIEW_UNLIKELY(x) (x)
|
#define NLOHMANN_VIEW_UNLIKELY(x) (x)
|
||||||
#define NLOHMANN_VIEW_ALWAYS_INLINE __forceinline
|
// plain inline: __forceinline makes MSVC report C4714 (not inlined) for
|
||||||
|
// function templates it cannot inline, which is an error under /WX; the
|
||||||
|
// forced inlining is only a performance hint
|
||||||
|
#define NLOHMANN_VIEW_ALWAYS_INLINE inline
|
||||||
#define NLOHMANN_VIEW_NOINLINE __declspec(noinline)
|
#define NLOHMANN_VIEW_NOINLINE __declspec(noinline)
|
||||||
#else
|
#else
|
||||||
#define NLOHMANN_VIEW_LIKELY(x) (x)
|
#define NLOHMANN_VIEW_LIKELY(x) (x)
|
||||||
|
|||||||
Reference in new issue
Block a user