Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/48928 )
Change subject: dev: Get rid of some unnecessary "using"s in ns_gige.cc.
......................................................................
dev: Get rid of some unnecessary "using"s in ns_gige.cc.
These are exporting names from the std:: namespace into the global
namespace. This isn't *too* bad, since this is in a .cc file and so
shouldn't leak into other files. It's also unnecessary though,
particularly since not all of these names are even used in the file,
and only one is used more than once.
These should have been cleaned up in an earlier sweep for
"using namespace std", but because they "using"-ed a few elements from
it individually, they had been missed.
Also, partially to ensure gem5 still builds properly, and also as its
own cleanup, this change removes unnecessary [[maybe_unused]]
attributes, and #ifndef NDEBUG-s.
Change-Id: Ib29cdfdf5deeae0accb717cbbfe878105fe0ea04
---
M src/dev/amdgpu/amdgpu_device.cc
M src/dev/arm/gic_v2.cc
M src/dev/hsa/hsa_packet_processor.cc
M src/dev/hsa/hw_scheduler.cc
M src/dev/net/i8254xGBe.cc
M src/dev/net/ns_gige.cc
M src/dev/net/sinic.cc
M src/dev/net/tcp_iface.cc
M src/dev/pci/copy_engine.cc
M src/dev/sparc/mm_disk.cc
M src/dev/virtio/pci.cc
11 files changed, 31 insertions(+), 65 deletions(-)
diff --git a/src/dev/amdgpu/amdgpu_device.cc
b/src/dev/amdgpu/amdgpu_device.cc
index 94a5a6a..4938569 100644
--- a/src/dev/amdgpu/amdgpu_device.cc
+++ b/src/dev/amdgpu/amdgpu_device.cc
@@ -101,7 +101,7 @@
Tick
AMDGPUDevice::readConfig(PacketPtr pkt)
{
- [[maybe_unused]] int offset = pkt->getAddr() & PCI_CONFIG_SIZE;
+ int offset = pkt->getAddr() & PCI_CONFIG_SIZE;
DPRINTF(AMDGPUDevice, "Read Config: from offset: %#x size: %#x "
"data: %#x\n", offset, pkt->getSize(), config.data[offset]);
@@ -129,7 +129,7 @@
Tick
AMDGPUDevice::writeConfig(PacketPtr pkt)
{
- [[maybe_unused]] int offset = pkt->getAddr() & PCI_CONFIG_SIZE;
+ int offset = pkt->getAddr() & PCI_CONFIG_SIZE;
DPRINTF(AMDGPUDevice, "Write Config: from offset: %#x size: %#x "
"data: %#x\n", offset, pkt->getSize(),
pkt->getUintX(ByteOrder::little));
diff --git a/src/dev/arm/gic_v2.cc b/src/dev/arm/gic_v2.cc
index 78a2012..9ec03b4 100644
--- a/src/dev/arm/gic_v2.cc
+++ b/src/dev/arm/gic_v2.cc
@@ -395,9 +395,8 @@
const ContextID ctx = pkt->req->contextId();
const size_t data_sz = pkt->getSize();
- [[maybe_unused]] uint32_t pkt_data;
- switch (data_sz)
- {
+ uint32_t pkt_data;
+ switch (data_sz) {
case 1:
pkt_data = pkt->getLE<uint8_t>();
break;
diff --git a/src/dev/hsa/hsa_packet_processor.cc
b/src/dev/hsa/hsa_packet_processor.cc
index f61c3e6..c5402c9 100644
--- a/src/dev/hsa/hsa_packet_processor.cc
+++ b/src/dev/hsa/hsa_packet_processor.cc
@@ -127,7 +127,7 @@
pkt->getAddr() < pioAddr + pioSize);
// TODO: How to get pid??
- [[maybe_unused]] Addr daddr = pkt->getAddr() - pioAddr;
+ Addr daddr = pkt->getAddr() - pioAddr;
DPRINTF(HSAPacketProcessor,
"%s: write of size %d to reg-offset %d (0x%x)\n",
@@ -212,10 +212,8 @@
dma_series_ctx *series_ctx, void *dest_4debug)
{
uint32_t rl_idx = series_ctx->rl_idx;
- [[maybe_unused]] AQLRingBuffer *aqlRingBuffer =
- hsaPP->regdQList[rl_idx]->qCntxt.aqlBuf;
- HSAQueueDescriptor* qDesc =
- hsaPP->regdQList[rl_idx]->qCntxt.qDesc;
+ AQLRingBuffer *aqlRingBuffer = hsaPP->regdQList[rl_idx]->qCntxt.aqlBuf;
+ HSAQueueDescriptor* qDesc = hsaPP->regdQList[rl_idx]->qCntxt.qDesc;
DPRINTF(HSAPacketProcessor, ">%s, ix = %d, npkts = %d," \
" pktsRemaining = %d, active list ID = %d\n", __FUNCTION__,
ix_start, num_pkts, series_ctx->pkts_2_go,
@@ -559,8 +557,7 @@
void
HSAPacketProcessor::displayQueueDescriptor(int pid, uint32_t rl_idx)
{
- [[maybe_unused]] HSAQueueDescriptor* qDesc =
- regdQList[rl_idx]->qCntxt.qDesc;
+ HSAQueueDescriptor* qDesc = regdQList[rl_idx]->qCntxt.qDesc;
DPRINTF(HSAPacketProcessor,
"%s: pid[%d], basePointer[0x%lx], dBPointer[0x%lx], "
"writeIndex[0x%x], readIndex[0x%x], size(bytes)[0x%x]\n",
diff --git a/src/dev/hsa/hw_scheduler.cc b/src/dev/hsa/hw_scheduler.cc
index bfd48c1..113c45b 100644
--- a/src/dev/hsa/hw_scheduler.cc
+++ b/src/dev/hsa/hw_scheduler.cc
@@ -117,8 +117,7 @@
// Check if this newly created queue can be directly mapped
// to registered queue list
- [[maybe_unused]] bool register_q =
- mapQIfSlotAvlbl(queue_id, aql_buf, q_desc);
+ bool register_q = mapQIfSlotAvlbl(queue_id, aql_buf, q_desc);
schedWakeup();
DPRINTF(HSAPacketProcessor,
"%s: offset = %p, qID = %d, is_regd = %s, AL size %d\n",
diff --git a/src/dev/net/i8254xGBe.cc b/src/dev/net/i8254xGBe.cc
index cf168bb..85a5f61 100644
--- a/src/dev/net/i8254xGBe.cc
+++ b/src/dev/net/i8254xGBe.cc
@@ -2078,10 +2078,7 @@
if (txPacket && txDescCache.packetAvailable()
&& !txDescCache.packetMultiDesc() && txPacket->length) {
DPRINTF(EthernetSM, "TXS: packet placed in TX FIFO\n");
-#ifndef NDEBUG
- bool success =
-#endif
- txFifo.push(txPacket);
+ bool success = txFifo.push(txPacket);
txFifoTick = true && drainState() != DrainState::Draining;
gem5_assert(success);
txPacket = NULL;
diff --git a/src/dev/net/ns_gige.cc b/src/dev/net/ns_gige.cc
index c467165..c380779 100644
--- a/src/dev/net/ns_gige.cc
+++ b/src/dev/net/ns_gige.cc
@@ -48,13 +48,6 @@
#include "params/NSGigE.hh"
#include "sim/system.hh"
-// clang complains about std::set being overloaded with Packet::set if
-// we open up the entire namespace std
-using std::make_shared;
-using std::min;
-using std::ostream;
-using std::string;
-
namespace gem5
{
@@ -1570,7 +1563,7 @@
case txFifoBlock:
if (!txPacket) {
DPRINTF(EthernetSM, "****starting the tx of a new
packet****\n");
- txPacket = make_shared<EthPacketData>(16384);
+ txPacket = std::make_shared<EthPacketData>(16384);
txPacketBufPtr = txPacket->data;
}
@@ -1640,10 +1633,7 @@
panic("transmit packet too large, %s > 1514\n",
txPacket->length);
-#ifndef NDEBUG
- bool success =
-#endif
- txFifo.push(txPacket);
+ bool success = txFifo.push(txPacket);
gem5_assert(success);
/*
@@ -1705,7 +1695,7 @@
* is not enough room in the fifo, just whatever room
* is left in the fifo
*/
- txXferLen = min<uint32_t>(txDescCnt, txFifo.avail());
+ txXferLen = std::min<uint32_t>(txDescCnt, txFifo.avail());
txDmaAddr = txFragPtr & 0x3fffffff;
txDmaData = txPacketBufPtr;
@@ -1911,7 +1901,7 @@
{
EthPtr eth = packet;
bool drop = true;
- string type;
+ std::string type;
const EthAddr &dst = eth->dst();
if (dst.unicast()) {
@@ -2246,7 +2236,7 @@
bool txPacketExists;
UNSERIALIZE_SCALAR(txPacketExists);
if (txPacketExists) {
- txPacket = make_shared<EthPacketData>(16384);
+ txPacket = std::make_shared<EthPacketData>(16384);
txPacket->unserialize("txPacket", cp);
uint32_t txPktBufPtr;
UNSERIALIZE_SCALAR(txPktBufPtr);
@@ -2258,7 +2248,7 @@
UNSERIALIZE_SCALAR(rxPacketExists);
rxPacket = 0;
if (rxPacketExists) {
- rxPacket = make_shared<EthPacketData>();
+ rxPacket = std::make_shared<EthPacketData>();
rxPacket->unserialize("rxPacket", cp);
uint32_t rxPktBufPtr;
UNSERIALIZE_SCALAR(rxPktBufPtr);
diff --git a/src/dev/net/sinic.cc b/src/dev/net/sinic.cc
index c80420b..f7ce182 100644
--- a/src/dev/net/sinic.cc
+++ b/src/dev/net/sinic.cc
@@ -230,7 +230,7 @@
prepareRead(cpu, index);
- [[maybe_unused]] uint64_t value = 0;
+ uint64_t value = 0;
if (pkt->getSize() == 4) {
uint32_t reg = regData32(raddr);
pkt->setLE(reg);
@@ -245,7 +245,8 @@
DPRINTF(EthernetPIO,
"read %s: cpu=%d vnic=%d da=%#x pa=%#x size=%d val=%#x\n",
- info.name, cpu, index, daddr, pkt->getAddr(), pkt->getSize(),
value);
+ info.name, cpu, index, daddr, pkt->getAddr(), pkt->getSize(),
+ value);
// reading the interrupt status register has the side effect of
// clearing it
diff --git a/src/dev/net/tcp_iface.cc b/src/dev/net/tcp_iface.cc
index 4c0014a9..0615b14 100644
--- a/src/dev/net/tcp_iface.cc
+++ b/src/dev/net/tcp_iface.cc
@@ -255,9 +255,7 @@
TCPIface::~TCPIface()
{
- [[maybe_unused]] int ret;
-
- ret = close(sock);
+ int ret = close(sock);
gem5_assert(ret == 0);
}
diff --git a/src/dev/pci/copy_engine.cc b/src/dev/pci/copy_engine.cc
index 78047e4..fef3b22 100644
--- a/src/dev/pci/copy_engine.cc
+++ b/src/dev/pci/copy_engine.cc
@@ -311,19 +311,19 @@
///
if (size == sizeof(uint64_t)) {
- [[maybe_unused]] uint64_t val = pkt->getLE<uint64_t>();
+ uint64_t val = pkt->getLE<uint64_t>();
DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n",
daddr, val);
} else if (size == sizeof(uint32_t)) {
- [[maybe_unused]] uint32_t val = pkt->getLE<uint32_t>();
+ uint32_t val = pkt->getLE<uint32_t>();
DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n",
daddr, val);
} else if (size == sizeof(uint16_t)) {
- [[maybe_unused]] uint16_t val = pkt->getLE<uint16_t>();
+ uint16_t val = pkt->getLE<uint16_t>();
DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n",
daddr, val);
} else if (size == sizeof(uint8_t)) {
- [[maybe_unused]] uint8_t val = pkt->getLE<uint8_t>();
+ uint8_t val = pkt->getLE<uint8_t>();
DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n",
daddr, val);
} else {
diff --git a/src/dev/sparc/mm_disk.cc b/src/dev/sparc/mm_disk.cc
index 65c04bf..2f0368f 100644
--- a/src/dev/sparc/mm_disk.cc
+++ b/src/dev/sparc/mm_disk.cc
@@ -71,16 +71,10 @@
if (sector != curSector) {
if (dirty) {
-#ifndef NDEBUG
- off_t bytes_written =
-#endif
- image->write(diskData, curSector);
+ off_t bytes_written = image->write(diskData, curSector);
gem5_assert(bytes_written == SectorSize);
}
-#ifndef NDEBUG
- off_t bytes_read =
-#endif
- image->read(diskData, sector);
+ off_t bytes_read = image->read(diskData, sector);
gem5_assert(bytes_read == SectorSize);
curSector = sector;
}
@@ -130,16 +124,10 @@
if (sector != curSector) {
if (dirty) {
-#ifndef NDEBUG
- off_t bytes_written =
-#endif
- image->write(diskData, curSector);
+ off_t bytes_written = image->write(diskData, curSector);
gem5_assert(bytes_written == SectorSize);
}
-#ifndef NDEBUG
- off_t bytes_read =
-#endif
- image->read(diskData, sector);
+ off_t bytes_read = image->read(diskData, sector);
gem5_assert(bytes_read == SectorSize);
curSector = sector;
}
@@ -180,10 +168,7 @@
// just write any dirty changes to the cow layer it will take care of
// serialization
if (dirty) {
-#ifndef NDEBUG
- int bytes_read =
-#endif
- image->write(diskData, curSector);
+ int bytes_read = image->write(diskData, curSector);
gem5_assert(bytes_read == SectorSize);
}
ClockedObject::serialize(cp);
diff --git a/src/dev/virtio/pci.cc b/src/dev/virtio/pci.cc
index 3adf5f9..ce613c5 100644
--- a/src/dev/virtio/pci.cc
+++ b/src/dev/virtio/pci.cc
@@ -70,7 +70,7 @@
Tick
PciVirtIO::read(PacketPtr pkt)
{
- [[maybe_unused]] const unsigned size(pkt->getSize());
+ const unsigned size = pkt->getSize();
int bar;
Addr offset;
if (!getBAR(pkt->getAddr(), bar, offset))
@@ -151,7 +151,7 @@
Tick
PciVirtIO::write(PacketPtr pkt)
{
- [[maybe_unused]] const unsigned size(pkt->getSize());
+ const unsigned size = pkt->getSize();
int bar;
Addr offset;
if (!getBAR(pkt->getAddr(), bar, offset))
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48928
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ib29cdfdf5deeae0accb717cbbfe878105fe0ea04
Gerrit-Change-Number: 48928
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s