misc: Fix coding style for struct's opening braces

The systemc dir was not included in this fix.

First it was identified that there were only occurrences
at 0, 1, 2 and 3 levels of indentation (and a single
occurrence of 2 and 3 spaces), using:

    grep -nrE --exclude-dir=systemc \
        "^ *struct [A-Za-z].* {$" src/

Then the following commands were run to replace:

<indent level>struct X ... {

by:

<indent level>struct X ...
<indent level>{

Level 0:
    grep -nrl --exclude-dir=systemc
        "^struct [A-Za-z].* {$" src/ | \
        xargs sed -Ei \
        's/^struct ([A-Za-z].*) \{$/struct \1\n\{/g'

Level 1:
    grep -nrl --exclude-dir=systemc \
        "^    struct [A-Za-z].* {$" src/ | \
        xargs sed -Ei \
        's/^    struct ([A-Za-z].*) \{$/    struct \1\n    \{/g'

and so on.

Change-Id: I362ef58c86912dabdd272c7debb8d25d587cd455
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39017
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel R. Carvalho
2021-01-09 12:28:03 -03:00
committed by Daniel Carvalho
parent f96de41fcf
commit 2922f763e1
109 changed files with 584 additions and 292 deletions

View File

@@ -464,7 +464,8 @@ class VirtQueue : public Serializable
typedef uint16_t Flags;
typedef uint16_t Index;
struct M5_ATTR_PACKED Header {
struct M5_ATTR_PACKED Header
{
Flags flags;
Index index;
};

View File

@@ -81,7 +81,8 @@ class VirtIOBlock : public VirtIODeviceBase
* @note This needs to be changed if the supported feature set
* changes!
*/
struct M5_ATTR_PACKED Config {
struct M5_ATTR_PACKED Config
{
uint64_t capacity;
};
Config config;
@@ -122,7 +123,8 @@ class VirtIOBlock : public VirtIODeviceBase
/** @} */
/** VirtIO block device request as sent by guest */
struct M5_ATTR_PACKED BlkRequest {
struct M5_ATTR_PACKED BlkRequest
{
RequestType type;
uint32_t reserved;
uint64_t sector;

View File

@@ -77,7 +77,8 @@ class VirtIOConsole : public VirtIODeviceBase
* @note This needs to be changed if the multiport feature is
* announced!
*/
struct M5_ATTR_PACKED Config {
struct M5_ATTR_PACKED Config
{
uint16_t cols;
uint16_t rows;
};

View File

@@ -60,7 +60,8 @@
#include "params/VirtIO9PSocket.hh"
#include "sim/system.hh"
struct P9MsgInfo {
struct P9MsgInfo
{
P9MsgInfo(P9MsgType _type, std::string _name)
: type(_type), name(_name) {}

View File

@@ -50,7 +50,8 @@ struct VirtIO9PBaseParams;
typedef uint8_t P9MsgType;
typedef uint16_t P9Tag;
struct M5_ATTR_PACKED P9MsgHeader {
struct M5_ATTR_PACKED P9MsgHeader
{
/** Length including header */
uint32_t len;
/** Message type */
@@ -120,7 +121,8 @@ class VirtIO9PBase : public VirtIODeviceBase
* @note The fields in this structure depend on the features
* exposed to the guest.
*/
struct M5_ATTR_PACKED Config {
struct M5_ATTR_PACKED Config
{
uint16_t len;
char tag[];
};

View File

@@ -59,7 +59,8 @@
#define VIRTIO_RING_F_EVENT_IDX 29
/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
struct vring_desc {
struct vring_desc
{
/* Address (guest-physical). */
uint64_t addr;
/* Length. */
@@ -70,27 +71,31 @@ struct vring_desc {
uint16_t next;
};
struct vring_avail {
struct vring_avail
{
uint16_t flags;
uint16_t idx;
uint16_t ring[];
};
/* u32 is used here for ids for padding reasons. */
struct vring_used_elem {
struct vring_used_elem
{
/* Index of start of used descriptor chain. */
uint32_t id;
/* Total length of the descriptor chain which was used (written to) */
uint32_t len;
};
struct vring_used {
struct vring_used
{
uint16_t flags;
uint16_t idx;
struct vring_used_elem ring[];
};
struct vring {
struct vring
{
unsigned int num;
struct vring_desc *desc;