mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 17:15:33 +00:00
ast: Move to a new helper method to print input errors
It's a repeating pattern to print an error message tied to an AST node. Start using an 'input_error' helper for that. Among other things this is beneficial in shortening the print lines, which tend to be long.
This commit is contained in:
parent
1ac1b2eed5
commit
77d4b5230e
6 changed files with 204 additions and 195 deletions
|
@ -378,14 +378,20 @@ void logv_error(const char *format, va_list ap)
|
|||
logv_error_with_prefix("ERROR: ", format, ap);
|
||||
}
|
||||
|
||||
void logv_file_error(const string &filename, int lineno,
|
||||
const char *format, va_list ap)
|
||||
{
|
||||
std::string prefix = stringf("%s:%d: ERROR: ",
|
||||
filename.c_str(), lineno);
|
||||
logv_error_with_prefix(prefix.c_str(), format, ap);
|
||||
}
|
||||
|
||||
void log_file_error(const string &filename, int lineno,
|
||||
const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
std::string prefix = stringf("%s:%d: ERROR: ",
|
||||
filename.c_str(), lineno);
|
||||
logv_error_with_prefix(prefix.c_str(), format, ap);
|
||||
logv_file_error(filename, lineno, format, ap);
|
||||
}
|
||||
|
||||
void log(const char *format, ...)
|
||||
|
|
|
@ -124,6 +124,7 @@ void logv_header(RTLIL::Design *design, const char *format, va_list ap);
|
|||
void logv_warning(const char *format, va_list ap);
|
||||
void logv_warning_noprefix(const char *format, va_list ap);
|
||||
[[noreturn]] void logv_error(const char *format, va_list ap);
|
||||
[[noreturn]] void logv_file_error(const string &filename, int lineno, const char *format, va_list ap);
|
||||
|
||||
void log(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
|
||||
void log_header(RTLIL::Design *design, const char *format, ...) YS_ATTRIBUTE(format(printf, 2, 3));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue