On 3/27/23 15:15, Daniel Henrique Barboza wrote:


On 3/27/23 15:52, Richard Henderson wrote:
On 3/27/23 05:42, Daniel Henrique Barboza wrote:
+static void cpu_set_misa_ext_cfg(Object *obj, Visitor *v, const char *name,
+                                 void *opaque, Error **errp)
+{
+    RISCVCPUMisaExtConfig *misa_ext_cfg = opaque;

const

+static void cpu_get_misa_ext_cfg(Object *obj, Visitor *v, const char *name,
+                                 void *opaque, Error **errp)
+{
+    RISCVCPUMisaExtConfig *misa_ext_cfg = opaque;

const

+static RISCVCPUMisaExtConfig misa_ext_cfgs[] = {};

const

It seems that I can't use 'const' because the object_property_add() API uses a 
'void *opaque'
pointer and it won't take a "const RISCVCPUMisaExtConfig *":

../target/riscv/cpu.c:1454:35: error: passing argument 7 of ‘object_property_add’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  1454 |                             NULL, misa_cfg);
       |                                   ^~~~~~~~

You can cast away the const. There's no need for this array to be outside of .rodata (or .data.rel.ro).


r~

Reply via email to