From b9a9d99b226768dc972f0c40488f332066396e69 Mon Sep 17 00:00:00 2001 From: Mitch Hayenga Date: Fri, 7 Mar 2014 15:56:23 -0500 Subject: [PATCH] scons: Fixes uninitialized warnings issued by clang Small fixes to appease recent clang versions. --- src/arch/arm/insts/fplib.cc | 4 ++-- src/base/compiler.hh | 7 +++++++ src/cpu/o3/scoreboard.hh | 2 +- src/sim/probe/probe.hh | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/arch/arm/insts/fplib.cc b/src/arch/arm/insts/fplib.cc index 1f44eed09..e6528358a 100644 --- a/src/arch/arm/insts/fplib.cc +++ b/src/arch/arm/insts/fplib.cc @@ -2509,7 +2509,7 @@ fplibRecipEstimate(uint32_t op, FPSCR &fpscr) result = fp32_infinity(sgn); flags |= FPLIB_DZC; } else if (!((uint32_t)(op << 1) >> 22)) { - bool overflow_to_inf; + bool overflow_to_inf = false; switch (FPCRRounding(fpscr)) { case FPRounding_TIEEVEN: overflow_to_inf = true; @@ -2570,7 +2570,7 @@ fplibRecipEstimate(uint64_t op, FPSCR &fpscr) result = fp64_infinity(sgn); flags |= FPLIB_DZC; } else if (!((uint64_t)(op << 1) >> 51)) { - bool overflow_to_inf; + bool overflow_to_inf = false; switch (FPCRRounding(fpscr)) { case FPRounding_TIEEVEN: overflow_to_inf = true; diff --git a/src/base/compiler.hh b/src/base/compiler.hh index 7176537d2..a16667d8d 100644 --- a/src/base/compiler.hh +++ b/src/base/compiler.hh @@ -50,6 +50,13 @@ #define M5_PRAGMA_NORETURN(x) #define M5_DUMMY_RETURN #define M5_VAR_USED __attribute__((unused)) + +#if defined(__clang__) +#define M5_CLASS_VAR_USED M5_VAR_USED +#else +#define M5_CLASS_VAR_USED +#endif + #define M5_ATTR_PACKED __attribute__ ((__packed__)) #define M5_NO_INLINE __attribute__ ((__noinline__)) #else diff --git a/src/cpu/o3/scoreboard.hh b/src/cpu/o3/scoreboard.hh index 79271082d..ec84becdf 100644 --- a/src/cpu/o3/scoreboard.hh +++ b/src/cpu/o3/scoreboard.hh @@ -72,7 +72,7 @@ class Scoreboard * the misc registers that come after the physical registers and * which are hardwired to be always considered ready. */ - unsigned numTotalRegs; + unsigned M5_CLASS_VAR_USED numTotalRegs; /** The index of the zero register. */ PhysRegIndex zeroRegIdx; diff --git a/src/sim/probe/probe.hh b/src/sim/probe/probe.hh index 0f77ccb1d..5a0bf11c9 100644 --- a/src/sim/probe/probe.hh +++ b/src/sim/probe/probe.hh @@ -133,7 +133,7 @@ class ProbeManager { private: /** Required for sensible debug messages.*/ - const SimObject *object; + const M5_CLASS_VAR_USED SimObject *object; /** Vector for name look-up. */ std::vector points; -- 2.30.2