Skip to content

Commit f840e3a

Browse files
author
ochafik
committed
fix unreachable code warning after [[noreturn]] annotation
1 parent e0202b3 commit f840e3a

File tree

2 files changed

+0
-8
lines changed

2 files changed

+0
-8
lines changed

common/chat-parser.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ std::optional<common_chat_msg_parser::find_regex_result> common_chat_msg_parser:
161161
}
162162
if (m.type == COMMON_REGEX_MATCH_TYPE_PARTIAL) {
163163
incomplete(regex.str());
164-
return std::nullopt;
165164
}
166165
auto prelude = input_.substr(pos_, m.groups[0].begin - pos_);
167166
pos_ = m.groups[0].end;
@@ -174,7 +173,6 @@ common_chat_msg_parser::consume_regex_result common_chat_msg_parser::consume_reg
174173
return *result;
175174
}
176175
incomplete("Failed to consume regex: " + regex.str());
177-
return {};
178176
}
179177

180178
std::optional<common_chat_msg_parser::consume_regex_result> common_chat_msg_parser::try_consume_regex(const common_regex & regex) {
@@ -184,7 +182,6 @@ std::optional<common_chat_msg_parser::consume_regex_result> common_chat_msg_pars
184182
}
185183
if (m.type == COMMON_REGEX_MATCH_TYPE_PARTIAL) {
186184
incomplete(regex.str());
187-
return std::nullopt;
188185
}
189186
if (m.groups[0].begin != pos_) {
190187
// Didn't match at the current position.
@@ -203,7 +200,6 @@ common_json common_chat_msg_parser::consume_json(
203200
return *result;
204201
}
205202
incomplete("Failed to consume JSON");
206-
return {};
207203
}
208204

209205
std::optional<common_json> common_chat_msg_parser::try_consume_json(
@@ -222,7 +218,6 @@ std::optional<common_json> common_chat_msg_parser::try_consume_json(
222218
}
223219
if (!is_partial()) {
224220
incomplete("JSON is incomplete");
225-
return std::nullopt; // Actually unreachable
226221
}
227222

228223
LOG_DBG("Parsed partial JSON: %s (json_healing_marker: %s)\n", result.json.dump().c_str(), result.healing_marker.json_dump_marker.c_str());

common/chat.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,6 @@ static void parse_json_tool_calls(
609609
return;
610610
}
611611
builder.incomplete("incomplete tool call");
612-
return;
613612
}
614613
break;
615614
}
@@ -1510,7 +1509,6 @@ static void common_chat_parse_hermes_2_pro(common_chat_msg_parser & builder) {
15101509
if (auto partial = builder.try_consume_json({{"arguments"}})) {
15111510
if (!builder.add_tool_call(partial->json, partial->healing_marker)) {
15121511
builder.incomplete("incomplete tool call");
1513-
return;
15141512
}
15151513
builder.consume_spaces();
15161514
builder.consume_literal(close_tag);
@@ -1537,7 +1535,6 @@ static void common_chat_parse_hermes_2_pro(common_chat_msg_parser & builder) {
15371535
std::string arguments = partial->json.dump();
15381536
if (!builder.add_tool_call(function_name, "", arguments, partial->healing_marker)) {
15391537
builder.incomplete("incomplete tool call");
1540-
return;
15411538
}
15421539
builder.consume_spaces();
15431540
builder.consume_literal(close_tag);

0 commit comments

Comments
 (0)