From 6fb603038290dd617055ac1206fcc4ab5ee95e2c Mon Sep 17 00:00:00 2001 From: Matt Koscumb Date: Fri, 31 Jan 2025 14:21:19 -0800 Subject: [PATCH] Suppress C4866 in PayloadDecoder and JsonFormatter's usage of json.hpp --- lib/decoder/PayloadDecoder.cpp | 9 +++++++++ lib/system/JsonFormatter.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/decoder/PayloadDecoder.cpp b/lib/decoder/PayloadDecoder.cpp index 70456a77a..0399a66e7 100644 --- a/lib/decoder/PayloadDecoder.cpp +++ b/lib/decoder/PayloadDecoder.cpp @@ -130,6 +130,12 @@ namespace clienttelemetry { return true; } +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4866) +// In C++17 left-to-right evaluation order for operands of operator[] is not guaranteed when the argument's copy constructor is run. +// Evalutation order isn't not relied upon here, disabling warning. +#endif // _MSC_VER void to_json(json& j, const Data& d) { for (const auto &kv : d.properties) @@ -230,6 +236,9 @@ namespace clienttelemetry { } } } +#ifdef _MSC_VER +#pragma warning( pop ) +#endif // _MSC_VER void to_json(json& j, const Record& r) { diff --git a/lib/system/JsonFormatter.cpp b/lib/system/JsonFormatter.cpp index c1eaa5973..0cff3a7a8 100644 --- a/lib/system/JsonFormatter.cpp +++ b/lib/system/JsonFormatter.cpp @@ -40,6 +40,12 @@ namespace MAT_NS_BEGIN } } +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4866 ) +// In C++17 left-to-right evaluation order for operands of operator[] is not guaranteed when the argument's copy constructor is run. +// Evalutation order isn't not relied upon here, disabling warning. +#endif // _MSC_VER void addData(json& object, std::vector<::CsProtocol::Data>& data) { std::vector<::CsProtocol::Data>::const_iterator it; @@ -126,6 +132,9 @@ namespace MAT_NS_BEGIN } } } +#ifdef _MSC_VER +#pragma warning( pop ) +#endif // _MSC_VER std::string JsonFormatter::getJsonFormattedEvent(IncomingEventContextPtr const& event) {