Maurice Becker has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/12685 )

Change subject: dev, arm: fix error class-memaccess with GCC >= 8.1
......................................................................

dev, arm: fix error class-memaccess with GCC >= 8.1

From GCC 8.1 on GCC issues a warning when using memset et al on structs and
classes. With the way gem5 builds, this actually prevents successful
builds.

Instead of using a pointer with SCSIReply as type, we cast to a void
pointer to avoid the message. On the way we wrap the memset call into a
method of SCSIReply called reset for better code readability.

Signed-off-by: Maurice Becker <[email protected]>
Change-Id: I3ed3fd9714be5d253aba01ca00b1863e1ae5cb68
Reviewed-on: https://gem5-review.googlesource.com/12685
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
---
M src/dev/arm/ufs_device.cc
M src/dev/arm/ufs_device.hh
2 files changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved



diff --git a/src/dev/arm/ufs_device.cc b/src/dev/arm/ufs_device.cc
index cd1bbca..137ad8c 100644
--- a/src/dev/arm/ufs_device.cc
+++ b/src/dev/arm/ufs_device.cc
@@ -161,7 +161,7 @@
 UFSHostDevice::UFSSCSIDevice::SCSICMDHandle(uint32_t* SCSI_msg)
 {
     struct SCSIReply scsi_out;
-    memset(&scsi_out, 0, sizeof(struct SCSIReply));
+    scsi_out.reset();

     /**
      * Create the standard SCSI reponse information
diff --git a/src/dev/arm/ufs_device.hh b/src/dev/arm/ufs_device.hh
index 69abc27..97b9693 100644
--- a/src/dev/arm/ufs_device.hh
+++ b/src/dev/arm/ufs_device.hh
@@ -373,6 +373,10 @@
      * build a SCSI reply.
      */
     struct SCSIReply {
+        void reset() {
+            memset(static_cast<void*>(this), 0, sizeof(*this));
+        }
+
         uint8_t status;
         uint32_t msgSize;
         uint8_t LUN;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12685
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: I3ed3fd9714be5d253aba01ca00b1863e1ae5cb68
Gerrit-Change-Number: 12685
Gerrit-PatchSet: 6
Gerrit-Owner: Maurice Becker <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Anthony Gutierrez <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Maurice Becker <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to