Received: from eggs.gnu.org ([2001:4830:134:3::10]:54964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vi6eA-0005jZ-GO for qemu-devel@nongnu.org; Sun, 17 Nov 2013 13:00:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vi6e4-0001wl-5Y for qemu-devel@nongnu.org; Sun, 17 Nov 2013 13:00:34 -0500 From: Stefan Weil Date: Sun, 17 Nov 2013 19:00:22 +0100 Message-Id: <1384711222-8916-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH for 1.7] acpi-build: Fix compiler warning (missing gnu_printf format attribute) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-trivial@nongnu.org, Stefan Weil , qemu-devel gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra): CC m68k-softmmu/hw/m68k/mcf5206.o hw/i386/acpi-build.c: In function =E2=80=98build_append_nameseg=E2=80=99: hw/i386/acpi-build.c:294:5: error: function might be possible candidate for =E2=80=98gnu_printf=E2=80=99 fo= rmat attribute [-Werror=3Dsuggest-attribute=3Dformat] g_string_vprintf(s, format, args); ^ When this warning is fixed, there is a new compiler warning: CC i386-softmmu/hw/i386/acpi-build.o hw/i386/acpi-build.c: In function =E2=80=98build_append_notify=E2=80=99: hw/i386/acpi-build.c:632:5: error: format not a string literal and no format arguments [-Werror=3Dformat-se= curity] build_append_nameseg(method, name); ^ This is fixed here, too. Signed-off-by: Stefan Weil --- Note: checkpatch.pl wrongly reports an error. hw/i386/acpi-build.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 486e705..9fff5ba 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -285,7 +285,8 @@ static inline void build_append_array(GArray *array, = GArray *val) g_array_append_vals(array, val->data, val->len); } =20 -static void build_append_nameseg(GArray *array, const char *format, ...) +static void GCC_FMT_ATTR(2, 3) +build_append_nameseg(GArray *array, const char *format, ...) { GString *s =3D g_string_new(""); va_list args; @@ -628,7 +629,7 @@ build_append_notify(GArray *device, const char *name, GArray *method =3D build_alloc_array(); uint8_t op =3D 0x14; /* MethodOp */ =20 - build_append_nameseg(method, name); + build_append_nameseg(method, "%s", name); build_append_byte(method, 0x02); /* MethodFlags: ArgCount */ for (i =3D skip; i < count; i++) { GArray *target =3D build_alloc_array(); --=20 1.7.10.4