misc: Update attribute syntax, and reorganize compiler.hh.
This change replaces the __attribute__ syntax with the now standard [[]] syntax. It also reorganizes compiler.hh so that all special macros have some explanatory text saying what they do, and each attribute which has a standard version can use that if available and what version of c++ it's standard in is put in a comment. Also, the requirements as far as where you put [[]] style attributes are a little more strict than the old school __attribute__ style. The use of the attribute macros was updated to fit these new, more strict requirements. Change-Id: Iace44306a534111f1c38b9856dc9e88cd9b49d2a Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35219 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -451,10 +451,10 @@ public:
|
||||
typedef uint16_t Flags;
|
||||
typedef uint16_t Index;
|
||||
|
||||
struct Header {
|
||||
struct M5_ATTR_PACKED Header {
|
||||
Flags flags;
|
||||
Index index;
|
||||
} M5_ATTR_PACKED;
|
||||
};
|
||||
|
||||
VirtRing<T>(PortProxy &proxy, ByteOrder bo, uint16_t size) :
|
||||
header{0, 0}, ring(size), _proxy(proxy), _base(0), byteOrder(bo)
|
||||
|
||||
@@ -81,9 +81,9 @@ class VirtIOBlock : public VirtIODeviceBase
|
||||
* @note This needs to be changed if the supported feature set
|
||||
* changes!
|
||||
*/
|
||||
struct Config {
|
||||
struct M5_ATTR_PACKED Config {
|
||||
uint64_t capacity;
|
||||
} M5_ATTR_PACKED;
|
||||
};
|
||||
Config config;
|
||||
|
||||
/** @{
|
||||
@@ -122,11 +122,11 @@ class VirtIOBlock : public VirtIODeviceBase
|
||||
/** @} */
|
||||
|
||||
/** VirtIO block device request as sent by guest */
|
||||
struct BlkRequest {
|
||||
struct M5_ATTR_PACKED BlkRequest {
|
||||
RequestType type;
|
||||
uint32_t reserved;
|
||||
uint64_t sector;
|
||||
} M5_ATTR_PACKED;
|
||||
};
|
||||
|
||||
/**
|
||||
* Device read request.
|
||||
|
||||
@@ -77,10 +77,10 @@ class VirtIOConsole : public VirtIODeviceBase
|
||||
* @note This needs to be changed if the multiport feature is
|
||||
* announced!
|
||||
*/
|
||||
struct Config {
|
||||
struct M5_ATTR_PACKED Config {
|
||||
uint16_t cols;
|
||||
uint16_t rows;
|
||||
} M5_ATTR_PACKED;
|
||||
};
|
||||
|
||||
/** Currently active configuration (host byte order) */
|
||||
Config config;
|
||||
|
||||
@@ -50,14 +50,14 @@ struct VirtIO9PBaseParams;
|
||||
typedef uint8_t P9MsgType;
|
||||
typedef uint16_t P9Tag;
|
||||
|
||||
struct P9MsgHeader {
|
||||
struct M5_ATTR_PACKED P9MsgHeader {
|
||||
/** Length including header */
|
||||
uint32_t len;
|
||||
/** Message type */
|
||||
P9MsgType type;
|
||||
/** Message tag */
|
||||
P9Tag tag;
|
||||
} M5_ATTR_PACKED;
|
||||
};
|
||||
|
||||
/** Convert p9 byte order (LE) to host byte order */
|
||||
template <typename T> inline T
|
||||
@@ -120,10 +120,10 @@ class VirtIO9PBase : public VirtIODeviceBase
|
||||
* @note The fields in this structure depend on the features
|
||||
* exposed to the guest.
|
||||
*/
|
||||
struct Config {
|
||||
struct M5_ATTR_PACKED Config {
|
||||
uint16_t len;
|
||||
char tag[];
|
||||
} M5_ATTR_PACKED;
|
||||
};
|
||||
|
||||
/** Currently active configuration (host byte order) */
|
||||
std::unique_ptr<Config> config;
|
||||
|
||||
@@ -65,7 +65,7 @@ PciVirtIO::~PciVirtIO()
|
||||
Tick
|
||||
PciVirtIO::read(PacketPtr pkt)
|
||||
{
|
||||
const unsigned M5_VAR_USED size(pkt->getSize());
|
||||
M5_VAR_USED const unsigned size(pkt->getSize());
|
||||
int bar;
|
||||
Addr offset;
|
||||
if (!getBAR(pkt->getAddr(), bar, offset))
|
||||
@@ -146,7 +146,7 @@ PciVirtIO::read(PacketPtr pkt)
|
||||
Tick
|
||||
PciVirtIO::write(PacketPtr pkt)
|
||||
{
|
||||
const unsigned M5_VAR_USED size(pkt->getSize());
|
||||
M5_VAR_USED const unsigned size(pkt->getSize());
|
||||
int bar;
|
||||
Addr offset;
|
||||
if (!getBAR(pkt->getAddr(), bar, offset))
|
||||
|
||||
Reference in New Issue
Block a user