Jason Lowe-Power has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/11949 )
Change subject: misc: Appease GCC 8
......................................................................
misc: Appease GCC 8
GCC 8 adds a number of new warnings to -Wall which generate errors.
- Fix memset to 0 for structs by adding casts.
- Fix cast with const when the const was ignored.
- Fix catch a polymorphic type by value
We now compile with GCC 8!
Change-Id: Iab70ce11190eee67608fc25c0bedff170152b153
Signed-off-by: Jason Lowe-Power <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/11949
Reviewed-by: Daniel Carvalho <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
---
M src/arch/x86/decoder.hh
M src/arch/x86/types.hh
M src/base/bitunion.hh
M src/cpu/testers/traffic_gen/pygen.cc
M src/dev/storage/ide_ctrl.cc
M src/dev/storage/ide_ctrl.hh
6 files changed, 13 insertions(+), 5 deletions(-)
Approvals:
Andreas Sandberg: Looks good to me, approved
Daniel Carvalho: Looks good to me, but someone else must approve
Jason Lowe-Power: Looks good to me, approved
diff --git a/src/arch/x86/decoder.hh b/src/arch/x86/decoder.hh
index 3630ea8..c0b30b5 100644
--- a/src/arch/x86/decoder.hh
+++ b/src/arch/x86/decoder.hh
@@ -239,7 +239,7 @@
outOfBytes(true), instDone(false),
state(ResetState)
{
- memset(&emi, 0, sizeof(emi));
+ emi.reset();
mode = LongMode;
submode = SixtyFourBitMode;
emi.mode.mode = mode;
diff --git a/src/arch/x86/types.hh b/src/arch/x86/types.hh
index 6e1b1cf..f2b0646 100644
--- a/src/arch/x86/types.hh
+++ b/src/arch/x86/types.hh
@@ -199,6 +199,10 @@
//The intermediate structure used by the x86 decoder.
struct ExtMachInst
{
+ void reset() {
+ memset(static_cast<void *>(this), 0, sizeof(*this));
+ }
+
//Prefixes
LegacyPrefixVector legacy;
Rex rex;
diff --git a/src/base/bitunion.hh b/src/base/bitunion.hh
index 49a956e..1a32991 100644
--- a/src/base/bitunion.hh
+++ b/src/base/bitunion.hh
@@ -435,7 +435,7 @@
inline std::ostream &
bitfieldBackendPrinter(std::ostream &os, const char &t)
{
- os << (const int)t;
+ os << (int)t;
return os;
}
@@ -443,7 +443,7 @@
inline std::ostream &
bitfieldBackendPrinter(std::ostream &os, const unsigned char &t)
{
- os << (const unsigned int)t;
+ os << (unsigned int)t;
return os;
}
}
diff --git a/src/cpu/testers/traffic_gen/pygen.cc
b/src/cpu/testers/traffic_gen/pygen.cc
index ce1d591..9ce2fbf 100644
--- a/src/cpu/testers/traffic_gen/pygen.cc
+++ b/src/cpu/testers/traffic_gen/pygen.cc
@@ -74,7 +74,7 @@
metaGenerator->cast<std::shared_ptr<BaseGen>>();
metaGenerator++;
return gen;
- } catch (py::cast_error) {
+ } catch (py::cast_error&) {
fatal("Meta generator didn't return a valid trace generator\n");
}
}
diff --git a/src/dev/storage/ide_ctrl.cc b/src/dev/storage/ide_ctrl.cc
index d1c9f7d..12d606b 100644
--- a/src/dev/storage/ide_ctrl.cc
+++ b/src/dev/storage/ide_ctrl.cc
@@ -83,7 +83,7 @@
cmdAddr(0), cmdSize(_cmdSize), ctrlAddr(0), ctrlSize(_ctrlSize),
master(NULL), slave(NULL), selected(NULL)
{
- memset(&bmiRegs, 0, sizeof(bmiRegs));
+ bmiRegs.reset();
bmiRegs.status.dmaCap0 = 1;
bmiRegs.status.dmaCap1 = 1;
}
diff --git a/src/dev/storage/ide_ctrl.hh b/src/dev/storage/ide_ctrl.hh
index 94a9c65..24d3da0 100644
--- a/src/dev/storage/ide_ctrl.hh
+++ b/src/dev/storage/ide_ctrl.hh
@@ -81,6 +81,10 @@
/** Registers used for bus master interface */
struct BMIRegs
{
+ void reset() {
+ memset(static_cast<void *>(this), 0, sizeof(*this));
+ }
+
BMICommandReg command;
uint8_t reserved0;
BMIStatusReg status;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11949
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Iab70ce11190eee67608fc25c0bedff170152b153
Gerrit-Change-Number: 11949
Gerrit-PatchSet: 6
Gerrit-Owner: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-CC: Thawra Kadeed <[email protected]>
Gerrit-CC: Thawra Kadeed <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev