Eduardo Habkost <ehabk...@redhat.com> wrote: > On Fri, Feb 22, 2013 at 02:22:43PM +0100, Juan Quintela wrote: >> Andreas Färber <afaer...@suse.de> wrote: >> > Commit b758aca1f6cdb175634812b79f5560c36c902d00 (target-alpha: Enable >> > the alpha-softmmu target.) introduced cpu_{save,load}() functions but >> > didn't define CPU_SAVE_VERSION, so they were never registered. >> > >> > Drop cpu_{save,load}() and register the VMStateDescription via CPUClass. >> > This operates on the AlphaCPU object instead of CPUAlphaState. >> > >> > Signed-off-by: Andreas Färber <afaer...@suse.de> >> >> >> Seeing that we are repeating the code all around. Could we change this >> to something like: >> >> > >> > #define ENV_GET_CPU(e) CPU(alpha_env_get_cpu(e)) >> > >> > +#ifdef CONFIG_USER_ONLY >> > +#define vmstate_alpha_cpu vmstate_dummy >> > +#else >> > +extern const struct VMStateDescription vmstate_alpha_cpu; >> > +#endif >> > + >> >> Change this to: >> >> #ifdef CONFIG_USER_ONLY >> #define vmstate_register_cpu(unused, unused) >> #else >> #define vmstate_register_cpu(env, vmstate_cpu) (env->vmsd = vmstate_cpu) >> #endif > > I like this approach. But using a macro is going to cause unexpected > "variable is unused" gcc warnings. Can we make it a static inline > function instead?
types are different, we can pas a pointer to the vmstate, so (untested)) static inline void vmstate_register_cpu(struct VMStateDescritpion **arg, struct VMStateDescription *vmstate_cpu) { *arg = vmstate_cpu; } Andreas?