Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2aa6d67
[ML] Fix compiler warnings across the codebase
edsavage Mar 12, 2026
1edba0a
[ML] Run clang-format on compiler warning fixes
edsavage Mar 13, 2026
0f382ef
Merge remote-tracking branch 'upstream/main' into fix/compiler-warnings
edsavage Mar 13, 2026
27e3df7
[ML] Fix deprecated implicit this capture via [=] in C++20
edsavage Mar 13, 2026
5e44996
Formatting
edsavage Mar 13, 2026
fe09511
[ML] Initialise tokenTypeName to "unknown" for future-proofing
edsavage Mar 24, 2026
76a6eb1
[ML] Fix category count comparison to iterate map keys
edsavage Apr 7, 2026
2268efc
[ML] Fix high-priority compiler warnings (potential bugs)
edsavage Apr 8, 2026
505dcf2
[ML] Fix remaining [=] implicit this captures for C++20
edsavage Apr 8, 2026
43045d9
[ML] Fix implicit size_t to double conversions
edsavage Apr 8, 2026
63e3e85
[ML] Suppress MSVC C4723 in CMathsFuncsTest
edsavage Apr 8, 2026
b3bf995
[ML] Suppress Clang -Wunused-macros
edsavage Apr 8, 2026
4b7e9a5
[ML] Suppress Clang -Wunused-macros for test targets only
edsavage Apr 8, 2026
e88740a
Merge branch 'main' into fix/compiler-warnings
edsavage Jul 29, 2026
c29ff6a
[ML] Replace deprecated std::is_pod with ml::core::is_pod_v (MSVC C4996)
edsavage Jul 29, 2026
47bc55f
[ML] Suppress MSVC C4250 (dominance) for instrumentation diamond
edsavage Jul 29, 2026
b7a79e5
[ML] Suppress GCC -Wsubobject-linkage for test targets only
edsavage Jul 29, 2026
f1ff6d3
[ML] Add CResultType operator| overloads to fix deprecated enum-enum OR
edsavage Jul 29, 2026
a93378d
[ML] Suppress MSVC C4324 for intended alignas padding
edsavage Jul 29, 2026
b6536f6
[ML] Fix implicit narrowing in central-moments custom add
edsavage Jul 29, 2026
63113d7
[ML] Replace deprecated boost::json::error_code with boost::system::e…
edsavage Jul 29, 2026
57e3c4c
[ML] Compute cut size once in CBootstrapClusterer trace log
edsavage Jul 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/pytorch_inference/CCommandParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool CCommandParser::ioLoop(const TRequestHandlerFunc& requestHandler,

json::value doc;
json::stream_parser p;
json::error_code ec;
boost::system::error_code ec;
std::string line;
std::size_t n = 0;
while (true) {
Expand Down
2 changes: 1 addition & 1 deletion bin/pytorch_inference/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ int main(int argc, char** argv) {
// allocations rather than per allocation. But macOS is not supported for
// production, but just as a convenience for developers. So the most
// important thing is that the threading works as intended on Linux.
at::set_num_threads(threadSettings.numThreadsPerAllocation());
at::set_num_threads(static_cast<int>(threadSettings.numThreadsPerAllocation()));

// This is not used as we don't call at::launch anywhere.
// Setting it to 1 to ensure there is no thread pool sitting around.
Expand Down
3 changes: 3 additions & 0 deletions cmake/compiler/clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ list(APPEND ML_C_FLAGS
"-Wno-padded"
"-Wno-poison-system-directories"
"-Wno-sign-conversion"
"-Wno-missing-noreturn"
"-Wno-nrvo"
"-Wno-switch-default"
"-Wno-unknown-warning-option"
"-Wno-unreachable-code"
"-Wno-used-but-marked-unused"
Expand Down
16 changes: 16 additions & 0 deletions cmake/compiler/msvc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ list(APPEND ML_COMPILE_DEFINITIONS
_WIN32_WINNT=0x0601
Windows)

# Treat SYSTEM include directories as external — suppress warnings from
# third-party headers (Boost, Eigen, PyTorch, etc.). Requires MSVC 17.0+.
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "/external:I ")
list(APPEND ML_C_FLAGS
"/X"
"/nologo"
"/W4"
"/external:W0"
"/EHsc"
"/Gw"
"/Zc:inline"
Expand All @@ -47,7 +51,19 @@ list(APPEND ML_CXX_FLAGS
"/we4150"
"/wd4201"
"/wd4231"
# C4250 ("inherits via dominance") is a purely informational MSVC-only
# diagnostic. The instrumentation classes use a deliberate virtual-inheritance
# mixin (CDataFrameAnalysisInstrumentation supplies the shared implementation
# while the per-analysis interfaces add their own pure virtuals); the C++
# dominance rule resolves the shared methods correctly. GCC/Clang do not warn.
"/wd4250"
"/wd4251"
# C4324 ("structure was padded due to alignment specifier") is emitted for
# types that deliberately over-align members with alignas to avoid false
# sharing (e.g. the std::atomic counters in CCompressedLfuCache). The padding
# is the intended consequence of the alignment, so the diagnostic is pure
# noise here. GCC/Clang do not warn.
"/wd4324"
"/wd4355"
"/wd4512"
"/wd4702"
Expand Down
16 changes: 16 additions & 0 deletions cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,22 @@ function(ml_add_test_executable _target)

set_property(TARGET ml_test_${_target} PROPERTY POSITION_INDEPENDENT_CODE TRUE)

# Boost.Test's fixture macros generate test classes with external linkage that
# derive from fixtures defined in anonymous namespaces (internal linkage). GCC
# flags this idiomatic, benign pattern with -Wsubobject-linkage. The anonymous
# namespace is deliberate: it keeps each file's fixtures ODR-distinct within
# the monolithic per-library test binary. Silence the warning for test targets
# only, leaving it active for production code.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(ml_test_${_target} PRIVATE "-Wno-subobject-linkage")
endif()

# Boost.Test's BOOST_TEST_MODULE / BOOST_TEST_NO_MAIN macros are consumed
# by the subsequent #include <boost/test/unit_test.hpp> but Clang flags
# them as unused. Suppress for test targets only.
target_compile_options(ml_test_${_target} PRIVATE
$<$<CXX_COMPILER_ID:AppleClang,Clang>:-Wno-unused-macros>)

if(ML_PCH)
target_precompile_headers(ml_test_${_target} PRIVATE
<string>
Expand Down
6 changes: 3 additions & 3 deletions include/api/CSerializableToJson.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class API_EXPORT CSerializableFromCompressedChunkedJson {
TIStreamPtr inputStream,
std::iostream& buffer);

static void assertNoParseError(const json::error_code& ec) {
static void assertNoParseError(const boost::system::error_code& ec) {
if (ec) {
throw std::runtime_error{"Error parsing JSON: " + ec.message()};
}
Expand Down Expand Up @@ -178,7 +178,7 @@ class API_EXPORT CSerializableFromCompressedChunkedJson {
}

static std::int64_t getAsInt64From(const json::value& value) {
json::error_code ec;
boost::system::error_code ec;
std::int64_t ret = value.to_number<std::int64_t>(ec);
if (ec) {
throw std::runtime_error{"is not a int64"};
Expand All @@ -187,7 +187,7 @@ class API_EXPORT CSerializableFromCompressedChunkedJson {
}

static std::uint64_t getAsUint64From(const json::value& value) {
json::error_code ec;
boost::system::error_code ec;
std::uint64_t ret = value.to_number<std::uint64_t>(ec);
if (ec) {
throw std::runtime_error{"is not a uint64"};
Expand Down
10 changes: 5 additions & 5 deletions include/core/CBoostJsonParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CORE_EXPORT CBoostJsonParser {
static bool parse(const std::string& jsonString, json::value& doc) {
unsigned char buffer[JSON_PARSE_BUFFER_SIZE]; // Small stack buffer to avoid most allocations during parse
json::monotonic_resource mr(buffer); // This resource will use our local buffer first
json::error_code ec;
boost::system::error_code ec;
doc = json::parse(jsonString, ec, &mr);
if (ec) {
LOG_ERROR(<< "An error occurred while parsing JSON: \""
Expand All @@ -50,14 +50,14 @@ class CORE_EXPORT CBoostJsonParser {
return true;
}

static json::error_code parse(std::istream& istream, json::value& doc) {
static boost::system::error_code parse(std::istream& istream, json::value& doc) {
json::stream_parser p;

unsigned char buf[JSON_PARSE_BUFFER_SIZE]; // Now we need a buffer to hold the actual JSON values
json::monotonic_resource mr(buf); // The static resource is monotonic, using only a caller-provided buffer
p.reset(&mr); // Use the static resource for producing the value

json::error_code ec;
boost::system::error_code ec;
std::string line;
while (std::getline(istream, line)) {
LOG_TRACE(<< "write_some: " << line);
Expand All @@ -70,14 +70,14 @@ class CORE_EXPORT CBoostJsonParser {
return ec;
}

static json::error_code parse(char* begin, std::size_t length, json::value& doc) {
static boost::system::error_code parse(char* begin, std::size_t length, json::value& doc) {
json::stream_parser p;

unsigned char buf[JSON_PARSE_BUFFER_SIZE]; // Now we need a buffer to hold the actual JSON values
json::monotonic_resource mr(buf); // The static resource is monotonic, using only a caller-provided buffer
p.reset(&mr); // Use the static resource for producing the value

json::error_code ec;
boost::system::error_code ec;
std::size_t written{0};
p.reset();
while (written < length) {
Expand Down
2 changes: 1 addition & 1 deletion include/core/CConcurrentWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CConcurrentWrapper final : private CNonCopyable {
//! The code inside of this lambda is guaranteed to be executed in an atomic fashion.
template<typename F>
void operator()(F f) const {
m_Queue.push([=] { f(m_Resource); });
m_Queue.push([this, f] { f(m_Resource); });
}

//! Debug the memory used by this component.
Expand Down
38 changes: 20 additions & 18 deletions include/core/CJsonStateRestoreTraverser.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,44 +130,46 @@ class CORE_EXPORT CJsonStateRestoreTraverser : public CStateRestoreTraverser {
//! @return `true` on success.
//! @param ec Set to the error, if any occurred.
//!
bool on_document_begin(json::error_code& ec);
bool on_document_begin(boost::system::error_code& ec);

//! Called when the JSON parsing is done.
//!
//! @return `true` on success.
//! @param ec Set to the error, if any occurred.
//!
bool on_document_end(json::error_code& ec) { return ec ? false : true; }
bool on_document_end(boost::system::error_code& ec) {
return ec ? false : true;
}

//! Called when the beginning of an array is encountered.
//!
//! @return `true` on success.
//! @param ec Set to the error, if any occurred.
//!
bool on_array_begin(json::error_code& ec);
bool on_array_begin(boost::system::error_code& ec);

//! Called when the end of the current array is encountered.
//!
//! @return `true` on success.
//! @param n The number of elements in the array.
//! @param ec Set to the error, if any occurred.
//!
bool on_array_end(std::size_t n, json::error_code& ec);
bool on_array_end(std::size_t n, boost::system::error_code& ec);

//! Called when the beginning of an object is encountered.
//!
//! @return `true` on success.
//! @param ec Set to the error, if any occurred.
//!
bool on_object_begin(json::error_code& ec);
bool on_object_begin(boost::system::error_code& ec);

//! Called when the end of the current object is encountered.
//!
//! @return `true` on success.
//! @param n The number of elements in the object.
//! @param ec Set to the error, if any occurred.
//!
bool on_object_end(std::size_t n, json::error_code& ec);
bool on_object_end(std::size_t n, boost::system::error_code& ec);

//! Called with characters corresponding to part of the current string.
//!
Expand All @@ -176,7 +178,7 @@ class CORE_EXPORT CJsonStateRestoreTraverser : public CStateRestoreTraverser {
//! @param n The total size of the string thus far
//! @param ec Set to the error, if any occurred.
//!
bool on_string_part(std::string_view s, std::size_t n, json::error_code& ec);
bool on_string_part(std::string_view s, std::size_t n, boost::system::error_code& ec);

//! Called with the last characters corresponding to the current string.
//!
Expand All @@ -185,7 +187,7 @@ class CORE_EXPORT CJsonStateRestoreTraverser : public CStateRestoreTraverser {
//! @param n The total size of the string
//! @param ec Set to the error, if any occurred.
//!
bool on_string(std::string_view s, std::size_t n, json::error_code& ec);
bool on_string(std::string_view s, std::size_t n, boost::system::error_code& ec);

//! Called with characters corresponding to part of the current key.
//!
Expand All @@ -194,7 +196,7 @@ class CORE_EXPORT CJsonStateRestoreTraverser : public CStateRestoreTraverser {
//! @param n The total size of the key thus far
//! @param ec Set to the error, if any occurred.
//!
bool on_key_part(std::string_view s, std::size_t n, json::error_code& ec);
bool on_key_part(std::string_view s, std::size_t n, boost::system::error_code& ec);

//! Called with the last characters corresponding to the current key.
//!
Expand All @@ -203,15 +205,15 @@ class CORE_EXPORT CJsonStateRestoreTraverser : public CStateRestoreTraverser {
//! @param n The total size of the key
//! @param ec Set to the error, if any occurred.
//!
bool on_key(std::string_view s, std::size_t n, json::error_code& ec);
bool on_key(std::string_view s, std::size_t n, boost::system::error_code& ec);

//! Called with the characters corresponding to part of the current number.
//!
//! @return `true` on success.
//! @param s The partial characters
//! @param ec Set to the error, if any occurred.
//!
bool on_number_part(std::string_view s, json::error_code& ec);
bool on_number_part(std::string_view s, boost::system::error_code& ec);

//! Called when a signed integer is parsed.
//!
Expand All @@ -220,7 +222,7 @@ class CORE_EXPORT CJsonStateRestoreTraverser : public CStateRestoreTraverser {
//! @param s The remaining characters
//! @param ec Set to the error, if any occurred.
//!
bool on_int64(int64_t i, std::string_view s, json::error_code& ec);
bool on_int64(int64_t i, std::string_view s, boost::system::error_code& ec);

//! Called when an unsigend integer is parsed.
//!
Expand All @@ -229,7 +231,7 @@ class CORE_EXPORT CJsonStateRestoreTraverser : public CStateRestoreTraverser {
//! @param s The remaining characters
//! @param ec Set to the error, if any occurred.
//!
bool on_uint64(uint64_t u, std::string_view s, json::error_code& ec);
bool on_uint64(uint64_t u, std::string_view s, boost::system::error_code& ec);

//! Called when a double is parsed.
//!
Expand All @@ -238,38 +240,38 @@ class CORE_EXPORT CJsonStateRestoreTraverser : public CStateRestoreTraverser {
//! @param s The remaining characters
//! @param ec Set to the error, if any occurred.
//!
bool on_double(double d, std::string_view s, json::error_code& ec);
bool on_double(double d, std::string_view s, boost::system::error_code& ec);

//! Called when a boolean is parsed.
//!
//! @return `true` on success.
//! @param b The value
//! @param ec Set to the error, if any occurred.
//!
bool on_bool(bool b, json::error_code& ec);
bool on_bool(bool b, boost::system::error_code& ec);

//! Called when a null is parsed.
//!
//! @return `true` on success.
//! @param ec Set to the error, if any occurred.
//!
bool on_null(json::error_code& ec);
bool on_null(boost::system::error_code& ec);

//! Called with characters corresponding to part of the current comment.
//!
//! @return `true` on success.
//! @param s The partial characters.
//! @param ec Set to the error, if any occurred.
//!
bool on_comment_part(std::string_view s, json::error_code& ec);
bool on_comment_part(std::string_view s, boost::system::error_code& ec);

//! Called with the last characters corresponding to the current comment.
//!
//! @return `true` on success.
//! @param s The remaining characters
//! @param ec Set to the error, if any occurred.
//!
bool on_comment(std::string_view s, json::error_code& ec);
bool on_comment(std::string_view s, boost::system::error_code& ec);

enum ETokenType {
E_TokenNull = 0,
Expand Down
14 changes: 13 additions & 1 deletion include/core/CMemoryFwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,23 @@

namespace ml {
namespace core {

//! C++20-safe replacement for the deprecated \c std::is_pod / \c std::is_pod_v.
//!
//! \c std::is_pod was deprecated in C++20. The standard defines a POD type as
//! one that is both trivial and standard-layout, so this reproduces
//! \c std::is_pod_v exactly - verified equivalent across fundamentals, cv- and
//! pointer-qualified types, arrays, enums, unions, aggregates, inheritance
//! (standard-layout) edge cases and library types - without emitting the
//! deprecation warning (MSVC C4996 / \c -Wdeprecated-declarations).
template<typename T>
inline constexpr bool is_pod_v = std::is_trivial_v<T>&& std::is_standard_layout_v<T>;

namespace memory_detail {
//! \brief Base implementation checks for POD.
template<typename T, typename = void>
struct SDynamicSizeAlwaysZero {
static constexpr inline bool value() { return std::is_pod<T>::value; }
static constexpr inline bool value() { return is_pod_v<T>; }
};

//! \brief Checks types in pair.
Expand Down
Loading