changeset b1bc989611da in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=b1bc989611da
description:
misc: Restore ostream flags where needed
This patch ensures we adhere to the normal ostream usage rules, and
restore the flags after modifying them.
diffstat:
src/base/cprintf_formats.hh | 8 ++++++++
src/sim/system.cc | 4 ++++
2 files changed, 12 insertions(+), 0 deletions(-)
diffs (59 lines):
diff -r 1813597a92ec -r b1bc989611da src/base/cprintf_formats.hh
--- a/src/base/cprintf_formats.hh Fri Sep 19 10:35:08 2014 -0400
+++ b/src/base/cprintf_formats.hh Fri Sep 19 10:35:09 2014 -0400
@@ -88,6 +88,8 @@
{
using namespace std;
+ ios::fmtflags flags(out.flags());
+
switch (fmt.base) {
case Format::hex:
out.setf(std::ios::hex, std::ios::basefield);
@@ -137,6 +139,8 @@
out.setf(std::ios::uppercase);
out << data;
+
+ out.flags(flags);
}
template <typename T>
@@ -145,6 +149,8 @@
{
using namespace std;
+ ios::fmtflags flags(out.flags());
+
switch (fmt.float_format) {
case Format::scientific:
if (fmt.precision != -1) {
@@ -189,6 +195,8 @@
}
out << data;
+
+ out.flags(flags);
}
template <typename T>
diff -r 1813597a92ec -r b1bc989611da src/sim/system.cc
--- a/src/sim/system.cc Fri Sep 19 10:35:08 2014 -0400
+++ b/src/sim/system.cc Fri Sep 19 10:35:09 2014 -0400
@@ -418,12 +418,16 @@
void
System::printSystems()
{
+ ios::fmtflags flags(cerr.flags());
+
vector<System *>::iterator i = systemList.begin();
vector<System *>::iterator end = systemList.end();
for (; i != end; ++i) {
System *sys = *i;
cerr << "System " << sys->name() << ": " << hex << sys << endl;
}
+
+ cerr.flags(flags);
}
void
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev