mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Revert "Remove undefined behavior from parse_error()."
Per my understanding this is not undefined behavior. No ABI depends on the called function reading
variadic arguments, nor does any standard require it. So if this is crashing something else must be going
on.
This reverts commit 22d22f6aa8
.
This commit is contained in:
parent
22d22f6aa8
commit
b06e798373
1 changed files with 10 additions and 17 deletions
|
@ -341,7 +341,6 @@ class parse_ll_t
|
||||||
bool top_node_handle_terminal_types(parse_token_t token);
|
bool top_node_handle_terminal_types(parse_token_t token);
|
||||||
|
|
||||||
void parse_error(const wchar_t *expected, parse_token_t token);
|
void parse_error(const wchar_t *expected, parse_token_t token);
|
||||||
void parse_error(parse_token_t token);
|
|
||||||
void parse_error(parse_token_t token, const wchar_t *format, ...);
|
void parse_error(parse_token_t token, const wchar_t *format, ...);
|
||||||
void append_error_callout(wcstring &error_message, parse_token_t token);
|
void append_error_callout(wcstring &error_message, parse_token_t token);
|
||||||
|
|
||||||
|
@ -552,25 +551,19 @@ void parse_ll_t::acquire_output(parse_node_tree_t *output, parse_error_list_t *e
|
||||||
this->symbol_stack.clear();
|
this->symbol_stack.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_ll_t::parse_error(parse_token_t token)
|
|
||||||
{
|
|
||||||
this->fatal_errored = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void parse_ll_t::parse_error(parse_token_t token, const wchar_t *fmt, ...)
|
void parse_ll_t::parse_error(parse_token_t token, const wchar_t *fmt, ...)
|
||||||
{
|
{
|
||||||
parse_error(token);
|
this->fatal_errored = true;
|
||||||
|
|
||||||
//this->dump_stack();
|
|
||||||
parse_error_t err;
|
|
||||||
|
|
||||||
va_list va;
|
|
||||||
va_start(va, fmt);
|
|
||||||
err.text = vformat_string(fmt, va);
|
|
||||||
va_end(va);
|
|
||||||
|
|
||||||
if (this->should_generate_error_messages)
|
if (this->should_generate_error_messages)
|
||||||
{
|
{
|
||||||
|
//this->dump_stack();
|
||||||
|
parse_error_t err;
|
||||||
|
|
||||||
|
va_list va;
|
||||||
|
va_start(va, fmt);
|
||||||
|
err.text = vformat_string(fmt, va);
|
||||||
|
va_end(va);
|
||||||
|
|
||||||
err.source_start = token.source_start;
|
err.source_start = token.source_start;
|
||||||
err.source_length = token.source_length;
|
err.source_length = token.source_length;
|
||||||
this->errors.push_back(err);
|
this->errors.push_back(err);
|
||||||
|
@ -737,7 +730,7 @@ void parse_ll_t::accept_tokens(parse_token_t token1, parse_token_t token2)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->parse_error(token1);
|
this->parse_error(token1, NULL);
|
||||||
}
|
}
|
||||||
// parse_error sets fatal_errored, which ends the loop
|
// parse_error sets fatal_errored, which ends the loop
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue