Received: from eggs.gnu.org ([2001:4830:134:3::10]:51294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1Cae-000234-2z for qemu-devel@nongnu.org; Mon, 31 Oct 2016 09:25:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1CaS-0001AN-O2 for qemu-devel@nongnu.org; Mon, 31 Oct 2016 09:25:28 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35832) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c1CaS-00019U-Gu for qemu-devel@nongnu.org; Mon, 31 Oct 2016 09:25:16 -0400 Received: by mail-wm0-x244.google.com with SMTP id 68so11693384wmz.2 for ; Mon, 31 Oct 2016 06:25:16 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 31 Oct 2016 14:25:10 +0100 Message-Id: <1477920310-125217-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] simpletrace: correctly detect pointers to strings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: stefanha@redhat.com 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 --- 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__ = "stefanha@linux.vnet.ibm.com" 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