From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] simpletrace: correctly detect pointers to strings
Date: Mon, 31 Oct 2016 21:36:01 +0800 [thread overview]
Message-ID: <20161031133601.GK30303@lemon> (raw)
In-Reply-To: <1477920310-125217-1-git-send-email-pbonzini@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 <pbonzini@redhat.com>
> ---
> 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 <famz@redhat.com>
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 <eblake@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1477453806-21097-1-git-send-email-famz@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
next prev parent reply other threads:[~2016-10-31 13:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-31 13:25 [Qemu-devel] [PATCH] simpletrace: correctly detect pointers to strings Paolo Bonzini
2016-10-31 13:36 ` Fam Zheng [this message]
2016-11-02 14:23 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161031133601.GK30303@lemon \
--to=famz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.