misc: Remove typedef (struct|enum) Foo in cpp files.

In C, to refer to a type without a struct or enum tag on the type, you
need to typedef it like this:

typedef struct
{
} Foo;

Foo foo;

In C++, this is unnecessary:

struct Foo
{
};

Foo foo;

Remove all of the first form in C++ files and replace them with the
second form.

Change-Id: I37cc0d63b2777466dc6cc51eb5a3201de2e2cf43
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46199
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/src/arch/arm/freebsd/freebsd.hh b/src/arch/arm/freebsd/freebsd.hh
index f47fb4e..cc2ffb8 100644
--- a/src/arch/arm/freebsd/freebsd.hh
+++ b/src/arch/arm/freebsd/freebsd.hh
@@ -126,7 +126,7 @@
      * sizeof st_lspare 4
      */
 
-    typedef struct
+    struct tgt_stat
     {
         uint32_t   st_dev;
         uint32_t   st_ino;
@@ -149,9 +149,9 @@
         uint32_t   st_lspare;
         uint64_t   st_birthtimX;
         uint64_t   st_birthtim;
-    } tgt_stat;
+    };
 
-    typedef struct
+    struct tgt_stat64
     {
         uint32_t   st_dev;
         uint32_t   st_ino;
@@ -174,7 +174,7 @@
         uint32_t   st_lspare;
         uint64_t   st_birthtimX;
         uint64_t   st_birthtim;
-    } tgt_stat64;
+    };
 
     /// For getrusage().
     struct rusage
@@ -296,7 +296,7 @@
         uint64_t iov_len;
     };
 
-    typedef struct
+    struct tgt_stat
     {
         uint32_t   st_dev;
         uint32_t   st_ino;
@@ -319,9 +319,9 @@
         uint32_t   st_lspare;
         uint64_t   st_birthtimX;
         uint64_t   st_birthtim;
-    } tgt_stat;
+    };
 
-    typedef struct
+    struct tgt_stat64
     {
         uint32_t   st_dev;
         uint32_t   st_ino;
@@ -344,7 +344,7 @@
         uint32_t   st_lspare;
         uint64_t   st_birthtimX;
         uint64_t   st_birthtim;
-    } tgt_stat64;
+    };
 
     /// For getrusage().
     struct rusage
diff --git a/src/arch/arm/linux/linux.hh b/src/arch/arm/linux/linux.hh
index 15faede..e795165 100644
--- a/src/arch/arm/linux/linux.hh
+++ b/src/arch/arm/linux/linux.hh
@@ -193,7 +193,7 @@
     };
 
 
-    typedef struct
+    struct tgt_stat
     {
         uint32_t st_dev;
         uint32_t st_ino;
@@ -213,9 +213,9 @@
         uint32_t st_mtime_nsec;
         uint32_t st_ctimeX;
         uint32_t st_ctime_nsec;
-    } tgt_stat;
+    };
 
-    typedef struct
+    struct tgt_stat64
     {
         uint64_t  st_dev;
         uint8_t   __pad0[4];
@@ -236,9 +236,9 @@
         uint32_t  st_ctimeX;
         uint32_t  st_ctime_nsec;
         uint64_t  st_ino;
-    } tgt_stat64;
+    };
 
-    typedef struct
+    struct tgt_sysinfo
     {
         int32_t  uptime;    /* Seconds since boot */
         uint32_t loads[3];  /* 1, 5, and 15 minute load averages */
@@ -252,7 +252,7 @@
         uint32_t totalhigh; /* Total high memory size */
         uint32_t freehigh;  /* Available high memory size */
         uint32_t mem_unit;  /* Memory unit size in bytes */
-    } tgt_sysinfo;
+    };
 
     /// For getrusage().
     struct rusage
@@ -457,7 +457,7 @@
         uint64_t iov_len;
     };
 
-    typedef struct
+    struct tgt_stat
     {
         uint64_t st_dev;
         uint64_t st_ino;
@@ -476,9 +476,9 @@
         uint64_t st_mtime_nsec;
         uint64_t st_ctimeX;
         uint64_t st_ctime_nsec;
-    } tgt_stat;
+    };
 
-    typedef struct
+    struct tgt_stat64
     {
         uint64_t st_dev;
         uint64_t st_ino;
@@ -497,9 +497,9 @@
         uint64_t st_mtime_nsec;
         uint64_t st_ctimeX;
         uint64_t st_ctime_nsec;
-    } tgt_stat64;
+    };
 
