Daniel Carvalho has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/41399 )
Change subject: base: Fix incorrect use of Logger::print
......................................................................
base: Fix incorrect use of Logger::print
Previously when a formatted message was printed in a
Logger it would use the wrong function, and thus skip
the warning triggered by ccprintf. Fix this by merging
two prints to avoid ambiguity.
Change-Id: Idc51d2ef28ab4721d2be16f3e5fce19c494a0d47
Signed-off-by: Daniel R. Carvalho <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41399
Reviewed-by: Giacomo Travaglini <[email protected]>
Maintainer: Giacomo Travaglini <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/base/logging.hh
1 file changed, 9 insertions(+), 13 deletions(-)
Approvals:
Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/base/logging.hh b/src/base/logging.hh
index 29a9563..87bca8e 100644
--- a/src/base/logging.hh
+++ b/src/base/logging.hh
@@ -90,24 +90,20 @@
virtual ~Logger() {};
- void
- print(const Loc &loc, const std::string &str)
- {
- std::stringstream ss;
- ss << prefix << str;
- if (str.length() && str.back() != '\n' && str.back() != '\r')
- ss << std::endl;
- if (!enabled)
- return;
- log(loc, ss.str());
- }
-
template<typename ...Args> void
print(const Loc &loc, const char *format, const Args &...args)
{
std::stringstream ss;
ccprintf(ss, format, args...);
- print(loc, ss.str());
+ const std::string str = ss.str();
+
+ std::stringstream ss_formatted;
+ ss_formatted << prefix << str;
+ if (str.length() && str.back() != '\n' && str.back() != '\r')
+ ss_formatted << std::endl;
+ if (!enabled)
+ return;
+ log(loc, ss_formatted.str());
}
template<typename ...Args> void
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41399
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Idc51d2ef28ab4721d2be16f3e5fce19c494a0d47
Gerrit-Change-Number: 41399
Gerrit-PatchSet: 7
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s