Re: [PATCH v2 09/71] target/loongarch: Constify VMState in machine.c

2023-12-20 Thread gaosong

在 2023/12/21 上午11:15, Richard Henderson 写道:

Signed-off-by: Richard Henderson 
---
  target/loongarch/machine.c | 18 +-
  1 file changed, 9 insertions(+), 9 deletions(-)

Reviewed-by: Song Gao 

Thanks.
Song Gao

diff --git a/target/loongarch/machine.c b/target/loongarch/machine.c
index 1c4e01d076..c7029fb9b4 100644
--- a/target/loongarch/machine.c
+++ b/target/loongarch/machine.c
@@ -14,7 +14,7 @@ static const VMStateDescription vmstate_fpu_reg = {
  .name = "fpu_reg",
  .version_id = 1,
  .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
  VMSTATE_UINT64(UD(0), VReg),
  VMSTATE_END_OF_LIST()
  }
@@ -36,7 +36,7 @@ static const VMStateDescription vmstate_fpu = {
  .version_id = 1,
  .minimum_version_id = 1,
  .needed = fpu_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
  VMSTATE_FPU_REGS(env.fpr, LoongArchCPU, 0),
  VMSTATE_UINT32(env.fcsr0, LoongArchCPU),
  VMSTATE_BOOL_ARRAY(env.cf, LoongArchCPU, 8),
@@ -48,7 +48,7 @@ static const VMStateDescription vmstate_lsxh_reg = {
  .name = "lsxh_reg",
  .version_id = 1,
  .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
  VMSTATE_UINT64(UD(1), VReg),
  VMSTATE_END_OF_LIST()
  }
@@ -70,7 +70,7 @@ static const VMStateDescription vmstate_lsx = {
  .version_id = 1,
  .minimum_version_id = 1,
  .needed = lsx_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
  VMSTATE_LSXH_REGS(env.fpr, LoongArchCPU, 0),
  VMSTATE_END_OF_LIST()
  },
@@ -80,7 +80,7 @@ static const VMStateDescription vmstate_lasxh_reg = {
  .name = "lasxh_reg",
  .version_id = 1,
  .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
  VMSTATE_UINT64(UD(2), VReg),
  VMSTATE_UINT64(UD(3), VReg),
  VMSTATE_END_OF_LIST()
@@ -103,7 +103,7 @@ static const VMStateDescription vmstate_lasx = {
  .version_id = 1,
  .minimum_version_id = 1,
  .needed = lasx_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
  VMSTATE_LASXH_REGS(env.fpr, LoongArchCPU, 0),
  VMSTATE_END_OF_LIST()
  },
@@ -114,7 +114,7 @@ const VMStateDescription vmstate_tlb = {
  .name = "cpu/tlb",
  .version_id = 0,
  .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
  VMSTATE_UINT64(tlb_misc, LoongArchTLB),
  VMSTATE_UINT64(tlb_entry0, LoongArchTLB),
  VMSTATE_UINT64(tlb_entry1, LoongArchTLB),
@@ -127,7 +127,7 @@ const VMStateDescription vmstate_loongarch_cpu = {
  .name = "cpu",
  .version_id = 1,
  .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
  VMSTATE_UINTTL_ARRAY(env.gpr, LoongArchCPU, 32),
  VMSTATE_UINTTL(env.pc, LoongArchCPU),
  
@@ -193,7 +193,7 @@ const VMStateDescription vmstate_loongarch_cpu = {
  
  VMSTATE_END_OF_LIST()

  },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
  _fpu,
  _lsx,
  _lasx,





[PATCH v2 09/71] target/loongarch: Constify VMState in machine.c

2023-12-20 Thread Richard Henderson
Signed-off-by: Richard Henderson 
---
 target/loongarch/machine.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/target/loongarch/machine.c b/target/loongarch/machine.c
index 1c4e01d076..c7029fb9b4 100644
--- a/target/loongarch/machine.c
+++ b/target/loongarch/machine.c
@@ -14,7 +14,7 @@ static const VMStateDescription vmstate_fpu_reg = {
 .name = "fpu_reg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(UD(0), VReg),
 VMSTATE_END_OF_LIST()
 }
@@ -36,7 +36,7 @@ static const VMStateDescription vmstate_fpu = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = fpu_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_FPU_REGS(env.fpr, LoongArchCPU, 0),
 VMSTATE_UINT32(env.fcsr0, LoongArchCPU),
 VMSTATE_BOOL_ARRAY(env.cf, LoongArchCPU, 8),
@@ -48,7 +48,7 @@ static const VMStateDescription vmstate_lsxh_reg = {
 .name = "lsxh_reg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(UD(1), VReg),
 VMSTATE_END_OF_LIST()
 }
@@ -70,7 +70,7 @@ static const VMStateDescription vmstate_lsx = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = lsx_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_LSXH_REGS(env.fpr, LoongArchCPU, 0),
 VMSTATE_END_OF_LIST()
 },
@@ -80,7 +80,7 @@ static const VMStateDescription vmstate_lasxh_reg = {
 .name = "lasxh_reg",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(UD(2), VReg),
 VMSTATE_UINT64(UD(3), VReg),
 VMSTATE_END_OF_LIST()
@@ -103,7 +103,7 @@ static const VMStateDescription vmstate_lasx = {
 .version_id = 1,
 .minimum_version_id = 1,
 .needed = lasx_needed,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_LASXH_REGS(env.fpr, LoongArchCPU, 0),
 VMSTATE_END_OF_LIST()
 },
@@ -114,7 +114,7 @@ const VMStateDescription vmstate_tlb = {
 .name = "cpu/tlb",
 .version_id = 0,
 .minimum_version_id = 0,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINT64(tlb_misc, LoongArchTLB),
 VMSTATE_UINT64(tlb_entry0, LoongArchTLB),
 VMSTATE_UINT64(tlb_entry1, LoongArchTLB),
@@ -127,7 +127,7 @@ const VMStateDescription vmstate_loongarch_cpu = {
 .name = "cpu",
 .version_id = 1,
 .minimum_version_id = 1,
-.fields = (VMStateField[]) {
+.fields = (const VMStateField[]) {
 VMSTATE_UINTTL_ARRAY(env.gpr, LoongArchCPU, 32),
 VMSTATE_UINTTL(env.pc, LoongArchCPU),
 
@@ -193,7 +193,7 @@ const VMStateDescription vmstate_loongarch_cpu = {
 
 VMSTATE_END_OF_LIST()
 },
-.subsections = (const VMStateDescription*[]) {
+.subsections = (const VMStateDescription * const []) {
 _fpu,
 _lsx,
 _lasx,
-- 
2.34.1