-    typedef struct
+    struct tgt_sysinfo
     {
         int64_t  uptime;    /* Seconds since boot */
         uint64_t loads[3];  /* 1, 5, and 15 minute load averages */
@@ -514,7 +514,7 @@
         uint64_t totalhigh; /* Total high memory size */
         uint64_t freehigh;  /* Available high memory size */
         uint32_t mem_unit;  /* Memory unit size in bytes */
-    } tgt_sysinfo;
+    };
 
     /// For getrusage().
     struct rusage
diff --git a/src/arch/mips/linux/linux.hh b/src/arch/mips/linux/linux.hh
index 180f0a8..86d49a3 100644
--- a/src/arch/mips/linux/linux.hh
+++ b/src/arch/mips/linux/linux.hh
@@ -179,7 +179,7 @@
     /// the root users.
     static const int NUM_ROOT_PROCS = 2;
 
-    typedef struct
+    struct tgt_sysinfo
     {
        int32_t  uptime;    /* Seconds since boot */
        uint32_t loads[3];  /* 1, 5, and 15 minute load averages */
@@ -193,7 +193,7 @@
        uint32_t totalhigh; /* Total high memory size */
        uint32_t freehigh;  /* Available high memory size */
        uint32_t mem_unit;  /* Memory unit size in bytes */
-    } tgt_sysinfo;
+    };
 
 };
 
diff --git a/src/arch/power/linux/linux.hh b/src/arch/power/linux/linux.hh
index 646d642..effdf15 100644
--- a/src/arch/power/linux/linux.hh
+++ b/src/arch/power/linux/linux.hh
@@ -52,7 +52,7 @@
 
     typedef int32_t time_t;
 
-    typedef struct
+    struct tgt_stat
     {
         uint64_t st_dev;
         uint32_t __pad1;
@@ -74,9 +74,9 @@
         uint32_t st_ctime_nsec;
         uint32_t __unused4;
         uint32_t __unused5;
-    } tgt_stat;
+    };
 
-    typedef struct
+    struct tgt_stat64
     {
         uint64_t st_dev;
         uint64_t st_ino;
@@ -98,7 +98,7 @@
         uint32_t st_ctime_nsec;
         uint32_t __unused4;
         uint32_t __unused5;
-    } tgt_stat64;
+    };
 
     /// For times().
     struct tms
diff --git a/src/arch/riscv/linux/linux.hh b/src/arch/riscv/linux/linux.hh
index 0e38df3..30d6dcc 100644
--- a/src/arch/riscv/linux/linux.hh
+++ b/src/arch/riscv/linux/linux.hh
@@ -138,7 +138,7 @@
         int64_t tv_nsec;
     };
 
-    typedef struct
+    struct tgt_stat64
     {
         dev_t st_dev;
         ino_t st_ino;
@@ -158,14 +158,14 @@
         uint64_t st_ctimeX;
         uint64_t st_ctime_nsec;
         int32_t ___glibc_reserved[2];
-    } tgt_stat64;
+    };
 
-    typedef struct
+    struct tgt_fsid_t
     {
         int32_t val[2];
-    } tgt_fsid_t;
+    };
 
-    typedef struct
+    struct tgt_statfs
     {
         uint64_t f_type;
         uint64_t f_bsize;
@@ -179,9 +179,9 @@
         uint64_t f_frsize;
         uint64_t f_flags;
         uint64_t f_spare[4];
-    } tgt_statfs;
+    };
 
-    typedef struct
+    struct tgt_sysinfo
     {
         int64_t uptime;
         uint64_t loads[3];
@@ -196,7 +196,7 @@
         uint64_t totalhigh;
         uint64_t freehigh;
         uint32_t mem_unit;
-    } tgt_sysinfo;
+    };
 
     static void
     archClone(uint64_t flags,
@@ -309,12 +309,12 @@
         int32_t tv_nsec;
     };
 
-    typedef struct
+    struct tgt_fsid_t
     {
         int32_t val[2];
-    } tgt_fsid_t;
+    };
 
