From de84ef8476825e8e1ac6631ab1d86a9d7b83ffa4 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 20 Nov 2025 12:59:14 +0100 Subject: [PATCH 1/3] Include what you use in Algorithm --- Algorithm/include/Algorithm/BitstreamReader.h | 2 ++ Algorithm/include/Algorithm/FlattenRestore.h | 1 + Algorithm/include/Algorithm/PageParser.h | 2 ++ Algorithm/test/StaticSequenceAllocator.h | 2 ++ Algorithm/test/o2formatparser.cxx | 1 + Algorithm/test/pageparser.cxx | 2 ++ Algorithm/test/test_BitstreamReader.cxx | 1 + Algorithm/test/test_FlattenRestore.cxx | 1 + Algorithm/test/test_RangeTokenizer.cxx | 2 ++ Algorithm/test/test_mpl_tools.cxx | 5 +++-- 10 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Algorithm/include/Algorithm/BitstreamReader.h b/Algorithm/include/Algorithm/BitstreamReader.h index 0a112183ab5ef..66ea3d2ce06ad 100644 --- a/Algorithm/include/Algorithm/BitstreamReader.h +++ b/Algorithm/include/Algorithm/BitstreamReader.h @@ -19,6 +19,8 @@ #include #include +#include +#include namespace o2 { diff --git a/Algorithm/include/Algorithm/FlattenRestore.h b/Algorithm/include/Algorithm/FlattenRestore.h index a039a897a191c..a179e66eed1e3 100644 --- a/Algorithm/include/Algorithm/FlattenRestore.h +++ b/Algorithm/include/Algorithm/FlattenRestore.h @@ -18,6 +18,7 @@ /// @brief Utilities to copy complex objects to flat buffer and restore #include +#include namespace o2::algorithm { diff --git a/Algorithm/include/Algorithm/PageParser.h b/Algorithm/include/Algorithm/PageParser.h index 3ca01d87bcba3..739ff0c29ffef 100644 --- a/Algorithm/include/Algorithm/PageParser.h +++ b/Algorithm/include/Algorithm/PageParser.h @@ -22,6 +22,8 @@ #include #include #include +#include +#include namespace o2 { diff --git a/Algorithm/test/StaticSequenceAllocator.h b/Algorithm/test/StaticSequenceAllocator.h index 8a684159afdb9..53acd6fa4b3e1 100644 --- a/Algorithm/test/StaticSequenceAllocator.h +++ b/Algorithm/test/StaticSequenceAllocator.h @@ -14,6 +14,8 @@ /// @since 2017-09-21 /// @brief An allocator for static sequences of object types +#include + namespace o2 { namespace algorithm diff --git a/Algorithm/test/o2formatparser.cxx b/Algorithm/test/o2formatparser.cxx index 2896631ebc5b8..7af518622dd56 100644 --- a/Algorithm/test/o2formatparser.cxx +++ b/Algorithm/test/o2formatparser.cxx @@ -21,6 +21,7 @@ #include #include #include // memcmp +#include #include "Headers/DataHeader.h" // hexdump, DataHeader #include "../include/Algorithm/O2FormatParser.h" diff --git a/Algorithm/test/pageparser.cxx b/Algorithm/test/pageparser.cxx index 7551c32d9d864..e1536f03348af 100644 --- a/Algorithm/test/pageparser.cxx +++ b/Algorithm/test/pageparser.cxx @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include "Headers/DataHeader.h" // hexdump #include "../include/Algorithm/PageParser.h" #include "StaticSequenceAllocator.h" diff --git a/Algorithm/test/test_BitstreamReader.cxx b/Algorithm/test/test_BitstreamReader.cxx index 41e3b47f5f276..0fcec20fa6797 100644 --- a/Algorithm/test/test_BitstreamReader.cxx +++ b/Algorithm/test/test_BitstreamReader.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include "../include/Algorithm/BitstreamReader.h" namespace o2 diff --git a/Algorithm/test/test_FlattenRestore.cxx b/Algorithm/test/test_FlattenRestore.cxx index 98f5f30393e41..63f5ee0a6d4f2 100644 --- a/Algorithm/test/test_FlattenRestore.cxx +++ b/Algorithm/test/test_FlattenRestore.cxx @@ -21,6 +21,7 @@ #include "../include/Algorithm/FlattenRestore.h" #include #include +#include namespace flatten = o2::algorithm::flatten; diff --git a/Algorithm/test/test_RangeTokenizer.cxx b/Algorithm/test/test_RangeTokenizer.cxx index 2583b52159b5f..d3515fdf25262 100644 --- a/Algorithm/test/test_RangeTokenizer.cxx +++ b/Algorithm/test/test_RangeTokenizer.cxx @@ -21,6 +21,8 @@ #include "../include/Algorithm/RangeTokenizer.h" #include #include +#include +#include using RangeTokenizer = o2::RangeTokenizer; diff --git a/Algorithm/test/test_mpl_tools.cxx b/Algorithm/test/test_mpl_tools.cxx index e3f1b640b7ca1..c9a7556b3e10b 100644 --- a/Algorithm/test/test_mpl_tools.cxx +++ b/Algorithm/test/test_mpl_tools.cxx @@ -33,6 +33,7 @@ #include #include #include +#include // FIXME: mpl/string.hpp required to be included to avoid compilation error // error: no matching function for call to ‘assertion_failed ...' in the mpl::for_each @@ -42,7 +43,7 @@ namespace bmpl = boost::mpl; // defining a list of known data types -using knowntypes = bmpl::vector; +using knowntypes = bmpl::vector; // get the index of an element in a type sequence template @@ -132,7 +133,7 @@ struct checktype { BOOST_AUTO_TEST_CASE(test_mpl_fold) { - using types = bmpl::vector; + using types = bmpl::vector; std::cout << std::endl << "checking types:" << std::endl; bmpl::for_each(checktype()); From d269b5ac14945e3b6f2053e13047cfe60d4a06ad Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 20 Nov 2025 12:59:35 +0100 Subject: [PATCH 2/3] Add missing explicit statement --- Algorithm/test/StaticSequenceAllocator.h | 2 +- Algorithm/test/pageparser.cxx | 2 +- Algorithm/test/parser.cxx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Algorithm/test/StaticSequenceAllocator.h b/Algorithm/test/StaticSequenceAllocator.h index 53acd6fa4b3e1..530293e7bb8cd 100644 --- a/Algorithm/test/StaticSequenceAllocator.h +++ b/Algorithm/test/StaticSequenceAllocator.h @@ -147,7 +147,7 @@ struct StaticSequenceAllocator { StaticSequenceAllocator() = delete; template - StaticSequenceAllocator(Targs... args) + explicit StaticSequenceAllocator(Targs... args) { bufferSize = sequenceLength(args...); buffer = std::make_unique(bufferSize); diff --git a/Algorithm/test/pageparser.cxx b/Algorithm/test/pageparser.cxx index e1536f03348af..c7ef5af13aa11 100644 --- a/Algorithm/test/pageparser.cxx +++ b/Algorithm/test/pageparser.cxx @@ -31,7 +31,7 @@ struct PageHeader { uint32_t magic = 0x45474150; uint32_t pageid; - PageHeader(uint32_t id) : pageid(id) {} + explicit PageHeader(uint32_t id) : pageid(id) {} }; struct ClusterData { diff --git a/Algorithm/test/parser.cxx b/Algorithm/test/parser.cxx index 0f31df99ca825..babb53cc4b6ad 100644 --- a/Algorithm/test/parser.cxx +++ b/Algorithm/test/parser.cxx @@ -29,7 +29,7 @@ struct Header { unsigned identifier = 0xdeadbeef; size_t payloadSize = 0; - Header(size_t ps) : payloadSize(ps) {} + explicit Header(size_t ps) : payloadSize(ps) {} }; // trailer test class @@ -37,7 +37,7 @@ struct Trailer { unsigned identifier = 0xaaffee00; unsigned char flags = 0xaa; - Trailer(unsigned char f) : flags(f) {} + explicit Trailer(unsigned char f) : flags(f) {} }; // trailer test class including payload size From 5d475fdbb2b423ba1a6d02bbd2ad5a4ef23018fc Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 20 Nov 2025 12:59:49 +0100 Subject: [PATCH 3/3] Use reentrant rand_r --- Algorithm/test/test_FlattenRestore.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Algorithm/test/test_FlattenRestore.cxx b/Algorithm/test/test_FlattenRestore.cxx index 63f5ee0a6d4f2..efaad60823cb1 100644 --- a/Algorithm/test/test_FlattenRestore.cxx +++ b/Algorithm/test/test_FlattenRestore.cxx @@ -36,13 +36,14 @@ struct DataAccess { } // namespace o2::test BOOST_AUTO_TEST_CASE(test_flattenrestore) { - o2::test::DataAccess access{static_cast(rand() % 32)}; + unsigned int seed = 1; + o2::test::DataAccess access{static_cast(rand_r(&seed) % 32)}; std::vector chars(access.count); - std::generate(chars.begin(), chars.end(), []() { return rand() % 256; }); + std::generate(chars.begin(), chars.end(), [&seed]() { return rand_r(&seed) % 256; }); std::vector ints(access.count); - std::generate(ints.begin(), ints.end(), []() { return rand() % 256; }); + std::generate(ints.begin(), ints.end(), [&seed]() { return rand_r(&seed) % 256; }); std::vector floats(access.count); - std::generate(floats.begin(), floats.end(), []() { return rand() % 256; }); + std::generate(floats.begin(), floats.end(), [&seed]() { return rand_r(&seed) % 256; }); access.chars = chars.data(); access.ints = ints.data(); access.floats = floats.data();