Skip to content

Commit 36d8cfd

Browse files
MarcelRaadcdunn2001
authored andcommitted
Fix macro redefinition warning with clang-cl
clang-cl defines _MSC_VER by default, so JSONCPP_DEPRECATED was first defined for MSVC and then redefined for clang. Integrate the MSVC definition into the block with clang and GCC's JSONCPP_DEPRECATED definitions to fix this.
1 parent 0c1cc6e commit 36d8cfd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: include/json/config.h

+3-5
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ msvc_pre1900_c99_snprintf(char* outBuf, size_t size, const char* format, ...);
7979
// Storages, and 64 bits integer support is disabled.
8080
// #define JSON_NO_INT64 1
8181

82-
#if defined(_MSC_VER) // MSVC
83-
#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
84-
#endif // defined(_MSC_VER)
85-
8682
// JSONCPP_OVERRIDE is maintained for backwards compatibility of external tools.
8783
// C++11 should be used directly in JSONCPP.
8884
#define JSONCPP_OVERRIDE override
@@ -135,7 +131,9 @@ msvc_pre1900_c99_snprintf(char* outBuf, size_t size, const char* format, ...);
135131
#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
136132
#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
137133
#endif // GNUC version
138-
#endif // __clang__ || __GNUC__
134+
#elif defined(_MSC_VER) // MSVC (after clang because clang on Windows emulates MSVC)
135+
#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
136+
#endif // __clang__ || __GNUC__ || _MSC_VER
139137

140138
#if !defined(JSONCPP_DEPRECATED)
141139
#define JSONCPP_DEPRECATED(message)

0 commit comments

Comments
 (0)