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

Remove superfluous/wasteful .c_str()s in log_file_warning() filename parameter

This commit is contained in:
Robert O'Callahan 2025-07-22 04:01:02 +00:00
parent fa90e2503e
commit 9023b97e41

View file

@ -124,7 +124,7 @@ static bool is_hex_dig(char c, int *val)
*val = c - 'A' + 0xA; *val = c - 'A' + 0xA;
return true; return true;
} else if (c == 'x' || c == 'X' || c == 'z' || c == 'Z' || c == '?') { } else if (c == 'x' || c == 'X' || c == 'z' || c == 'Z' || c == '?') {
log_file_warning(AST::current_filename.c_str(), frontend_verilog_yyget_lineno(), "'%c' not a valid digit in hex escape sequence.\n", c); log_file_warning(AST::current_filename, frontend_verilog_yyget_lineno(), "'%c' not a valid digit in hex escape sequence.\n", c);
*val = 0; // not semantically valid in hex escape... *val = 0; // not semantically valid in hex escape...
return true; // ...but still processed as part of hex token return true; // ...but still processed as part of hex token
} }
@ -138,7 +138,7 @@ static bool is_oct_dig(char c, int *val)
*val = c - '0'; *val = c - '0';
return true; return true;
} else if (c == 'x' || c == 'X' || c == 'z' || c == 'Z' || c == '?') { } else if (c == 'x' || c == 'X' || c == 'z' || c == 'Z' || c == '?') {
log_file_warning(AST::current_filename.c_str(), frontend_verilog_yyget_lineno(), "'%c' not a valid digit in octal escape sequence.\n", c); log_file_warning(AST::current_filename, frontend_verilog_yyget_lineno(), "'%c' not a valid digit in octal escape sequence.\n", c);
*val = 0; // not semantically valid in octal escape... *val = 0; // not semantically valid in octal escape...
return true; // ...but still processed as part of octal token return true; // ...but still processed as part of octal token
} }
@ -158,7 +158,7 @@ static std::string *process_str(char *str, int len, bool triple)
if (in + 1 < str + len && (in[1] ^ *in) == ('\n' ^ '\r')) if (in + 1 < str + len && (in[1] ^ *in) == ('\n' ^ '\r'))
in++; in++;
if (!triple) if (!triple)
log_file_warning(AST::current_filename.c_str(), frontend_verilog_yyget_lineno(), "Multi-line string literals should be triple-quoted or escaped.\n"); log_file_warning(AST::current_filename, frontend_verilog_yyget_lineno(), "Multi-line string literals should be triple-quoted or escaped.\n");
*out++ = '\n'; *out++ = '\n';
break; break;
case '\\': case '\\':
@ -195,7 +195,7 @@ static std::string *process_str(char *str, int len, bool triple)
} }
out++; out++;
} else } else
log_file_warning(AST::current_filename.c_str(), frontend_verilog_yyget_lineno(), "ignoring invalid hex escape.\n"); log_file_warning(AST::current_filename, frontend_verilog_yyget_lineno(), "ignoring invalid hex escape.\n");
break; break;
case '\\': case '\\':
*out++ = '\\'; *out++ = '\\';
@ -218,7 +218,7 @@ static std::string *process_str(char *str, int len, bool triple)
in++; in++;
if (in + 1 < str + len && is_oct_dig(in[1], &val)) { if (in + 1 < str + len && is_oct_dig(in[1], &val)) {
if (*out >= 040) if (*out >= 040)
log_file_warning(AST::current_filename.c_str(), frontend_verilog_yyget_lineno(), "octal escape exceeds \\377\n"); log_file_warning(AST::current_filename, frontend_verilog_yyget_lineno(), "octal escape exceeds \\377\n");
*out = *out * 010 + val; *out = *out * 010 + val;
in++; in++;
} }