-    typedef struct
+    struct tgt_stat
     {
         uint64_t st_dev;
         uint64_t st_ino;
@@ -336,9 +336,9 @@
         int32_t st_ctime_nsec;
         int32_t __unused4;
         int32_t __unused5;
-    } tgt_stat;
+    };
 
-    typedef struct
+    struct tgt_statfs
     {
         uint32_t f_type;
         uint32_t f_bsize;
@@ -352,9 +352,9 @@
         uint32_t f_frsize;
         uint32_t f_flags;
         uint32_t f_spare[4];
-    } tgt_statfs;
+    };
 
-    typedef struct
+    struct tgt_sysinfo
     {
         int32_t uptime;
         uint32_t loads[3];
@@ -369,7 +369,7 @@
         uint32_t totalhigh;
         uint32_t freehigh;
         uint32_t mem_unit;
-    } tgt_sysinfo;
+    };
 
     static void
     archClone(uint64_t flags,
diff --git a/src/arch/riscv/pmp.hh b/src/arch/riscv/pmp.hh
index 33d4976..637c48c 100644
--- a/src/arch/riscv/pmp.hh
+++ b/src/arch/riscv/pmp.hh
@@ -68,12 +68,13 @@
      * PMP_NA4 = naturally aligned four byte region
      * PMP_NAPOT = naturally aligned power of two region, >= 8 bytes
      */
-    typedef enum {
+    enum pmpAmatch
+    {
         PMP_OFF,
         PMP_TOR,
         PMP_NA4,
         PMP_NAPOT
-    } pmpAmatch;
+    };
 
     /** pmpcfg address range read permission mask */
     const uint8_t PMP_READ = 1 << 0;
diff --git a/src/arch/sparc/linux/linux.hh b/src/arch/sparc/linux/linux.hh
index 134a8e5..3a70985 100644
--- a/src/arch/sparc/linux/linux.hh
+++ b/src/arch/sparc/linux/linux.hh
@@ -169,7 +169,7 @@
     static const unsigned TGT_MAP_FIXED         = 0x00010;
     static const unsigned TGT_MAP_INHERIT       = 0x00080;
 
-    typedef struct
+    struct tgt_sysinfo
     {
         int64_t  uptime;    /* Seconds since boot */
         uint64_t loads[3];  /* 1, 5, and 15 minute load averages */
@@ -183,7 +183,7 @@
         uint64_t totalhigh; /* Total high memory size */
         uint64_t freehigh;  /* Available high memory size */
         uint64_t mem_unit;  /* Memory unit size in bytes */
-    } tgt_sysinfo;
+    };
 
     //@{
     /// ioctl() command codes.
@@ -247,7 +247,7 @@
 {
   public:
 
-    typedef struct
+    struct tgt_stat64
     {
         uint64_t st_dev;
         uint64_t st_ino;
@@ -269,9 +269,9 @@
         uint64_t st_ctime_nsec;
         uint32_t __unused4;
         uint32_t __unused5;
-    } tgt_stat64;
+    };
 
-    typedef struct
+    struct tgt_sysinfo
     {
         int32_t  uptime;    /* Seconds since boot */
         uint32_t loads[3];  /* 1, 5, and 15 minute load averages */
@@ -285,7 +285,7 @@
         uint32_t totalhigh; /* Total high memory size */
         uint32_t freehigh;  /* Available high memory size */
         uint32_t mem_unit;  /* Memory unit size in bytes */
-    } tgt_sysinfo;
+    };
 
     /// Resource constants for getrlimit() (overide some generics).
     static const unsigned TGT_RLIMIT_NPROC = 7;
diff --git a/src/arch/x86/linux/linux.hh b/src/arch/x86/linux/linux.hh
index 9d1563a..29422a3 100644
--- a/src/arch/x86/linux/linux.hh
+++ b/src/arch/x86/linux/linux.hh
@@ -99,7 +99,7 @@
 {
   public:
 
-    typedef struct
+    struct tgt_stat64
     {
         uint64_t st_dev;
         uint64_t st_ino;
@@ -119,14 +119,14 @@
         uint64_t st_ctimeX;
         uint64_t st_ctime_nsec;
         int64_t unused0[3];
-    } tgt_stat64;
+    };
 
-    typedef struct
+    struct tgt_fsid
     {
         long val[2];
-    } tgt_fsid;
+    };
 
-    typedef struct
+    struct tgt_statfs
     {
         long f_type;
         long f_bsize;
@@ -139,7 +139,7 @@
         long f_namelen;
         long f_frsize;
         long f_spare[5];
-    } tgt_statfs;
+    };
 
     static const int TGT_SIGHUP         = 0x000001;
     static const int TGT_SIGINT         = 0x000002;
@@ -223,13 +223,13 @@
     static const unsigned TGT_MAP_ANONYMOUS     = 0x00020;
     static const unsigned TGT_MAP_FIXED         = 0x00010;
 
-    typedef struct
+    struct tgt_iovec
     {
         uint64_t iov_base; // void *
         uint64_t iov_len;  // size_t
-    } tgt_iovec;
+    };
 
-    typedef struct
+    struct tgt_sysinfo
     {
         int64_t  uptime;    /* Seconds since boot */
         uint64_t loads[3];  /* 1, 5, and 15 minute load averages */
@@ -243,14 +243,14 @@
         uint64_t totalhigh; /* Total high memory size */
         uint64_t freehigh;  /* Available high memory size */
         uint64_t mem_unit;  /* Memory unit size in bytes */
-    } tgt_sysinfo;
+    };
 
 };
 
 class X86Linux32 : public X86Linux
 {
   public:
-    typedef struct GEM5_PACKED
+    struct GEM5_PACKED tgt_stat64
     {
         uint64_t st_dev;
         uint8_t __pad0[4];
@@ -271,7 +271,7 @@
         uint32_t st_ctimeX;
         uint32_t st_ctime_nsec;
         uint64_t st_ino;
-    } tgt_stat64;
+    };
 
     static const int TGT_SIGHUP         = 0x000001;
     static const int TGT_SIGINT         = 0x000002;
@@ -357,7 +357,7 @@
     static const unsigned TGT_MAP_ANONYMOUS     = 0x00020;
     static const unsigned TGT_MAP_FIXED         = 0x00010;
 
-    typedef struct
+    struct tgt_sysinfo
     {
        int32_t  uptime;    /* Seconds since boot */
        uint32_t loads[3];  /* 1, 5, and 15 minute load averages */
@@ -371,7 +371,7 @@
        uint32_t totalhigh; /* Total high memory size */
        uint32_t freehigh;  /* Available high memory size */
        uint32_t mem_unit;  /* Memory unit size in bytes */
-    } tgt_sysinfo;
+    };
 };
 
 } // namespace gem5
diff --git a/src/dev/arm/gic_v3.hh b/src/dev/arm/gic_v3.hh
index ab8543c..f4aaea5 100644
--- a/src/dev/arm/gic_v3.hh
+++ b/src/dev/arm/gic_v3.hh
@@ -81,27 +81,27 @@
     static const int PPI_MAX = 16;
 
     // Interrupt states for PPIs, SGIs and SPIs, as per SPEC 4.1.2 section
-    typedef enum
+    enum IntStatus
     {
         INT_INACTIVE,
         INT_PENDING,
         INT_ACTIVE,
         INT_ACTIVE_PENDING,
-    } IntStatus;
+    };
 
     // Interrupt groups, as per SPEC section 4.6
-    typedef enum
+    enum GroupId
     {
         G0S,
         G1S,
         G1NS,
-    } GroupId;
+    };
 
-    typedef enum
+    enum IntTriggerType
     {
         INT_LEVEL_SENSITIVE,
         INT_EDGE_TRIGGERED,
-    } IntTriggerType;
+    };
 
   protected:
 
diff --git a/src/dev/arm/gic_v3_cpu_interface.hh b/src/dev/arm/gic_v3_cpu_interface.hh
index 09db7b5..9f60d84 100644
--- a/src/dev/arm/gic_v3_cpu_interface.hh
+++ b/src/dev/arm/gic_v3_cpu_interface.hh
@@ -154,12 +154,12 @@
 
     static const uint8_t GIC_MIN_VBPR = 7 - VIRTUAL_PREEMPTION_BITS;
 
-    typedef struct
+    struct hppi_t
     {
         uint32_t intid;
         uint8_t prio;
         Gicv3::GroupId group;
-    } hppi_t;
+    };
 
     hppi_t hppi;
 
