[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] libvixl: Add gcc format attribute
From: |
Stefan Weil |
Subject: |
[Qemu-devel] [PATCH] libvixl: Add gcc format attribute |
Date: |
Tue, 17 Jun 2014 23:07:10 +0200 |
This helps detecting wrong format strings.
Signed-off-by: Stefan Weil <address@hidden>
---
This patch is not intended to be applied before fixing some potential errors.
Addings the GNU gcc format attribute results in lots of compiler errors like
these ones:
CXX disas/libvixl/a64/disasm-a64.o
disas/libvixl/a64/disasm-a64.cc: In member function ‘int
vixl::Disassembler::SubstituteImmediateField(vixl::Instruction*, const char*)’:
disas/libvixl/a64/disasm-a64.cc:1372:66: error: format ‘%d’ expects argument of
type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Werror=format]
disas/libvixl/a64/disasm-a64.cc:1421:52: error: format ‘%d’ expects argument of
type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Werror=format]
disas/libvixl/a64/disasm-a64.cc:1442:48: error: format ‘%d’ expects argument of
type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Werror=format]
disas/libvixl/a64/disasm-a64.cc:1449:42: error: format ‘%d’ expects argument of
type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Werror=format]
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-a64.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
+#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);
void ResetOutput();
- void AppendToOutput(const char* string, ...);
+ void GCC_FMT_ATTR(2, 3) AppendToOutput(const char* string, ...);
char* buffer_;
uint32_t buffer_pos_;
--
1.7.10.4
- [Qemu-devel] [PATCH] libvixl: Add gcc format attribute,
Stefan Weil <=
- Re: [Qemu-devel] [PATCH] libvixl: Add gcc format attribute, Peter Maydell, 2014/06/17
- Re: [Qemu-devel] [PATCH] libvixl: Add gcc format attribute, Richard Henderson, 2014/06/18
- Re: [Qemu-devel] [PATCH] libvixl: Add gcc format attribute, Stefan Weil, 2014/06/18
- Re: [Qemu-devel] [PATCH] libvixl: Add gcc format attribute, Stefan Weil, 2014/06/18
- Re: [Qemu-devel] [PATCH] libvixl: Add gcc format attribute, Peter Maydell, 2014/06/18
- Re: [Qemu-devel] [PATCH] libvixl: Add gcc format attribute, Paolo Bonzini, 2014/06/18
- Re: [Qemu-devel] [PATCH] libvixl: Add gcc format attribute, Richard Henderson, 2014/06/18
- Re: [Qemu-devel] [PATCH] libvixl: Add gcc format attribute, Stefan Weil, 2014/06/18
- Re: [Qemu-devel] [PATCH] libvixl: Add gcc format attribute, Peter Maydell, 2014/06/18