Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/35975 )
Change subject: misc: Use compiler.hh macros when available.
......................................................................
misc: Use compiler.hh macros when available.
Some places were hand coding __attribute__s when macros in compiler.hh
were available to do that job. Using the macros helps abstract away
compiler specific details and should be used when possible.
Change-Id: I94befebcfde2d673e874e9959588f69781bd9021
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35975
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Maintainer: Gabe Black <gabebl...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/arm/isa/insts/sve.isa
M src/arch/x86/linux/linux.hh
M src/base/inet.hh
M src/gpu-compute/compute_unit.hh
M src/sim/init.cc
5 files changed, 11 insertions(+), 11 deletions(-)
Approvals:
Daniel Carvalho: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/arm/isa/insts/sve.isa b/src/arch/arm/isa/insts/sve.isa
index 242ae34..0b0adf4 100644
--- a/src/arch/arm/isa/insts/sve.isa
+++ b/src/arch/arm/isa/insts/sve.isa
@@ -2007,8 +2007,7 @@
destPred.reset();
for (unsigned i = 0; i < eCount; i++) {
const Element& srcElem1 = AA64FpOp1_x[i];
- %(src_elem_2_ty)s srcElem2 __attribute__((unused)) =
- %(src_elem_2)s;
+ M5_VAR_USED %(src_elem_2_ty)s srcElem2 = %(src_elem_2)s;
bool destElem = false;
if (tmpPred[i]) {
%(op)s
diff --git a/src/arch/x86/linux/linux.hh b/src/arch/x86/linux/linux.hh
index de27a74..e89cc57 100644
--- a/src/arch/x86/linux/linux.hh
+++ b/src/arch/x86/linux/linux.hh
@@ -243,7 +243,7 @@
{
public:
- typedef struct {
+ typedef struct M5_ATTR_PACKED {
uint64_t st_dev;
uint8_t __pad0[4];
uint32_t __st_ino;
@@ -263,7 +263,7 @@
uint32_t st_ctimeX;
uint32_t st_ctime_nsec;
uint64_t st_ino;
- } __attribute__((__packed__)) tgt_stat64;
+ } tgt_stat64;
static const int TGT_SIGHUP = 0x000001;
static const int TGT_SIGINT = 0x000002;
diff --git a/src/base/inet.hh b/src/base/inet.hh
index 8aa4475..817954e 100644
--- a/src/base/inet.hh
+++ b/src/base/inet.hh
@@ -563,13 +563,13 @@
};
#define HOME_ADDRESS_OPTION 0xC9
-struct ip6_opt_dstopts {
+struct M5_ATTR_PACKED ip6_opt_dstopts {
uint8_t type;
uint8_t length;
ip6_addr_t addr;
-} __attribute__((packed));
+};
-struct ip6_opt_hdr
+struct M5_ATTR_PACKED ip6_opt_hdr
{
uint8_t ext_nxt;
uint8_t ext_len;
@@ -578,7 +578,7 @@
struct ip6_opt_routing_type2 rtType2;
struct ip6_opt_dstopts dstOpts;
} ext_data;
-} __attribute__((packed));
+};
struct Ip6Opt : public ip6_opt_hdr
{
diff --git a/src/gpu-compute/compute_unit.hh
b/src/gpu-compute/compute_unit.hh
index 5b1e8de..3ca678e 100644
--- a/src/gpu-compute/compute_unit.hh
+++ b/src/gpu-compute/compute_unit.hh
@@ -40,6 +40,7 @@
#include <vector>
#include "base/callback.hh"
+#include "base/compiler.hh"
#include "base/statistics.hh"
#include "base/types.hh"
#include "config/the_gpu_isa.hh"
@@ -620,8 +621,7 @@
int32_t
getRefCounter(const uint32_t dispatchId, const uint32_t wgId) const;
- bool
- sendToLds(GPUDynInstPtr gpuDynInst)
__attribute__((warn_unused_result));
+ M5_NODISCARD bool sendToLds(GPUDynInstPtr gpuDynInst);
typedef std::unordered_map<Addr, std::pair<int, int>> pageDataStruct;
pageDataStruct pageAccesses;
diff --git a/src/sim/init.cc b/src/sim/init.cc
index 7b2e7e4..73d4dbd 100644
--- a/src/sim/init.cc
+++ b/src/sim/init.cc
@@ -51,6 +51,7 @@
#include <string>
#include <vector>
+#include "base/compiler.hh"
#include "base/cprintf.hh"
#include "base/logging.hh"
#include "base/types.hh"
@@ -245,7 +246,7 @@
* Make the commands array weak so that they can be overridden (used
* by unit tests to specify a different python main function.
*/
-const char * __attribute__((weak)) m5MainCommands[] = {
+M5_WEAK const char *m5MainCommands[] = {
"import m5",
"m5.main()",
0 // sentinel is required
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35975
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: I94befebcfde2d673e874e9959588f69781bd9021
Gerrit-Change-Number: 35975
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Jason Lowe-Power <power...@gmail.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s