diff --git a/src/dev/hsa/hsa_packet.hh b/src/dev/hsa/hsa_packet.hh
index 31e7636..d4874c3 100644
--- a/src/dev/hsa/hsa_packet.hh
+++ b/src/dev/hsa/hsa_packet.hh
@@ -41,7 +41,7 @@
 namespace gem5
 {
 
-typedef struct hsa_packet_header_s
+struct hsa_packet_header_bitfield_t
 {
         // TODO: replace with more portable impl based on offset, length
         uint16_t type:8;
@@ -49,10 +49,10 @@
         uint16_t acquire_fence_scope:2;
         uint16_t release_fence_scope:2;
         uint16_t reserved:3;
-} hsa_packet_header_bitfield_t;
+};
 
 //TODO: put an _ in front of these guys to avoud prob with hsa.h for now
-typedef struct _hsa_dispatch_packet_s
+struct _hsa_dispatch_packet_t
 {
     uint16_t header;
     uint16_t setup;
@@ -69,9 +69,9 @@
     uint64_t kernarg_address;
     uint64_t reserved1;
     uint64_t completion_signal;
-} _hsa_dispatch_packet_t;
+};
 
-typedef struct _hsa_agent_dispatch_packet_s
+struct _hsa_agent_dispatch_packet_t
 {
     uint16_t header;
     uint16_t type;
@@ -80,9 +80,9 @@
     uint64_t arg[4];
     uint64_t reserved2;
     uint64_t completion_signal;
-} _hsa_agent_dispatch_packet_t;
+};
 
-typedef struct _hsa_barrier_and_packet_s
+struct _hsa_barrier_and_packet_t
 {
     uint16_t header;
     uint16_t reserved0;
@@ -90,9 +90,9 @@
     uint64_t dep_signal[5];
     uint64_t reserved2;
     uint64_t completion_signal;
-} _hsa_barrier_and_packet_t;
+};
 
-typedef struct _hsa_barrier_or_packet_s
+struct _hsa_barrier_or_packet_t
 {
     uint16_t header;
     uint16_t reserved0;
@@ -100,7 +100,7 @@
     uint64_t dep_signal[5];
     uint64_t reserved2;
     uint64_t completion_signal;
-} _hsa_barrier_or_packet_t;
+};
 
 } // namespace gem5
 
diff --git a/src/dev/hsa/hsa_packet_processor.hh b/src/dev/hsa/hsa_packet_processor.hh
index 0d7ae04..83e5525 100644
--- a/src/dev/hsa/hsa_packet_processor.hh
+++ b/src/dev/hsa/hsa_packet_processor.hh
@@ -58,7 +58,7 @@
 // Ideally, each queue should store this status and
 // the processPkt() should make decisions based on that
 // status variable.
-typedef enum
+enum Q_STATE
 {
     UNBLOCKED = 0, // Unblocked queue, can submit packets.
     BLOCKED_BBIT,  // Queue blocked by barrier bit.
@@ -67,7 +67,7 @@
     BLOCKED_BPKT,  // Queue blocked by barrier packet.
                    // Can submit packet packets after
                    // barrier packet completes.
-} Q_STATE;
+};
 
 class GPUCommandProcessor;
 class HWScheduler;
@@ -209,18 +209,17 @@
      uint64_t compltnPending() { return (_dispIdx - _rdIdx); }
 };
 
-typedef struct QueueContext
+struct QCntxt
 {
     HSAQueueDescriptor* qDesc;
     AQLRingBuffer* aqlBuf;
     // used for HSA packets that enforce synchronization with barrier bit
     bool barrierBit;
-    QueueContext(HSAQueueDescriptor* q_desc,
-                 AQLRingBuffer* aql_buf)
-                 : qDesc(q_desc), aqlBuf(aql_buf), barrierBit(false)
+    QCntxt(HSAQueueDescriptor* q_desc, AQLRingBuffer* aql_buf) :
+        qDesc(q_desc), aqlBuf(aql_buf), barrierBit(false)
     {}
-    QueueContext() : qDesc(NULL), aqlBuf(NULL), barrierBit(false) {}
-} QCntxt;
+    QCntxt() : qDesc(NULL), aqlBuf(NULL), barrierBit(false) {}
+};
 
 class HSAPacketProcessor: public DmaDevice
 {
diff --git a/src/dev/hsa/hsa_queue.hh b/src/dev/hsa/hsa_queue.hh
index 19a678c..4aa1c3b 100644
--- a/src/dev/hsa/hsa_queue.hh
+++ b/src/dev/hsa/hsa_queue.hh
@@ -39,18 +39,18 @@
 namespace gem5
 {
 
-typedef enum
+enum _hsa_queue_type_t
 {
     _HSA_QUEUE_TYPE_MULTI = 0,
     _HSA_QUEUE_TYPE_SINGLE = 1
-} _hsa_queue_type_t;
+};
 
-typedef struct _hsa_signal_s
+struct _hsa_signal_t
 {
     uint64_t handle;
-} _hsa_signal_t;
+};
 
