Skip to content

Commit f620321

Browse files
Better C++ version requirement checks and reporting.
Address another review from Michael & Bronek.
1 parent 20e401a commit f620321

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

antithesis_sdk.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,36 @@
44
//
55
// Documentation for the SDK is found at https://antithesis.com/docs/using_antithesis/sdk/cpp/overview/.
66

7+
#ifndef NO_ANTITHESIS_SDK
8+
79
#if __cplusplus < 202000L
810
#error "The Antithesis C++ API requires C++20 or higher"
911
#ifndef NO_ANTITHESIS_SDK
1012
#define NO_ANTITHESIS_SDK
1113
#endif
1214
#endif
1315

14-
#if defined(__clang__) && __clang_major__ < 16
15-
#error "The Antithesis C++ API requires clang version 16 or higher"
16+
#if !defined(__clang__)
17+
#error "The Antithesis C++ API requires a clang compiler"
18+
#ifndef NO_ANTITHESIS_SDK
19+
#define NO_ANTITHESIS_SDK
20+
#endif
21+
#endif
1622

23+
#if __clang_major__ < 16
24+
#error "The Antithesis C++ API requires clang version 16 or higher"
1725
#ifndef NO_ANTITHESIS_SDK
1826
#define NO_ANTITHESIS_SDK
1927
#endif
2028
#endif
2129

30+
#else
31+
32+
#if __cplusplus < 201700L
33+
#error "The Antithesis C++ API (with NO_ANTITHESIS_SDK) requires C++17 or higher"
34+
#endif
2235

36+
#endif
2337

2438
/*****************************************************************************
2539
* COMMON
@@ -43,7 +57,7 @@ namespace antithesis {
4357
struct JSONArray : std::vector<JSONValue> {
4458
using std::vector<JSONValue>::vector;
4559

46-
template<typename T, std::enable_if<std::is_convertible<T, JSONValue>::value, bool>::type = true>
60+
template<typename T, typename std::enable_if<std::is_convertible<T, JSONValue>::value, bool>::type = true>
4761
JSONArray(std::vector<T> vals) : std::vector<JSONValue>(vals.begin(), vals.end()) {}
4862
};
4963

0 commit comments

Comments
 (0)