From bf81ab564ff801b1851a678b2e2f4d9f5a625922 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 31 Oct 2026 20:20:16 +0100 Subject: [PATCH 1/2] CBOR reader: mark the initial accepted in the scalar run as a false-positive dead store ci_infer reports DEAD_STORE for 'bool accepted = true;' in parse_cbor_scalar_run because every case assigns accepted before it is read. Signed-off-by: Niels Lohmann --- include/nlohmann/detail/input/binary_reader.hpp | 2 ++ single_include/nlohmann/json.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index 4bcd98022..190562650 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -1715,6 +1715,8 @@ class binary_reader const auto* const data = reinterpret_cast(ia.bulk_data()); const unsigned char head = data[0]; std::size_t size = 0; + // false positive: every case assigns accepted before it is read + // @infer-ignore DEAD_STORE bool accepted = true; switch (head) { diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 22022146a..80cdaf1b1 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -19491,6 +19491,8 @@ class binary_reader const auto* const data = reinterpret_cast(ia.bulk_data()); const unsigned char head = data[0]; std::size_t size = 0; + // false positive: every case assigns accepted before it is read + // @infer-ignore DEAD_STORE bool accepted = true; switch (head) { From d2436351cdee94798bed4d89a881da7804c8bb2d Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 31 Oct 2026 20:20:38 +0100 Subject: [PATCH 2/2] MessagePack reader: mark the initial accepted in the scalar run as a false-positive dead store ci_infer reports DEAD_STORE for 'bool accepted = true;' in the MessagePack scalar run, as in the CBOR one, because every case assigns accepted before it is read. Signed-off-by: Niels Lohmann --- include/nlohmann/detail/input/binary_reader.hpp | 2 ++ single_include/nlohmann/json.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index 8141bc02b..1fdda20ab 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -2657,6 +2657,8 @@ class binary_reader const auto* const data = reinterpret_cast(ia.bulk_data()); const unsigned char head = data[0]; std::size_t size = 0; + // false positive: every case assigns accepted before it is read + // @infer-ignore DEAD_STORE bool accepted = true; switch (head) { diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 4976b2e81..bd4b8aa8e 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -20434,6 +20434,8 @@ class binary_reader const auto* const data = reinterpret_cast(ia.bulk_data()); const unsigned char head = data[0]; std::size_t size = 0; + // false positive: every case assigns accepted before it is read + // @infer-ignore DEAD_STORE bool accepted = true; switch (head) {