-typedef struct _hsa_queue_s
+struct _hsa_queue_t
 {
     _hsa_queue_type_t type;
     uint32_t features;
@@ -59,11 +59,11 @@
     uint32_t size;
     uint32_t reserved1;
     uint64_t id;
-} _hsa_queue_t;
+};
 
 typedef uint32_t _amd_queue_properties32_t;
 
-typedef struct _amd_queue_s
+struct _amd_queue_t
 {
     _hsa_queue_t hsa_queue;
     uint32_t reserved1[4];
@@ -88,7 +88,7 @@
     uint32_t reserved3[2];
     _hsa_signal_t queue_inactive_signal;
     uint32_t reserved4[14];
-} _amd_queue_t;
+};
 
 } // namespace gem5
 
diff --git a/src/dev/storage/ide_disk.hh b/src/dev/storage/ide_disk.hh
index bfe9f9b..95eec24 100644
--- a/src/dev/storage/ide_disk.hh
+++ b/src/dev/storage/ide_disk.hh
@@ -69,12 +69,12 @@
 #define PRD_COUNT_MASK 0xfffe
 #define PRD_EOT_MASK   0x8000
 
-typedef struct PrdEntry
+struct PrdEntry_t
 {
     uint32_t baseAddr;
     uint16_t byteCount;
     uint16_t endOfTable;
-} PrdEntry_t;
+};
 
 class PrdTableEntry
 {
@@ -126,7 +126,7 @@
 #define DEV0 (0)
 #define DEV1 (1)
 
-typedef struct CommandReg
+struct CommandReg_t
 {
     uint16_t data;
     uint8_t error;
@@ -140,9 +140,9 @@
         uint8_t head;
     };
     uint8_t command;
-} CommandReg_t;
+};
 
-typedef enum Events
+enum Events_t
 {
     None = 0,
     Transfer,
@@ -151,9 +151,9 @@
     PrdRead,
     DmaRead,
     DmaWrite
-} Events_t;
+};
 
-typedef enum DevAction
+enum DevAction_t
 {
     ACT_NONE = 0,
     ACT_CMD_WRITE,
@@ -170,9 +170,9 @@
     ACT_DMA_DONE,
     ACT_SRST_SET,
     ACT_SRST_CLEAR
-} DevAction_t;
+};
 
-typedef enum DevState
+enum DevState_t
 {
     // Device idle
     Device_Idle_S = 0,
@@ -199,14 +199,14 @@
     Prepare_Data_Dma,
     Transfer_Data_Dma,
     Device_Dma_Abort
-} DevState_t;
+};
 
-typedef enum DmaState
+enum DmaState_t
 {
     Dma_Idle = 0,
     Dma_Start,
     Dma_Transfer
-} DmaState_t;
+};
 
 class IdeController;
 
diff --git a/src/kern/linux/linux.hh b/src/kern/linux/linux.hh
index 7e1df58..6232f61 100644
--- a/src/kern/linux/linux.hh
+++ b/src/kern/linux/linux.hh
@@ -64,7 +64,7 @@
     /// Stat buffer.  Note that we can't call it 'stat' since that
     /// gets #defined to something else on some systems. This type
     /// can be specialized by architecture specific "Linux" classes
-    typedef struct
+    struct tgt_stat
     {
         uint32_t        st_dev;         //!< device
         uint32_t        st_ino;         //!< inode
@@ -82,10 +82,10 @@
         int32_t         st_blocks;      //!< number of blocks allocated
         uint32_t        st_flags;       //!< flags
         uint32_t        st_gen;         //!< unknown
-    } tgt_stat;
+    };
 
     // same for stat64
