Skip to content

Commit

Permalink
target: Unify QOM style
Browse files Browse the repository at this point in the history
Enforce the style described by commit 067109a ("docs/devel:
mention the spacing requirement for QOM"):

  The first declaration of a storage or class structure should
  always be the parent and leave a visual space between that
  declaration and the new code. It is also useful to separate
  backing for properties (options driven by the user) and internal
  state to make navigation easier.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20231013140116.255-2-philmd@linaro.org>
  • Loading branch information
philmd committed Nov 7, 2023
1 parent bb6cf6f commit 6ee45fa
Show file tree
Hide file tree
Showing 37 changed files with 4 additions and 84 deletions.
2 changes: 0 additions & 2 deletions target/alpha/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(AlphaCPU, AlphaCPUClass, ALPHA_CPU)
* An Alpha CPU model.
*/
struct AlphaCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
DeviceReset parent_reset;
Expand Down
2 changes: 0 additions & 2 deletions target/alpha/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,7 @@ typedef struct CPUArchState {
* An Alpha CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUAlphaState env;

Expand Down
4 changes: 0 additions & 4 deletions target/arm/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ void aarch64_cpu_register(const ARMCPUInfo *info);
* An ARM CPU model.
*/
struct ARMCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

const ARMCPUInfo *info;
DeviceRealize parent_realize;
Expand All @@ -62,9 +60,7 @@ DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU,
TYPE_AARCH64_CPU)

struct AArch64CPUClass {
/*< private >*/
ARMCPUClass parent_class;
/*< public >*/
};

void register_cp_regs_for_features(ARMCPU *cpu);
Expand Down
2 changes: 0 additions & 2 deletions target/arm/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -852,9 +852,7 @@ typedef struct {
* An ARM CPU core.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUARMState env;

Expand Down
3 changes: 1 addition & 2 deletions target/avr/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ OBJECT_DECLARE_CPU_TYPE(AVRCPU, AVRCPUClass, AVR_CPU)
* A AVR CPU model.
*/
struct AVRCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
};
Expand Down
2 changes: 0 additions & 2 deletions target/avr/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ typedef struct CPUArchState {
* A AVR CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUAVRState env;
};
Expand Down
2 changes: 0 additions & 2 deletions target/cris/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ OBJECT_DECLARE_CPU_TYPE(CRISCPU, CRISCPUClass, CRIS_CPU)
* A CRIS CPU model.
*/
struct CRISCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down
2 changes: 0 additions & 2 deletions target/cris/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ typedef struct CPUArchState {
* A CRIS CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUCRISState env;
};
Expand Down
5 changes: 1 addition & 4 deletions target/hexagon/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,14 @@ typedef struct CPUArchState {
OBJECT_DECLARE_CPU_TYPE(HexagonCPU, HexagonCPUClass, HEXAGON_CPU)

typedef struct HexagonCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
} HexagonCPUClass;

struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUHexagonState env;

Expand Down
2 changes: 0 additions & 2 deletions target/hppa/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ OBJECT_DECLARE_CPU_TYPE(HPPACPU, HPPACPUClass, HPPA_CPU)
* An HPPA CPU model.
*/
struct HPPACPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
DeviceReset parent_reset;
Expand Down
2 changes: 0 additions & 2 deletions target/hppa/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ typedef struct CPUArchState {
* An HPPA CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUHPPAState env;
QEMUTimer *alarm_timer;
Expand Down
2 changes: 0 additions & 2 deletions target/i386/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ typedef struct X86CPUModel X86CPUModel;
* An x86 CPU model or family.
*/
struct X86CPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

/* CPU definition, automatically loaded by instance_init if not NULL.
* Should be eventually replaced by subclass-specific property defaults.
Expand Down
2 changes: 0 additions & 2 deletions target/i386/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1897,9 +1897,7 @@ struct kvm_msrs;
* An x86 CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUX86State env;
VMChangeStateEntry *vmsentry;
Expand Down
4 changes: 0 additions & 4 deletions target/loongarch/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,7 @@ typedef struct CPUArchState {
* A LoongArch CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPULoongArchState env;
QEMUTimer timer;
Expand All @@ -398,9 +396,7 @@ OBJECT_DECLARE_CPU_TYPE(LoongArchCPU, LoongArchCPUClass,
* A LoongArch CPU model.
*/
struct LoongArchCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down
2 changes: 0 additions & 2 deletions target/m68k/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(M68kCPU, M68kCPUClass, M68K_CPU)
* A Motorola 68k CPU model.
*/
struct M68kCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down
2 changes: 0 additions & 2 deletions target/m68k/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ typedef struct CPUArchState {
* A Motorola 68k CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUM68KState env;
};
Expand Down
2 changes: 0 additions & 2 deletions target/microblaze/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ OBJECT_DECLARE_CPU_TYPE(MicroBlazeCPU, MicroBlazeCPUClass, MICROBLAZE_CPU)
* A MicroBlaze CPU model.
*/
struct MicroBlazeCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down
2 changes: 0 additions & 2 deletions target/microblaze/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,7 @@ typedef struct {
* A MicroBlaze CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUMBState env;

Expand Down
2 changes: 0 additions & 2 deletions target/mips/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ OBJECT_DECLARE_CPU_TYPE(MIPSCPU, MIPSCPUClass, MIPS_CPU)
* A MIPS CPU model.
*/
struct MIPSCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down
2 changes: 0 additions & 2 deletions target/mips/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1209,9 +1209,7 @@ typedef struct CPUArchState {
* A MIPS CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUMIPSState env;

Expand Down
4 changes: 0 additions & 4 deletions target/nios2/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ OBJECT_DECLARE_CPU_TYPE(Nios2CPU, Nios2CPUClass, NIOS2_CPU)
* A Nios2 CPU model.
*/
struct Nios2CPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down Expand Up @@ -214,9 +212,7 @@ typedef struct {
* A Nios2 CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUNios2State env;

Expand Down
4 changes: 0 additions & 4 deletions target/openrisc/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ OBJECT_DECLARE_CPU_TYPE(OpenRISCCPU, OpenRISCCPUClass, OPENRISC_CPU)
* A OpenRISC CPU model.
*/
struct OpenRISCCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down Expand Up @@ -301,9 +299,7 @@ typedef struct CPUArchState {
* A OpenRISC CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUOpenRISCState env;
};
Expand Down
2 changes: 0 additions & 2 deletions target/ppc/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1313,9 +1313,7 @@ typedef struct PPCVirtualHypervisorClass PPCVirtualHypervisorClass;
* A PowerPC CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUPPCState env;

Expand Down
3 changes: 1 addition & 2 deletions target/riscv/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CPU)
* A RISCV CPU model.
*/
struct RISCVCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
};
Expand Down
2 changes: 0 additions & 2 deletions target/riscv/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,7 @@ struct CPUArchState {
* A RISCV CPU.
*/
struct ArchCPU {
/* < private > */
CPUState parent_obj;
/* < public > */

CPURISCVState env;

Expand Down
2 changes: 0 additions & 2 deletions target/rx/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ OBJECT_DECLARE_CPU_TYPE(RXCPU, RXCPUClass, RX_CPU)
* A RX CPU model.
*/
struct RXCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down
2 changes: 0 additions & 2 deletions target/rx/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ typedef struct CPUArchState {
* A RX CPU
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPURXState env;
};
Expand Down
3 changes: 1 addition & 2 deletions target/s390x/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ typedef enum cpu_reset_type {
* An S/390 CPU model.
*/
struct S390CPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

const S390CPUDef *cpu_def;
bool kvm_required;
bool is_static;
Expand Down
2 changes: 0 additions & 2 deletions target/s390x/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ static inline uint64_t *get_freg(CPUS390XState *cs, int nr)
* An S/390 CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUS390XState env;
S390CPUModel *model;
Expand Down
2 changes: 0 additions & 2 deletions target/sh4/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ OBJECT_DECLARE_CPU_TYPE(SuperHCPU, SuperHCPUClass, SUPERH_CPU)
* A SuperH CPU model.
*/
struct SuperHCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down
2 changes: 0 additions & 2 deletions target/sh4/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ typedef struct CPUArchState {
* A SuperH CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUSH4State env;
};
Expand Down
2 changes: 0 additions & 2 deletions target/sparc/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ typedef struct sparc_def_t sparc_def_t;
* A SPARC CPU model.
*/
struct SPARCCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down
2 changes: 0 additions & 2 deletions target/sparc/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,7 @@ struct CPUArchState {
* A SPARC CPU.
*/
struct ArchCPU {
/*< private >*/
CPUState parent_obj;
/*< public >*/

CPUSPARCState env;
};
Expand Down
2 changes: 0 additions & 2 deletions target/tricore/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
OBJECT_DECLARE_CPU_TYPE(TriCoreCPU, TriCoreCPUClass, TRICORE_CPU)

struct TriCoreCPUClass {
/*< private >*/
CPUClass parent_class;
/*< public >*/

DeviceRealize parent_realize;
ResettablePhases parent_phases;
Expand Down

0 comments on commit 6ee45fa

Please sign in to comment.