Skip to content

Commit aba5949

Browse files
committed
FIX: Fix macOS build
1 parent 57314c4 commit aba5949

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

include/databento/flag_set.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ class FlagSet {
1111
using Repr = std::uint8_t;
1212
// Indicates it's the last message in the packet from the venue for a given
1313
// `instrument_id`.
14-
static inline constexpr Repr kLast = 1 << 7;
14+
static constexpr Repr kLast = 1 << 7;
1515
// Indicates a top-of-book message, not an individual order.
16-
static inline constexpr Repr kTob = 1 << 6;
16+
static constexpr Repr kTob = 1 << 6;
1717
// Indicates the message was sourced from a replay, such as a snapshot
1818
// server.
19-
static inline constexpr Repr kSnapshot = 1 << 5;
19+
static constexpr Repr kSnapshot = 1 << 5;
2020
// Indicates an aggregated price level message, not an individual order.
21-
static inline constexpr Repr kMbp = 1 << 4;
21+
static constexpr Repr kMbp = 1 << 4;
2222
// Indicates the `ts_recv` value is inaccurate due to clock issues or packet
2323
// reordering.
24-
static inline constexpr Repr kBadTsRecv = 1 << 3;
24+
static constexpr Repr kBadTsRecv = 1 << 3;
2525
// Indicates an unrecoverable gap was detected in the channel.
26-
static inline constexpr Repr kMaybeBadBook = 1 << 2;
26+
static constexpr Repr kMaybeBadBook = 1 << 2;
2727

2828
friend std::ostream& operator<<(std::ostream&, FlagSet);
2929

src/compat.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ SymbolMappingMsgV2 SymbolMappingMsgV1::ToV2() const {
110110
RecordHeader{sizeof(SymbolMappingMsgV2) / RecordHeader::kLengthMultiplier,
111111
RType::SymbolMapping, hd.publisher_id, hd.instrument_id,
112112
hd.ts_event},
113-
// invalid
113+
// Intentionally invalid
114+
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
114115
static_cast<SType>(std::numeric_limits<std::uint8_t>::max()),
115116
{},
116-
// invalid
117+
// Intentionally invalid
118+
// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange)
117119
static_cast<SType>(std::numeric_limits<std::uint8_t>::max()),
118120
{},
119121
start_ts,

src/flag_set.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55
#include "stream_op_helper.hpp"
66

77
namespace databento {
8+
constexpr FlagSet::Repr FlagSet::kLast;
9+
constexpr FlagSet::Repr FlagSet::kTob;
10+
constexpr FlagSet::Repr FlagSet::kSnapshot;
11+
constexpr FlagSet::Repr FlagSet::kMbp;
12+
constexpr FlagSet::Repr FlagSet::kBadTsRecv;
13+
constexpr FlagSet::Repr FlagSet::kMaybeBadBook;
14+
815
std::ostream& operator<<(std::ostream& stream, FlagSet flag_set) {
9-
constexpr std::array<std::pair<bool (FlagSet::*)() const, const char*>, 6>
16+
const std::array<std::pair<bool (FlagSet::*)() const, const char*>, 6>
1017
kFlagsAndNames = {{
1118
{&FlagSet::IsLast, "LAST"},
1219
{&FlagSet::IsTob, "TOB"},

test/src/dbn_decoder_tests.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <cstring>
77
#include <fstream> // ifstream
88
#include <ios> // streamsize, ios::binary, ios::ate
9+
#include <limits>
910
#include <memory>
1011

1112
#include "databento/compat.hpp"
@@ -164,6 +165,10 @@ TEST_F(DbnDecoderTests, TestUpgradeSymbolMappingWithTsOut) {
164165
EXPECT_EQ(orig.ts_out, upgraded.ts_out);
165166
EXPECT_STREQ(orig.rec.STypeInSymbol(), upgraded.rec.STypeInSymbol());
166167
EXPECT_STREQ(orig.rec.STypeOutSymbol(), upgraded.rec.STypeOutSymbol());
168+
EXPECT_EQ(static_cast<std::uint8_t>(upgraded.rec.stype_in),
169+
std::numeric_limits<std::uint8_t>::max());
170+
EXPECT_EQ(static_cast<std::uint8_t>(upgraded.rec.stype_out),
171+
std::numeric_limits<std::uint8_t>::max());
167172
// `length` properly set
168173
EXPECT_EQ(upgraded.rec.hd.Size(), sizeof(upgraded));
169174
// used compat buffer

0 commit comments

Comments
 (0)