chore (linux build): Add benign changes to satisfy gcc11

This commit is contained in:
John Colvin committed 2022-06-28 02:15:57 -04:00
1 parent f0021138e4
commit 6abec0c035
20 files changed
+62 -15

No files matched your search

+4 -3
View File
@@ -2,6 +2,7 @@
#include "MDConsumerHandle.h"
#include "MBOProcessor.h"
#include "lib/domain_model/Security.h"
#include "lib/os/os.h"
#include <boost/container/small_vector.hpp>
#define never bts_assert(false)
@@ -12,13 +13,13 @@ namespace bts {
namespace md {
MDConsumerHandle::MDConsumerHandle() {
memset(this, 0, sizeof(MDConsumerHandle));
os::memset(this, 0, sizeof(MDConsumerHandle));
_type = HANDLETYPE_VOID;
static_assert(sizeof(MDConsumerHandle) <= 40, "");
}
MDConsumerHandle::MDConsumerHandle(
const std::shared_ptr<const SyntheticStrategy> &def) {
memset(this, 0, sizeof(MDConsumerHandle));
os::memset(this, 0, sizeof(MDConsumerHandle));
synthetic.def = def;
_type = HANDLETYPE_SYNTHETIC;
for (size_t x = 0; x < def->legs.size(); ++x) {
@@ -29,7 +30,7 @@ MDConsumerHandle::MDConsumerHandle(
}
MDConsumerHandle::MDConsumerHandle(const MDConsumerHandle &other) {
memset(this, 0, sizeof(MDConsumerHandle));
os::memset(this, 0, sizeof(MDConsumerHandle));
_type = HANDLETYPE_VOID;
*this = other;
}
+2 -1
View File
@@ -7,6 +7,7 @@
#include "SecurityIDRecorder.h"
#include "Shm/MDStructure.h"
#include "lib/md/Diag/ShmDumper.h"
#include "lib/os/os.h"
#include "lib/utils/SharedList.h"
#include "lib/utils/WaitFreeQueue.h"
#include <iomanip>
@@ -70,7 +71,7 @@ class MDProducerImpl {
ColdEntry *c_entry =
new (_cold.add(ColdEntry::fixed_size() + security.size))
ColdEntry(security.size);
memcpy(&c_entry->security, &security, security.size);
os::memcpy(&c_entry->security, &security, security.size);
smapper.apply(c_entry->security);
MDProducerHandle handle(
+3 -2
View File
@@ -1,6 +1,7 @@
#define _DISABLE_EXTENDED_ALIGNED_STORAGE
#include "Co2TestInstrument.h"
#include "lib/md/MemorySegmentUtils.h"
#include "lib/os/os.h"
namespace bts {
namespace md {
@@ -22,7 +23,7 @@ Co2TestInstrument::Co2TestInstrument(
new uint8_t[ColdEntry::fixed_size() + fsec.size],
std::default_delete<uint8_t[]>());
_cold = new (_cold_buffer.get()) ColdEntry(fsec.size);
memcpy(&_cold->security, &fsec, fsec.size);
os::memcpy(&_cold->security, &fsec, fsec.size);
});
}
@@ -41,7 +42,7 @@ Co2TestInstrument::Co2TestInstrument(
new uint8_t[ColdEntry::fixed_size() + fsec.size],
std::default_delete<uint8_t[]>());
_cold = new (_cold_buffer.get()) ColdEntry(fsec.size);
memcpy(&_cold->security, &fsec, fsec.size);
os::memcpy(&_cold->security, &fsec, fsec.size);
});
}
+2
View File
@@ -3,6 +3,8 @@
#include "lib/config/config.h"
#include "lib/config/protos/market_data.pb.h"
#include "lib/logging/logging.h"
#include <fstream>
#include <string>
namespace bts {
namespace md {
+2 -1
View File
@@ -6,6 +6,7 @@
#include <boost/container/small_vector.hpp>
#include <functional>
#include <memory>
#include <type_traits>
#include <unordered_map>
namespace bts {
@@ -27,7 +28,7 @@ struct NoKey {
// (late join) or reentrancy (unsub while handling an update).
template <typename EV, typename KE = KeyExtractor> class ContentSubscription {
public:
using Key = decltype((*((KE *)nullptr))(*((EV *)nullptr)));
using Key = std::invoke_result_t<KE, const EV&>;
using CB = std::function<void(const EV &)>;
struct SubID {
SubID() : k(), sid(0) {}
+2 -1
View File
@@ -2,6 +2,7 @@
#include "lib/mercury/synopsis/ISynopsisBuilder.h"
#include <memory>
#include <type_traits>
#include <unordered_map>
namespace bts {
@@ -11,7 +12,7 @@ namespace mercury {
// published for each key
template <class EV> class MergeByKey : public ISynopsisBuilder {
public:
using RefConstKey = decltype(((EV *)nullptr)->key());
using RefConstKey = std::invoke_result_t<decltype(&EV::key), EV>;
using ConstKey = typename std::remove_reference<RefConstKey>::type;
using Key = typename std::remove_const<ConstKey>::type;
+2 -1
View File
@@ -10,6 +10,7 @@
#include "lib/orderman/orderman_utils/CancelReject.h"
#include "lib/orderman/orderman_utils/fix_order_codec.h"
#include "lib/orderman/orderman_utils/orderman_common.h"
#include "lib/os/os.h"
namespace bts {
namespace orderman {
@@ -334,7 +335,7 @@ void IL3Parser::set_account(
if (details.partyDetailRole() ==
iLinkBinary::PartyDetailRole::CustomerAccount) {
const char *p_account = details.partyDetailID();
strncpy(
os::strncpy(
most_recent_account.value().data(), p_account,
most_recent_account.value().size());
break;
+10
View File
@@ -198,7 +198,17 @@ constexpr bool has_error(int events) {
void IL3Reactor::do_work() {
std::array<epoll_event, 100> ev_list;
#ifndef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
// A bug in gcc causes bogus errors related to 'unitialized' variables
// (particularly when accessing array<T>::size).
// https://cplusplus.com/forum/beginner/22044/
auto ready = epoll_wait(me->epoll_fd, ev_list.data(), ev_list.size(), 0);
#ifndef __clang__
#pragma GCC diagnostic pop
#endif
if (ready == -1) {
if (errno == EINTR)
return;
+1
View File
@@ -9,6 +9,7 @@
#include "lib/utils/thread_manager.h"
#include <boost/filesystem.hpp>
#include <fstream>
#include <nlohmann/json.hpp>
#include <tbb/concurrent_queue.h>
#include <thread>
@@ -7,6 +7,7 @@
#include "lib/jetfix/codec/i32_toa.h"
#include "lib/utils/base62.h"
#include "lib/utils/bts_assert.h"
#include "lib/os/os.h"
#include "orderman_common.h"
namespace bts {
@@ -99,7 +100,7 @@ inline void
encode_corid(const char *channel, uint32_t sn, std::array<char, 17> &out) {
memset(&out[0], ' ', out.size());
auto ch_sz = std::min(strlen(channel), (size_t)5);
strncpy(&out[0], channel, ch_sz);
os::strncpy(&out[0], channel, ch_sz);
out[ch_sz] = ':';
auto sz_written = u32_toa(sn, &out[ch_sz + 1]);
out[ch_sz + 1 + sz_written] = ' ';
@@ -362,7 +362,7 @@ OrderKey AlgoTestDriverBase::order_key() const { return me->order_key; }
OrderKey AlgoTestDriverBase::parent_order_key() const { return me->parent_key; }
const api::Security *
AlgoTestDriverBase::lookup_security(SecurityKey key) const {
auto s = get_some_securities();
const auto &s = get_some_securities();
auto iter = s.find(key);
if (iter != s.end()) {
return &iter->second;
+22
View File
@@ -3,6 +3,7 @@
#include "lib/utils/bts_export.h"
#include <cmath>
#include <cstring>
#include <limits>
#include <map>
#include <memory>
@@ -90,6 +91,27 @@ inline double nan() { return std::numeric_limits<double>::quiet_NaN(); }
BTS_EXPORT float fnan();
BTS_EXPORT bool is_finite(double d);
int cache_size_l3_bytes();
template<class T>
void memcpy(T* dest, const T* src, std::size_t n);
template<class T>
void memset(T* s, int c, std::size_t n);
//////////////////////////////////////////////////
// Definition
//////////////////////////////////////////////////
template<class T>
void memcpy(T* dest, const T* src, std::size_t n) {
::memcpy((void*)dest, (void*)src, n);
}
template<class T>
void memset(T* s, int c, std::size_t n) {
::memset((void*)s, c, n);
}
} // namespace os
} // namespace bts
+1
View File
@@ -15,6 +15,7 @@
#include <boost/filesystem.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <fmt/format.h>
#include <fstream>
#include <mutex>
#include <pthread.h>
+1
View File
@@ -13,6 +13,7 @@
#include <atomic>
#include <iostream>
#include <fstream>
#include <string>
#include <thread>
#include <utility>
+1
View File
@@ -8,6 +8,7 @@
#include <array>
#include <boost/filesystem.hpp>
#include <fmt/ostream.h>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
@@ -34,7 +34,7 @@ class FillNode {
MDP3Fill buy_aggressor;
MDP3Fill sell_aggressor;
OrderKey curr_aggressor;
OrderKey curr_aggressor{0};
std::vector<MDP3Fill> direct_passive, implied_passive;
std::uint32_t _fill_count = 0;
};
@@ -230,7 +230,7 @@ FeedHandler_Recovery::try_build_snapshot_and_reset() {
// ready to go
auto result = rt_handler.move_all_securities_and_reset();
reset();
return std::move(result);
return result;
}
// Instrument feed -------------------------------------------
@@ -212,7 +212,7 @@ static constexpr bool has_error(int events) {
}
void Reactor::do_work() {
std::array<epoll_event, 100> ev_list;
std::array<epoll_event, 100> ev_list{};
auto ready = epoll_wait(me->epoll_fd, ev_list.data(), ev_list.size(), 0);
if (ready == -1) {
if (errno == EINTR)
@@ -38,6 +38,7 @@
#include <list>
#include <memory>
#include <mutex>
#include <openssl/ssl.h>
#include <string>
#include <sys/time.h>
#include <sys/types.h>
@@ -998,4 +999,4 @@ void EmMDListener::_send_open_orders_request() const {
}
/* #endregion */
} // namespace bts::md
} // namespace bts::md
@@ -16,6 +16,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/tokenizer.hpp>
#include <map>
#include <optional>
#include <set>
#include <utility>