From f8eee1bb7953c6a4bff384d45052d5acc3d69698 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 7 Feb 2026 09:15:18 +0100 Subject: [PATCH] Annotate unreachable comment-scanner switch paths to satisfy C26819 (#5071) --- include/nlohmann/detail/input/lexer.hpp | 4 ++++ single_include/nlohmann/json.hpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index 3d63229f9..4742d889b 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -863,6 +863,8 @@ class lexer : public lexer_base break; } } + + JSON_HEDLEY_UNREACHABLE(); } // multi-line comments skip input until */ is read @@ -898,6 +900,8 @@ class lexer : public lexer_base continue; } } + + JSON_HEDLEY_UNREACHABLE(); } // unexpected character after reading '/' diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 7d68c5add..e2bb8517b 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -8055,6 +8055,8 @@ class lexer : public lexer_base break; } } + + JSON_HEDLEY_UNREACHABLE(); } // multi-line comments skip input until */ is read @@ -8090,6 +8092,8 @@ class lexer : public lexer_base continue; } } + + JSON_HEDLEY_UNREACHABLE(); } // unexpected character after reading '/'