"Michael S. Tsirkin" <m...@redhat.com> writes: > On Fri, Aug 16, 2013 at 03:18:29PM +0200, arm...@redhat.com wrote: >> From: Markus Armbruster <arm...@redhat.com> >> >> So that it can be set in config file for -readconfig. >> >> This tightens parsing of -smbios, and makes it more consistent with >> other options: unknown parameters are rejected, numbers with trailing >> junk are rejected, when a parameter is given multiple times, last >> rather than first wins, ... >> >> Signed-off-by: Markus Armbruster <arm...@redhat.com> >> Reviewed-by: Eric Blake <ebl...@redhat.com> [...] >> diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c >> index 0608aee..a113f8b 100644 >> --- a/hw/i386/smbios.c >> +++ b/hw/i386/smbios.c [...] >> @@ -225,17 +346,29 @@ void smbios_entry_add(const char *t) >> return; >> } >> >> - if (get_param_value(buf, sizeof(buf), "type", t)) { >> - unsigned long type = strtoul(buf, NULL, 0); >> + val = qemu_opt_get(opts, "type"); >> + if (val) { >> + unsigned long type = strtoul(val, NULL, 0); >> + >> switch (type) { >> case 0: >> - smbios_build_type_0_fields(t); >> + qemu_opts_validate(opts, qemu_smbios_type0_opts, &local_err); >> + if (local_err) { >> + error_report("%s", error_get_pretty(local_err)); >> + exit(1); >> + } >> + smbios_build_type_0_fields(opts); >> return; >> case 1: >> - smbios_build_type_1_fields(t); >> + qemu_opts_validate(opts, qemu_smbios_type1_opts, &local_err); >> + if (local_err) { >> + error_report("%s", error_get_pretty(local_err)); >> + exit(1); >> + } >> + smbios_build_type_1_fields(opts); >> return; >> default: >> - error_report("Don't know how to build fields for SMBIOS type >> %ld", >> + error_report("Don't know how to build fields for SMBIOS type %" >> PRIu64, >> type); >> exit(1); >> } > > This triggers a build failure: > > /scm/qemu/hw/i386/smbios.c: In function ‘smbios_entry_add’: > /scm/qemu/hw/i386/smbios.c:382:26: error: format ‘%llu’ expects argument > of type ‘long long unsigned int’, but argument 2 has type ‘long unsigned > int’ [-Werror=format=] > type); > ^ > > It's a long value, why are you printing it with PRIu64? > %ld seems right.
Yup. > I reverted just this chunk. Thanks for catching this. My compiler doesn't :( [...]