-    typedef struct
+    struct tgt_stat64
     {
         uint64_t        st_dev;
         uint64_t        st_ino;
@@ -107,7 +107,7 @@
         uint64_t        st_ctimeX;
         uint64_t        st_ctime_nsec;
         int64_t         ___unused[3];
-    } tgt_stat64;
+    };
 
     /// Length of strings in struct utsname (plus 1 for null char).
     static const int _SYS_NMLN = 65;
diff --git a/src/kern/operatingsystem.hh b/src/kern/operatingsystem.hh
index 014397e..fbbad1f 100644
--- a/src/kern/operatingsystem.hh
+++ b/src/kern/operatingsystem.hh
@@ -61,39 +61,39 @@
     static const int _SYS_NMLN = 65;
 
     /// Interface struct for uname().
-    typedef struct
+    struct utsname
     {
         char sysname[_SYS_NMLN];        //!< System name.
         char nodename[_SYS_NMLN];       //!< Node name.
         char release[_SYS_NMLN];        //!< OS release.
         char version[_SYS_NMLN];        //!< OS version.
         char machine[_SYS_NMLN];        //!< Machine type.
-    } utsname;
+    };
 
     /// Limit struct for getrlimit/setrlimit.
-    typedef struct
+    struct rlimit
     {
         uint64_t  rlim_cur;     //!< soft limit
         uint64_t  rlim_max;     //!< hard limit
-    } rlimit;
+    };
 
     /// For gettimeofday().
-    typedef struct
+    struct timeval
     {
         int64_t tv_sec;         //!< seconds
         int64_t tv_usec;        //!< microseconds
-    } timeval;
+    };
 
     // For writev/readv
-    typedef struct
+    struct tgt_iovec
     {
         uint64_t iov_base; // void *
         uint64_t iov_len;
-    } tgt_iovec;
+    };
 
 
     /// For getrusage().
-    typedef struct
+    struct rusage
     {
         timeval ru_utime;       //!< user time used
         timeval ru_stime;       //!< system time used
@@ -111,7 +111,7 @@
         int64_t ru_nsignals;            //!< signals received
         int64_t ru_nvcsw;               //!< voluntary context switches
         int64_t ru_nivcsw;              //!< involuntary "
-    } rusage;
+    };
 
     static int openSpecialFile(std::string path, Process *process,
                                ThreadContext *tc);
diff --git a/src/kern/solaris/solaris.hh b/src/kern/solaris/solaris.hh
index 6944bc5..0e6b72a 100644
--- a/src/kern/solaris/solaris.hh
+++ b/src/kern/solaris/solaris.hh
@@ -67,7 +67,7 @@
 
     /// Stat buffer.  Note that we can't call it 'stat' since that
     /// gets #defined to something else on some systems.
-    typedef struct
+    struct tgt_stat
     {
         uint64_t        st_dev;         //!< device
         uint64_t        st_ino;         //!< inode
@@ -84,10 +84,10 @@
         int32_t         st_blksize;     //!< optimal I/O block size
         int64_t         st_blocks;      //!< number of blocks allocated
         char            st_fstype[16];
-    } tgt_stat;
+    };
 
     // same for stat64
-    typedef struct
+    struct tgt_stat64
     {
         uint64_t        st_dev;         //!< device
         uint64_t        st_ino;         //!< inode
@@ -104,20 +104,20 @@
         int32_t         st_blksize;     //!< optimal I/O block size
         int64_t         st_blocks;      //!< number of blocks allocated
         char            st_fstype[16];
-    } tgt_stat64;
+    };
 
     /// Length of strings in struct utsname (plus 1 for null char).
     static const int _SYS_NMLN = 257;
 
     /// Interface struct for uname().
-    typedef struct utsname
+    struct utsname
     {
         char sysname[_SYS_NMLN];        //!< System name.
         char nodename[_SYS_NMLN];       //!< Node name.
         char release[_SYS_NMLN];        //!< OS release.
         char version[_SYS_NMLN];        //!< OS version.
         char machine[_SYS_NMLN];        //!< Machine type.
-    } utsname;
+    };
 
     // for *at syscalls
     static const int TGT_AT_FDCWD   = -100;
diff --git a/src/mem/cache/compressors/base_delta.hh b/src/mem/cache/compressors/base_delta.hh
index 93539da..81f2c4b 100644
--- a/src/mem/cache/compressors/base_delta.hh
+++ b/src/mem/cache/compressors/base_delta.hh
@@ -85,10 +85,10 @@
      * These are used as indexes to reference the pattern data. If a new
      * pattern is added, it must be done before NUM_PATTERNS.
      */
