3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-30 13:19:05 +00:00

pyosys: restore remaining log functions

Co-authored-by: George Rennie <19538554+georgerennie@users.noreply.github.com>
This commit is contained in:
Mohamed Gaber 2025-09-15 17:02:11 +03:00 committed by Lofty
parent 9fa27dae3c
commit 1fa5ceee8c
2 changed files with 12 additions and 2 deletions

View file

@ -153,6 +153,11 @@ inline void log_warning(FmtString<TypeIdentity<Args>...> fmt, const Args &... ar
{
log_formatted_warning("Warning: ", fmt.format(args...));
}
inline void log_formatted_warning_noprefix(std::string str)
{
log_formatted_warning("", str);
}
template <typename... Args>
inline void log_warning_noprefix(FmtString<TypeIdentity<Args>...> fmt, const Args &... args)
{

View file

@ -632,12 +632,17 @@ class Attribute:
arg.wtype.attr_type = attr_types.amp
arg.varname = arg.varname[1:]
# special exception: format strings
# handle string views
if arg.wtype.name in ["std::string_view", "string_view"]:
if arg.varname == "format":
if arg.varname == "format" and owner_fn_name.startswith("log_"):
# coerce format strings to "%s" (not bridgable)
arg.coerce_arg = '"%s"'
elif arg.varname == "prefix" and "warning" in owner_fn_name:
# coerce warning prefix to "warning:"
arg.coerce_arg = '"Warning: "'
else:
# boost::python can't bridge string views, so just copy them
arg.wtype.name = "string"
return arg