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 <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/11949
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
outOfBytes(true), instDone(false),
state(ResetState)
{
- memset(&emi, 0, sizeof(emi));
+ emi.reset();
mode = LongMode;
submode = SixtyFourBitMode;
emi.mode.mode = mode;
//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;
inline std::ostream &
bitfieldBackendPrinter(std::ostream &os, const char &t)
{
- os << (const int)t;
+ os << (int)t;
return os;
}
inline std::ostream &
bitfieldBackendPrinter(std::ostream &os, const unsigned char &t)
{
- os << (const unsigned int)t;
+ os << (unsigned int)t;
return os;
}
}
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");
}
}
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;
}
/** 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;