From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1Ckz-0006NG-BB for qemu-devel@nongnu.org; Mon, 31 Oct 2016 09:36:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1Ckv-00061a-Dv for qemu-devel@nongnu.org; Mon, 31 Oct 2016 09:36:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59244) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c1Ckv-00061Q-8y for qemu-devel@nongnu.org; Mon, 31 Oct 2016 09:36:05 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 721F464D83 for ; Mon, 31 Oct 2016 13:36:03 +0000 (UTC) Date: Mon, 31 Oct 2016 21:36:01 +0800 From: Fam Zheng Message-ID: <20161031133601.GK30303@lemon> References: <1477920310-125217-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1477920310-125217-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH] simpletrace: correctly detect pointers to strings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com On Mon, 10/31 14:25, Paolo Bonzini wrote: > 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 > > There is already: commit db4df20de86c6e8ecd6c9f042c029ffb9f9cddac Author: Fam Zheng Date: Wed Oct 26 11:50:06 2016 +0800 trace: Fix 'char **' compilation error in simple backend Currently, the generated function body will do "strlen(arg)" but the argument could be 'char **' or 'char * const *'. Avoid that by excluding such cases in is_string check. Reported by patchew's "make docker-test-mingw@fedora". Suggested-by: Eric Blake Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Message-id: 1477453806-21097-1-git-send-email-famz@redhat.com Signed-off-by: Peter Maydell