-    typedef enum
+    enum PatternNumber
     {
         X, M, NUM_PATTERNS
-    } PatternNumber;
+    };
 
     uint64_t getNumPatterns() const override { return NUM_PATTERNS; }
 
diff --git a/src/mem/cache/compressors/cpack.hh b/src/mem/cache/compressors/cpack.hh
index ecfcb25..51f5ce1 100644
--- a/src/mem/cache/compressors/cpack.hh
+++ b/src/mem/cache/compressors/cpack.hh
@@ -69,10 +69,10 @@
      * These are used as indexes to reference the pattern data. If a new
      * pattern is added, it must be done before NUM_PATTERNS.
      */
-    typedef enum
+    enum PatternNumber
     {
         ZZZZ, XXXX, MMMM, MMXX, ZZZX, MMMX, NUM_PATTERNS
-    } PatternNumber;
+    };
 
     /**
      * Convenience factory declaration. The templates must be organized by
diff --git a/src/mem/cache/compressors/fpc.hh b/src/mem/cache/compressors/fpc.hh
index bfe5089..9dd40fb 100644
--- a/src/mem/cache/compressors/fpc.hh
+++ b/src/mem/cache/compressors/fpc.hh
@@ -80,13 +80,13 @@
      * The possible patterns. If a new pattern is added, it must be done
      * before NUM_PATTERNS.
      */
-    typedef enum
+    enum PatternNumber
     {
         ZERO_RUN, SIGN_EXTENDED_4_BITS, SIGN_EXTENDED_1_BYTE,
         SIGN_EXTENDED_HALFWORD, ZERO_PADDED_HALFWORD,
         SIGN_EXTENDED_TWO_HALFWORDS, REP_BYTES, UNCOMPRESSED,
         NUM_PATTERNS
-    } PatternNumber;
+    };
 
     /**
      * Number of bits of the zero run size bitfield. If the size of the
diff --git a/src/mem/cache/compressors/fpcd.hh b/src/mem/cache/compressors/fpcd.hh
index b424bef..d1ee015 100644
--- a/src/mem/cache/compressors/fpcd.hh
+++ b/src/mem/cache/compressors/fpcd.hh
@@ -97,12 +97,12 @@
      * These are used as indexes to reference the pattern data. If a new
      * pattern is added, it must be done before NUM_PATTERNS.
      */
-    typedef enum
+    enum PatternNumber
     {
         ZZZZ, FFFF, MMMMPenultimate, MMMMPrevious, ZZZX, XZZZ, RRRR,
         MMMXPenultimate, MMMXPrevious, ZZXX, ZXZX, FFXX, XXZZ,
         MMXXPenultimate, MMXXPrevious, XXXX, NUM_PATTERNS
-    } PatternNumber;
+    };
 
     /**
      * Convenience factory declaration. The templates must be organized by
diff --git a/src/mem/cache/compressors/repeated_qwords.hh b/src/mem/cache/compressors/repeated_qwords.hh
index 5f2ec30..3e900a1 100644
--- a/src/mem/cache/compressors/repeated_qwords.hh
+++ b/src/mem/cache/compressors/repeated_qwords.hh
@@ -65,10 +65,10 @@
      * These are used as indexes to reference the pattern data. If a new
      * pattern is added, it must be done before NUM_PATTERNS.
      */
-    typedef enum
+    enum PatternNumber
     {
         X, M, NUM_PATTERNS
-    } PatternNumber;
+    };
 
     /**
      * Convenience factory declaration. The templates must be organized by
diff --git a/src/mem/cache/compressors/zero.hh b/src/mem/cache/compressors/zero.hh
index d6996ea..6e8ce34 100644
--- a/src/mem/cache/compressors/zero.hh
+++ b/src/mem/cache/compressors/zero.hh
@@ -65,10 +65,10 @@
      * These are used as indexes to reference the pattern data. If a new
      * pattern is added, it must be done before NUM_PATTERNS.
      */
-    typedef enum
+    enum PatternNumber
     {
         X, Z, NUM_PATTERNS
-    } PatternNumber;
+    };
 
     /**
      * Convenience factory declaration. The templates must be organized by