Re: [PATCH v7 07/12] target/riscv/cpu.c: add ADD_CPU_QDEV_PROPERTIES_ARRAY() macro

2023-08-15 Thread Richard Henderson
On 8/15/23 14:15, Daniel Henrique Barboza wrote: I assume that you don't fancy this macro usage, and probably for a good reason, I prefer to use macros only for things that cannot be done another way. When debugging, one cannot step through macros in any reasonable way. r~

Re: [PATCH v7 07/12] target/riscv/cpu.c: add ADD_CPU_QDEV_PROPERTIES_ARRAY() macro

2023-08-15 Thread Daniel Henrique Barboza
On 8/15/23 17:44, Richard Henderson wrote: On 8/15/23 13:15, Daniel Henrique Barboza wrote: @@ -1883,6 +1883,13 @@ static void cpu_set_cfg_unavailable(Object *obj, Visitor *v,   }   #endif +#define ADD_CPU_QDEV_PROPERTIES_ARRAY(_dev, _array) \ +    do { \ +    for (Property *prop = _arra

Re: [PATCH v7 07/12] target/riscv/cpu.c: add ADD_CPU_QDEV_PROPERTIES_ARRAY() macro

2023-08-15 Thread Richard Henderson
On 8/15/23 13:15, Daniel Henrique Barboza wrote: @@ -1883,6 +1883,13 @@ static void cpu_set_cfg_unavailable(Object *obj, Visitor *v, } #endif +#define ADD_CPU_QDEV_PROPERTIES_ARRAY(_dev, _array) \ +do { \ +for (Property *prop = _array; prop && prop->name; prop++) { \ +

[PATCH v7 07/12] target/riscv/cpu.c: add ADD_CPU_QDEV_PROPERTIES_ARRAY() macro

2023-08-15 Thread Daniel Henrique Barboza
The code inside riscv_cpu_add_user_properties() became quite repetitive after recent changes. Add a macro to hide the repetition away. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Weiwei Li --- target/riscv/cpu.c | 27 +++ 1 file changed, 11 insertions(+), 16 dele