Skip to content

Commit f8eee1b

Browse files
authored
Annotate unreachable comment-scanner switch paths to satisfy C26819 (nlohmann#5071)
1 parent 21b5374 commit f8eee1b

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

include/nlohmann/detail/input/lexer.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,8 @@ class lexer : public lexer_base<BasicJsonType>
863863
break;
864864
}
865865
}
866+
867+
JSON_HEDLEY_UNREACHABLE();
866868
}
867869

868870
// multi-line comments skip input until */ is read
@@ -898,6 +900,8 @@ class lexer : public lexer_base<BasicJsonType>
898900
continue;
899901
}
900902
}
903+
904+
JSON_HEDLEY_UNREACHABLE();
901905
}
902906

903907
// unexpected character after reading '/'

single_include/nlohmann/json.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8055,6 +8055,8 @@ class lexer : public lexer_base<BasicJsonType>
80558055
break;
80568056
}
80578057
}
8058+
8059+
JSON_HEDLEY_UNREACHABLE();
80588060
}
80598061

80608062
// multi-line comments skip input until */ is read
@@ -8090,6 +8092,8 @@ class lexer : public lexer_base<BasicJsonType>
80908092
continue;
80918093
}
80928094
}
8095+
8096+
JSON_HEDLEY_UNREACHABLE();
80938097
}
80948098

80958099
// unexpected character after reading '/'

0 commit comments

Comments
 (0)