[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] simpletrace: correctly detect pointers to strings
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH] simpletrace: correctly detect pointers to strings |
Date: |
Mon, 31 Oct 2016 14:25:10 +0100 |
The visit_type_str tracepoint takes a char**, and the simpletrace backend
incorrectly treats that as a string. The resulting compiler warning breaks
--enable-trace-backend=simple builds (including the mingw docker target).
Fix it by rejecting pointers to pointers to char; rewrite the detection
as a regular expression for simplicity.
Signed-off-by: Paolo Bonzini <address@hidden>
---
scripts/tracetool/backend/simple.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/scripts/tracetool/backend/simple.py
b/scripts/tracetool/backend/simple.py
index 9885e83..9dae646 100644
--- a/scripts/tracetool/backend/simple.py
+++ b/scripts/tracetool/backend/simple.py
@@ -14,17 +14,15 @@ __email__ = "address@hidden"
from tracetool import out
+import re
PUBLIC = True
+STRTYPE_RE = re.compile(r'\s*(?:const )?char\s*\*(?!\s*\*)')
def is_string(arg):
- strtype = ('const char*', 'char*', 'const char *', 'char *')
- if arg.lstrip().startswith(strtype):
- return True
- else:
- return False
+ return not (STRTYPE_RE.match(arg) is None)
def generate_h_begin(events, group):
--
1.8.3.1
- [Qemu-devel] [PATCH] simpletrace: correctly detect pointers to strings,
Paolo Bonzini <=