3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-16 19:05:47 +00:00

Make AstNode::input_error use C++ stringf machinery

This commit is contained in:
Robert O'Callahan 2025-09-12 06:01:32 +00:00
parent ff5177ce8e
commit ad4ef8b775
2 changed files with 8 additions and 5 deletions

View file

@ -1922,11 +1922,9 @@ void AstModule::loadconfig() const
flag_autowire = autowire; flag_autowire = autowire;
} }
void AstNode::input_error(const char *format, ...) const void AstNode::formatted_input_error(std::string str) const
{ {
va_list ap; log_formatted_file_error(*location.begin.filename, location.begin.line, std::move(str));
va_start(ap, format);
logv_file_error(*location.begin.filename, location.begin.line, format, ap);
} }
YOSYS_NAMESPACE_END YOSYS_NAMESPACE_END

View file

@ -378,7 +378,12 @@ namespace AST
AstNode *get_struct_member() const; AstNode *get_struct_member() const;
// helper to print errors from simplify/genrtlil code // helper to print errors from simplify/genrtlil code
[[noreturn]] void input_error(const char *format, ...) const YS_ATTRIBUTE(format(printf, 2, 3)); [[noreturn]] void formatted_input_error(std::string str) const;
template <typename... Args>
[[noreturn]] void input_error(FmtString<TypeIdentity<Args>...> fmt, const Args &... args) const
{
formatted_input_error(fmt.format(args...));
}
}; };
// process an AST tree (ast must point to an AST_DESIGN node) and generate RTLIL code // process an AST tree (ast must point to an AST_DESIGN node) and generate RTLIL code