From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx0b5-0007K6-0x for qemu-devel@nongnu.org; Tue, 17 Jun 2014 17:07:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wx0b3-0003Fi-Tw for qemu-devel@nongnu.org; Tue, 17 Jun 2014 17:07:14 -0400 Received: from qemu.weilnetz.de ([2a03:4000:2:362::1]:44938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx0b3-0003FW-OD for qemu-devel@nongnu.org; Tue, 17 Jun 2014 17:07:13 -0400 From: Stefan Weil Date: Tue, 17 Jun 2014 23:07:10 +0200 Message-Id: <1403039230-3427-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] =?utf-8?q?=5BPATCH=5D_libvixl=3A_Add_gcc_format_attr?= =?utf-8?q?ibute?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefan Weil , Richard Henderson This helps detecting wrong format strings. Signed-off-by: Stefan Weil --- This patch is not intended to be applied before fixing some potential err= ors. Addings the GNU gcc format attribute results in lots of compiler errors l= ike these ones: CXX disas/libvixl/a64/disasm-a64.o disas/libvixl/a64/disasm-a64.cc: In member function =E2=80=98int vixl::Di= sassembler::SubstituteImmediateField(vixl::Instruction*, const char*)=E2=80= =99: disas/libvixl/a64/disasm-a64.cc:1372:66: error: format =E2=80=98%d=E2=80=99= expects argument of type =E2=80=98int=E2=80=99, but argument 3 has type = =E2=80=98int64_t {aka long int}=E2=80=99 [-Werror=3Dformat] disas/libvixl/a64/disasm-a64.cc:1421:52: error: format =E2=80=98%d=E2=80=99= expects argument of type =E2=80=98int=E2=80=99, but argument 3 has type = =E2=80=98int64_t {aka long int}=E2=80=99 [-Werror=3Dformat] disas/libvixl/a64/disasm-a64.cc:1442:48: error: format =E2=80=98%d=E2=80=99= expects argument of type =E2=80=98int=E2=80=99, but argument 3 has type = =E2=80=98int64_t {aka long int}=E2=80=99 [-Werror=3Dformat] disas/libvixl/a64/disasm-a64.cc:1449:42: error: format =E2=80=98%d=E2=80=99= expects argument of type =E2=80=98int=E2=80=99, but argument 3 has type = =E2=80=98int64_t {aka long int}=E2=80=99 [-Werror=3Dformat] I don't know the reason, because all locations seem to have arguments which are function calls, and the called function returns Instr which is uint32_t, not int64_t. Stefan disas/libvixl/a64/disasm-a64.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/disas/libvixl/a64/disasm-a64.h b/disas/libvixl/a64/disasm-a6= 4.h index 3a56e15..30df187 100644 --- a/disas/libvixl/a64/disasm-a64.h +++ b/disas/libvixl/a64/disasm-a64.h @@ -27,6 +27,7 @@ #ifndef VIXL_A64_DISASM_A64_H #define VIXL_A64_DISASM_A64_H =20 +#include "qemu/compiler.h" // GCC_FMT_ATTR #include "globals.h" #include "utils.h" #include "instructions-a64.h" @@ -85,7 +86,7 @@ class Disassembler: public DecoderVisitor { bool IsMovzMovnImm(unsigned reg_size, uint64_t value); =20 void ResetOutput(); - void AppendToOutput(const char* string, ...); + void GCC_FMT_ATTR(2, 3) AppendToOutput(const char* string, ...); =20 char* buffer_; uint32_t buffer_pos_; --=20 1.7.10.4