Skip to content

Commit 73d6bc5

Browse files
committed
Refine MACRO for c++17 support
1 parent 1defa88 commit 73d6bc5

File tree

8 files changed

+14
-10
lines changed

8 files changed

+14
-10
lines changed

include/kafka/AdminClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class AdminClient: public KafkaClient
9696
static std::list<SimpleError> getPerTopicPartitionResults(const rd_kafka_topic_partition_list_t* partitionResults);
9797
static SimpleError combineErrors(const std::list<SimpleError>& errors);
9898

99-
#if __cplusplus >= 201703L
99+
#if COMPILER_SUPPORTS_CPP_17
100100
static constexpr int DEFAULT_COMMAND_TIMEOUT_MS = 30000;
101101
static constexpr int EVENT_POLLING_INTERVAL_MS = 100;
102102
#else

include/kafka/Consumer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace Consumer
2828
/**
2929
* Null RebalanceCallback
3030
*/
31-
#if __cplusplus >= 201703L
31+
#if COMPILER_SUPPORTS_CPP_17
3232
const inline RebalanceCallback NullRebalanceCallback = RebalanceCallback{};
3333
#else
3434
const static RebalanceCallback NullRebalanceCallback = RebalanceCallback{};
@@ -42,7 +42,7 @@ namespace Consumer
4242
/**
4343
* Null OffsetCommitCallback
4444
*/
45-
#if __cplusplus >= 201703L
45+
#if COMPILER_SUPPORTS_CPP_17
4646
const inline OffsetCommitCallback NullOffsetCommitCallback = OffsetCommitCallback{};
4747
#else
4848
const static OffsetCommitCallback NullOffsetCommitCallback = OffsetCommitCallback{};

include/kafka/Header.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ using Headers = std::vector<Header>;
4242
/**
4343
* Null Headers.
4444
*/
45-
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
45+
#if COMPILER_SUPPORTS_CPP_17
4646
const inline Headers NullHeaders = Headers{};
4747
#else
4848
const static Headers NullHeaders = Headers{};

include/kafka/KafkaClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class KafkaClient
200200
static const constexpr char* SECURITY_PROTOCOL = "security.protocol";
201201
static const constexpr char* SASL_KERBEROS_SERVICE_NAME = "sasl.kerberos.service.name";
202202

203-
#if __cplusplus >= 201703L
203+
#if COMPILER_SUPPORTS_CPP_17
204204
static constexpr int DEFAULT_METADATA_TIMEOUT_MS = 10000;
205205
#else
206206
enum { DEFAULT_METADATA_TIMEOUT_MS = 10000 };

include/kafka/KafkaConsumer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class KafkaConsumer: public KafkaClient
225225
static const constexpr char* ENABLE_AUTO_COMMIT = "enable.auto.commit";
226226
static const constexpr char* AUTO_COMMIT_INTERVAL_MS = "auto.commit.interval.ms";
227227

228-
#if __cplusplus >= 201703L
228+
#if COMPILER_SUPPORTS_CPP_17
229229
static constexpr int DEFAULT_SUBSCRIBE_TIMEOUT_MS = 30000;
230230
static constexpr int DEFAULT_UNSUBSCRIBE_TIMEOUT_MS = 10000;
231231
static constexpr int DEFAULT_QUERY_TIMEOUT_MS = 10000;

include/kafka/KafkaProducer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class KafkaProducer: public KafkaClient
100100

101101
static constexpr int CALLBACK_POLLING_INTERVAL_MS = 10;
102102

103-
#if __cplusplus >= 201703L
103+
#if COMPILER_SUPPORTS_CPP_17
104104
static constexpr int DEFAULT_INIT_TRANSACTIONS_TIMEOUT_MS = 10000;
105105
static constexpr int DEFAULT_COMMIT_TRANSACTION_TIMEOUT_MS = 10000;
106106
#else

include/kafka/Project.h

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

1313
#if defined(WIN32) && !defined(NOMINMAX)
1414
#define NOMINMAX
15+
16+
#define COMPILER_SUPPORTS_CPP_17 ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L))
17+
1518
#endif
19+

include/kafka/Types.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
// Use `boost::optional` for C++14, which doesn't support `std::optional`
19-
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
19+
#if COMPILER_SUPPORTS_CPP_17
2020
#include <optional>
2121
template<class T>
2222
using Optional = std::optional<T>;
@@ -84,7 +84,7 @@ using KeySize = std::size_t;
8484
/**
8585
* Null Key.
8686
*/
87-
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
87+
#if COMPILER_SUPPORTS_CPP_17
8888
const inline Key NullKey = Key{};
8989
#else
9090
const static Key NullKey = Key{};
@@ -99,7 +99,7 @@ using ValueSize = std::size_t;
9999
/**
100100
* Null Value.
101101
*/
102-
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
102+
#if COMPILER_SUPPORTS_CPP_17
103103
const inline Value NullValue = Value{};
104104
#else
105105
const static Value NullValue = Value{};

0 commit comments

Comments
 (0)