On Mon, 28 Nov 2022 at 13:09, Juan Quintela <quint...@redhat.com> wrote: > > From: "Dr. David Alan Gilbert" <dgilb...@redhat.com> > > Perform a check on vmsd structures during test runs in the hope > of catching any missing terminators and other simple screwups. > > Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com> > Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> > Reviewed-by: Juan Quintela <quint...@redhat.com> > Signed-off-by: Juan Quintela <quint...@redhat.com>
> +/* > + * Perform some basic checks on vmsd's at registration > + * time. > + */ > +static void vmstate_check(const VMStateDescription *vmsd) > +{ > + const VMStateField *field = vmsd->fields; > + const VMStateDescription **subsection = vmsd->subsections; > + > + if (field) { > + while (field->name) { > + if (field->flags & (VMS_STRUCT | VMS_VSTRUCT)) { > + /* Recurse to sub structures */ > + vmstate_check(field->vmsd); > + } > + /* Carry on */ > + field++; > + } > + /* Check for the end of field list canary */ > + if (field->flags != VMS_END) { > + error_report("VMSTATE not ending with VMS_END: %s", vmsd->name); This is always a bug, right, so what prevents us from assert()ing it? thanks -- PMM