Make unused attribute compatible to all compilers.
This commit is contained in:
@@ -55,6 +55,7 @@ endif()
|
||||
add_subdirectory(src/common/third_party/DRAMPower)
|
||||
|
||||
# Add nlohmann:
|
||||
set(JSON_BuildTests OFF)
|
||||
add_subdirectory(src/common/third_party/nlohmann)
|
||||
|
||||
# Add SystemC:
|
||||
|
||||
@@ -37,6 +37,14 @@
|
||||
#ifndef DEBUGMANAGER_H
|
||||
#define DEBUGMANAGER_H
|
||||
|
||||
#if __has_cpp_attribute(maybe_unused)
|
||||
#define NDEBUG_UNUSED(var_decl) [[maybe_unused]] var_decl
|
||||
#elif (__GNUC__ || __clang__)
|
||||
#define NDEBUG_UNUSED(var_decl) var_decl __attribute__((unused))
|
||||
#else
|
||||
#define NDEBUG_UNUSED(var_decl) var_decl
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define PRINTDEBUGMESSAGE(sender, message) {}
|
||||
#else
|
||||
|
||||
@@ -112,14 +112,14 @@ struct TemperatureSimConfig
|
||||
|
||||
void showTemperatureSimConfig()
|
||||
{
|
||||
int i __attribute__((unused)) = 0;
|
||||
for (auto e __attribute__((unused)) : powerInitialValues)
|
||||
NDEBUG_UNUSED(int i) = 0;
|
||||
for (NDEBUG_UNUSED(auto e) : powerInitialValues)
|
||||
{
|
||||
PRINTDEBUGMESSAGE("TemperatureSimConfig", "powerInitialValues["
|
||||
+ std::to_string(i++) + "]: " + std::to_string(e));
|
||||
}
|
||||
i = 0;
|
||||
for (auto e __attribute__((unused)) : powerThresholds)
|
||||
for (NDEBUG_UNUSED(auto e) : powerThresholds)
|
||||
{
|
||||
PRINTDEBUGMESSAGE("TemperatureSimConfig", "powerThreshold["
|
||||
+ std::to_string(i++) + "]: " + std::to_string(e));
|
||||
|
||||
@@ -115,6 +115,6 @@ struct CommandTuple
|
||||
};
|
||||
};
|
||||
|
||||
using readyCommands_t = std::vector<CommandTuple::Type>;
|
||||
using ReadyCommands = std::vector<CommandTuple::Type>;
|
||||
|
||||
#endif // COMMAND_H
|
||||
|
||||
@@ -373,7 +373,7 @@ unsigned int Controller::transport_dbg(tlm_generic_payload &trans)
|
||||
|
||||
void Controller::finishBeginReq()
|
||||
{
|
||||
uint64_t id __attribute__((unused)) = DramExtension::getPayloadID(payloadToAcquire);
|
||||
NDEBUG_UNUSED(uint64_t id) = DramExtension::getPayloadID(payloadToAcquire);
|
||||
PRINTDEBUGMESSAGE(name(), "Payload " + std::to_string(id) + " entered system.");
|
||||
|
||||
if (totalNumberOfPayloads == 0)
|
||||
@@ -419,7 +419,7 @@ void Controller::startBeginResp()
|
||||
|
||||
void Controller::finishEndResp()
|
||||
{
|
||||
uint64_t id __attribute__((unused)) = DramExtension::getPayloadID(payloadToRelease);
|
||||
NDEBUG_UNUSED(uint64_t id) = DramExtension::getPayloadID(payloadToRelease);
|
||||
PRINTDEBUGMESSAGE(name(), "Payload " + std::to_string(id) + " left system.");
|
||||
|
||||
payloadToRelease->release();
|
||||
|
||||
@@ -75,7 +75,7 @@ protected:
|
||||
private:
|
||||
unsigned totalNumberOfPayloads = 0;
|
||||
std::vector<unsigned> ranksNumberOfPayloads;
|
||||
readyCommands_t readyCommands;
|
||||
ReadyCommands readyCommands;
|
||||
|
||||
MemSpec *memSpec;
|
||||
|
||||
|
||||
@@ -72,13 +72,13 @@ void ControllerRecordable::recordPhase(tlm_generic_payload &trans, tlm_phase pha
|
||||
{
|
||||
sc_time recTime = delay + sc_time_stamp();
|
||||
|
||||
unsigned int thr __attribute__((unused)) = DramExtension::getExtension(trans).getThread().ID();
|
||||
unsigned int ch __attribute__((unused)) = DramExtension::getExtension(trans).getChannel().ID();
|
||||
unsigned int bg __attribute__((unused)) = DramExtension::getExtension(trans).getBankGroup().ID();
|
||||
unsigned int bank __attribute__((unused)) = DramExtension::getExtension(trans).getBank().ID();
|
||||
unsigned int row __attribute__((unused)) = DramExtension::getExtension(trans).getRow().ID();
|
||||
unsigned int col __attribute__((unused)) = DramExtension::getExtension(trans).getColumn().ID();
|
||||
uint64_t id __attribute__((unused)) = DramExtension::getExtension(trans).getPayloadID();
|
||||
NDEBUG_UNUSED(unsigned thr) = DramExtension::getExtension(trans).getThread().ID();
|
||||
NDEBUG_UNUSED(unsigned ch) = DramExtension::getExtension(trans).getChannel().ID();
|
||||
NDEBUG_UNUSED(unsigned bg) = DramExtension::getExtension(trans).getBankGroup().ID();
|
||||
NDEBUG_UNUSED(unsigned bank) = DramExtension::getExtension(trans).getBank().ID();
|
||||
NDEBUG_UNUSED(unsigned row) = DramExtension::getExtension(trans).getRow().ID();
|
||||
NDEBUG_UNUSED(unsigned col) = DramExtension::getExtension(trans).getColumn().ID();
|
||||
NDEBUG_UNUSED(uint64_t id) = DramExtension::getExtension(trans).getPayloadID();
|
||||
|
||||
PRINTDEBUGMESSAGE(name(), "Recording " + getPhaseName(phase) + " thread " +
|
||||
std::to_string(thr) + " channel " + std::to_string(ch) + " bank group " + std::to_string(
|
||||
|
||||
@@ -45,7 +45,7 @@ class CmdMuxIF
|
||||
{
|
||||
public:
|
||||
virtual ~CmdMuxIF() {}
|
||||
virtual CommandTuple::Type selectCommand(readyCommands_t &) = 0;
|
||||
virtual CommandTuple::Type selectCommand(ReadyCommands &) = 0;
|
||||
};
|
||||
|
||||
#endif // CMDMUXIF_H
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
using namespace tlm;
|
||||
|
||||
CommandTuple::Type CmdMuxOldest::selectCommand(readyCommands_t &readyCommands)
|
||||
CommandTuple::Type CmdMuxOldest::selectCommand(ReadyCommands &readyCommands)
|
||||
{
|
||||
readyCommands.erase(std::remove_if(readyCommands.begin(), readyCommands.end(),
|
||||
[](CommandTuple::Type element) {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
class CmdMuxOldest : public CmdMuxIF
|
||||
{
|
||||
public:
|
||||
CommandTuple::Type selectCommand(readyCommands_t &);
|
||||
CommandTuple::Type selectCommand(ReadyCommands &);
|
||||
};
|
||||
|
||||
#endif // CMDMUXOLDEST_H
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
using namespace tlm;
|
||||
|
||||
CommandTuple::Type
|
||||
CmdMuxStrict::selectCommand(readyCommands_t &readyCommands)
|
||||
CmdMuxStrict::selectCommand(ReadyCommands &readyCommands)
|
||||
{
|
||||
readyCommands.erase(std::remove_if(readyCommands.begin(), readyCommands.end(),
|
||||
[](CommandTuple::Type element) {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
class CmdMuxStrict : public CmdMuxIF
|
||||
{
|
||||
public:
|
||||
CommandTuple::Type selectCommand(readyCommands_t &);
|
||||
CommandTuple::Type selectCommand(ReadyCommands &);
|
||||
|
||||
private:
|
||||
uint64_t nextPayloadID = 0;
|
||||
|
||||
@@ -166,7 +166,7 @@ void DRAMSys::logo()
|
||||
#undef BOLDTXT
|
||||
}
|
||||
|
||||
void DRAMSys::setupDebugManager(const std::string &traceName __attribute__((unused)))
|
||||
void DRAMSys::setupDebugManager(NDEBUG_UNUSED(const std::string &traceName))
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
auto &dbg = DebugManager::getInstance();
|
||||
|
||||
@@ -164,8 +164,8 @@ void TemperatureController::temperatureThread()
|
||||
updateTemperatures();
|
||||
double p = adjustThermalSimPeriod();
|
||||
|
||||
int i __attribute__((unused)) = 0;
|
||||
for (auto t __attribute__((unused)) : temperatureValues) {
|
||||
NDEBUG_UNUSED(int i) = 0;
|
||||
for (NDEBUG_UNUSED(auto t) : temperatureValues) {
|
||||
PRINTDEBUGMESSAGE(name(), "Temperature[" + std::to_string(i++)
|
||||
+ "] is " + std::to_string(t));
|
||||
}
|
||||
|
||||
@@ -88,12 +88,12 @@ void DramRecordable<BaseDram>::recordPhase(tlm_generic_payload &trans, tlm_phase
|
||||
if (phase == END_PDNA || phase == END_PDNP || phase == END_SREF)
|
||||
recTime += this->memSpec->getCommandLength(phaseToCommand(phase));
|
||||
|
||||
unsigned int thr __attribute__((unused)) = DramExtension::getExtension(trans).getThread().ID();
|
||||
unsigned int ch __attribute__((unused)) = DramExtension::getExtension(trans).getChannel().ID();
|
||||
unsigned int bg __attribute__((unused)) = DramExtension::getExtension(trans).getBankGroup().ID();
|
||||
unsigned int bank __attribute__((unused)) = DramExtension::getExtension(trans).getBank().ID();
|
||||
unsigned int row __attribute__((unused)) = DramExtension::getExtension(trans).getRow().ID();
|
||||
unsigned int col __attribute__((unused)) = DramExtension::getExtension(trans).getColumn().ID();
|
||||
NDEBUG_UNUSED(unsigned thr) = DramExtension::getExtension(trans).getThread().ID();
|
||||
NDEBUG_UNUSED(unsigned ch) = DramExtension::getExtension(trans).getChannel().ID();
|
||||
NDEBUG_UNUSED(unsigned bg) = DramExtension::getExtension(trans).getBankGroup().ID();
|
||||
NDEBUG_UNUSED(unsigned bank) = DramExtension::getExtension(trans).getBank().ID();
|
||||
NDEBUG_UNUSED(unsigned row) = DramExtension::getExtension(trans).getRow().ID();
|
||||
NDEBUG_UNUSED(unsigned col) = DramExtension::getExtension(trans).getColumn().ID();
|
||||
|
||||
PRINTDEBUGMESSAGE(this->name(), "Recording " + getPhaseName(phase) + " thread " +
|
||||
std::to_string(thr) + " channel " + std::to_string(ch) + " bank group " + std::to_string(
|
||||
|
||||
Reference in New Issue
Block a user