Received: from eggs.gnu.org ([2001:4830:134:3::10]:35067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl27K-0004l3-Tt for qemu-devel@nongnu.org; Mon, 25 Nov 2013 14:46:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vl279-0007TT-6y for qemu-devel@nongnu.org; Mon, 25 Nov 2013 14:46:46 -0500 From: Michael Tokarev Date: Mon, 25 Nov 2013 23:41:05 +0400 Message-Id: <1385408466-13183-3-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: <1385408466-13183-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1385408466-13183-1-git-send-email-mjt@msgid.tls.msk.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 2/3] 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 , Michael Tokarev , qemu-devel@nongnu.org From: Stefan Weil 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 Signed-off-by: Michael Tokarev --- 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 5f36e7e..4d2e641 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, ...) { /* It would be nicer to use g_string_vprintf but it's only there in = 2.22 */ char s[] =3D "XXXX"; @@ -632,7 +633,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