3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-18 09:12:18 +00:00

verilog: demote some parser errors to warnings again

This commit is contained in:
Emil J. Tywoniak 2025-08-13 10:54:47 +02:00
parent fb024c4d55
commit 910ff3ff36
3 changed files with 24 additions and 7 deletions

View file

@ -42,6 +42,15 @@ static void verr_at(std::string filename, int begin_line, char const *fmt, va_li
exit(1);
}
static void vwarn_at(std::string filename, int begin_line, char const *fmt, va_list ap)
{
char buffer[1024];
char *p = buffer;
p += vsnprintf(p, buffer + sizeof(buffer) - p, fmt, ap);
p += snprintf(p, buffer + sizeof(buffer) - p, "\n");
YOSYS_NAMESPACE_PREFIX log_file_warning(filename, begin_line, "%s", buffer);
}
[[noreturn]]
void VERILOG_FRONTEND::err_at_loc(Location loc, char const *fmt, ...)
{
@ -49,4 +58,11 @@ void VERILOG_FRONTEND::err_at_loc(Location loc, char const *fmt, ...)
va_start(args, fmt);
verr_at(loc.begin.filename ? *(loc.begin.filename) : "UNKNOWN", loc.begin.line, fmt, args);
}
void VERILOG_FRONTEND::warn_at_loc(Location loc, char const *fmt, ...)
{
va_list args;
va_start(args, fmt);
vwarn_at(loc.begin.filename ? *(loc.begin.filename) : "UNKNOWN", loc.begin.line, fmt, args);
va_end(args);
}