Fix clang10 warnings in market data
This commit is contained in:
1 parent
5bc1ed9a56
commit
bb9a897dcf
4 files changed
+21
-8
No files matched your search
@@ -12,13 +12,11 @@ using small_vector = boost::container::small_vector<T,4>;
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
MDConsumerHandle::MDConsumerHandle() {
|
||||
memset(this, 0, sizeof(MDConsumerHandle));
|
||||
_type = HANDLETYPE_VOID;
|
||||
MDConsumerHandle::MDConsumerHandle() : _type(HANDLETYPE_VOID), book() {
|
||||
// value initializing 'book' zeroes the union
|
||||
static_assert(sizeof(MDConsumerHandle) <= 40, "");
|
||||
}
|
||||
MDConsumerHandle::MDConsumerHandle(const std::shared_ptr<const SyntheticStrategy>& def) {
|
||||
memset(this, 0, sizeof(MDConsumerHandle));
|
||||
MDConsumerHandle::MDConsumerHandle(const std::shared_ptr<const SyntheticStrategy>& def) : _type(HANDLETYPE_VOID), book() {
|
||||
synthetic.def = def;
|
||||
_type = HANDLETYPE_SYNTHETIC;
|
||||
for(size_t x = 0; x < def->legs.size(); ++x) {
|
||||
@@ -26,9 +24,7 @@ MDConsumerHandle::MDConsumerHandle(const std::shared_ptr<const SyntheticStrategy
|
||||
}
|
||||
}
|
||||
|
||||
MDConsumerHandle::MDConsumerHandle(const MDConsumerHandle& other) {
|
||||
memset(this, 0, sizeof(MDConsumerHandle));
|
||||
_type = HANDLETYPE_VOID;
|
||||
MDConsumerHandle::MDConsumerHandle(const MDConsumerHandle& other): _type(HANDLETYPE_VOID), book() {
|
||||
*this = other;
|
||||
}
|
||||
|
||||
|
||||
@@ -390,6 +390,8 @@ private:
|
||||
std::shared_ptr<const SyntheticStrategy> def;
|
||||
};
|
||||
HandleType _type;
|
||||
// NOTE: If we ever have to add to this union
|
||||
// it would be best to convert it to an std::variant()
|
||||
union {
|
||||
DepthHandle book;
|
||||
BBOHandle bbo;
|
||||
|
||||
@@ -50,7 +50,12 @@ public:
|
||||
|
||||
// Calculating the size for the variable sized entries is tricky
|
||||
ColdEntry* c_entry = new (_cold.add(ColdEntry::fixed_size() + security.size)) ColdEntry(security.size);
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
// Security here is a variable sized structure (may be FixedFuture/FixedOption)
|
||||
// So we have to memcpy to keep the extra fields
|
||||
memcpy(&c_entry->security, &security, security.size);
|
||||
#pragma GCC diagnostic pop
|
||||
smapper.apply(c_entry->security);
|
||||
|
||||
MDProducerHandle handle(_cold.header(), _hot.header(), *c_entry, h_entry, MDProducerChannel(*this));
|
||||
|
||||
@@ -17,7 +17,12 @@ Co2TestInstrument::Co2TestInstrument(const std::string& symbol, SecurityType typ
|
||||
fsec.exchange = api::VENUE_BTS;
|
||||
_cold_buffer = std::shared_ptr<uint8_t>(new uint8_t[ColdEntry::fixed_size() + fsec.size], std::default_delete<uint8_t[]>());
|
||||
_cold = new (_cold_buffer.get()) ColdEntry(fsec.size);
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
// Security here is a variable sized structure (may be FixedFuture/FixedOption)
|
||||
// So we have to memcpy to keep the extra fields
|
||||
memcpy(&_cold->security, &fsec, fsec.size);
|
||||
#pragma GCC diagnostic pop
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,7 +38,12 @@ Co2TestInstrument::Co2TestInstrument(const Security& security, std::shared_ptr<C
|
||||
convert_security(security, fsec, false);
|
||||
_cold_buffer = std::shared_ptr<uint8_t>(new uint8_t[ColdEntry::fixed_size() + fsec.size], std::default_delete<uint8_t[]>());
|
||||
_cold = new (_cold_buffer.get()) ColdEntry(fsec.size);
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
// Security here is a variable sized structure (may be FixedFuture/FixedOption)
|
||||
// So we have to memcpy to keep the extra fields
|
||||
memcpy(&_cold->security, &fsec, fsec.size);
|
||||
#pragma GCC diagnostic pop
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user