qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] tests/unit/test-smp-parse: Fix a check-patch complain


From: wangyanan (Y)
Subject: Re: [PATCH 2/2] tests/unit/test-smp-parse: Fix a check-patch complain
Date: Wed, 10 Nov 2021 19:37:25 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0


On 2021/11/10 18:16, Markus Armbruster wrote:
Yanan Wang <wangyanan55@huawei.com> writes:

Checkpatch.pl reports errors like below for commit 9e8e393bb7. Fix it.
ERROR: space required after that close brace '}'
+    SMPTestData *data = &(SMPTestData){{ }};

Fixes: 9e8e393bb7 ("tests/unit: Add an unit test for smp parsing")
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
---
  tests/unit/test-smp-parse.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c
index 872512aa37..3627fe61ad 100644
--- a/tests/unit/test-smp-parse.c
+++ b/tests/unit/test-smp-parse.c
@@ -514,7 +514,7 @@ static void test_generic(void)
      Object *obj = smp_test_machine_init();
      MachineState *ms = MACHINE(obj);
      MachineClass *mc = MACHINE_GET_CLASS(obj);
-    SMPTestData *data = &(SMPTestData){{ }};
+    SMPTestData *data = &(SMPTestData){ {0} };
      int i;
for (i = 0; i < ARRAY_SIZE(data_generic_valid); i++) {
@@ -548,7 +548,7 @@ static void test_with_dies(void)
      Object *obj = smp_test_machine_init();
      MachineState *ms = MACHINE(obj);
      MachineClass *mc = MACHINE_GET_CLASS(obj);
-    SMPTestData *data = &(SMPTestData){{ }};
+    SMPTestData *data = &(SMPTestData){ {0} };
      unsigned int num_dies = 2;
      int i;
Why not

        SMPTestData *data = &(SMPTestData){};

?

Much simpler. Having tested {} format, it also works in zeroing the structure.
And it seems to have been mostly used in qemu. I will update.

The original double-layer braces tried to satisfy a clang compile warning:
"suggest braces around initialization of subobject [-Werror,-Wmissing-braces]". But I assume {} *without* explicit 0 in it just won't trigger the warning. (?)

Thanks,
Yanan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]