All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH trivial] trace-events: don't use dtrace reserved words in and next
@ 2012-03-28  7:55 Alon Levy
  2012-03-28 12:55 ` Stefan Hajnoczi
  0 siblings, 1 reply; 10+ messages in thread
From: Alon Levy @ 2012-03-28  7:55 UTC (permalink / raw)
  To: qemu-devel, stefanha

---
 trace-events |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/trace-events b/trace-events
index 70f059d..0924666 100644
--- a/trace-events
+++ b/trace-events
@@ -313,7 +313,7 @@ usb_host_set_interface(int bus, int addr, int interface, int alt) "dev %d:%d, in
 usb_host_claim_interfaces(int bus, int addr, int config, int nif) "dev %d:%d, config %d, nif %d"
 usb_host_release_interfaces(int bus, int addr) "dev %d:%d"
 usb_host_req_control(int bus, int addr, int req, int value, int index) "dev %d:%d, req 0x%x, value %d, index %d"
-usb_host_req_data(int bus, int addr, int in, int ep, int size) "dev %d:%d, in %d, ep %d, size %d"
+usb_host_req_data(int bus, int addr, int _in, int ep, int size) "dev %d:%d, in %d, ep %d, size %d"
 usb_host_req_complete(int bus, int addr, int status) "dev %d:%d, status %d"
 usb_host_urb_submit(int bus, int addr, void *aurb, int length, int more) "dev %d:%d, aurb %p, length %d, more %d"
 usb_host_urb_complete(int bus, int addr, void *aurb, int status, int length, int more) "dev %d:%d, aurb %p, status %d, length %d, more %d"
@@ -562,7 +562,7 @@ qemu_coroutine_terminate(void *co) "self %p"
 
 # qemu-coroutine-lock.c
 qemu_co_queue_next_bh(void) ""
-qemu_co_queue_next(void *next) "next %p"
+qemu_co_queue_next(void *_next) "next %p"
 qemu_co_mutex_lock_entry(void *mutex, void *self) "mutex %p self %p"
 qemu_co_mutex_lock_return(void *mutex, void *self) "mutex %p self %p"
 qemu_co_mutex_unlock_entry(void *mutex, void *self) "mutex %p self %p"
-- 
1.7.9.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH trivial] trace-events: don't use dtrace reserved words in and next
  2012-03-28  7:55 [Qemu-devel] [PATCH trivial] trace-events: don't use dtrace reserved words in and next Alon Levy
@ 2012-03-28 12:55 ` Stefan Hajnoczi
  2012-03-28 13:16   ` Alon Levy
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Hajnoczi @ 2012-03-28 12:55 UTC (permalink / raw)
  To: Alon Levy; +Cc: Lluís Vilanova, qemu-devel, stefanha

On Wed, Mar 28, 2012 at 8:55 AM, Alon Levy <alevy@redhat.com> wrote:
> ---
>  trace-events |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

We're always going to struggle with new trace events that add reserved
keywords.  Fixing up trace-events is going to be an ongoing task so
I'd like to also see tracetool automatically modify keywords 'next' ->
'next_'.  Do you want to send a patch to do that instead?

Stefan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH trivial] trace-events: don't use dtrace reserved words in and next
  2012-03-28 12:55 ` Stefan Hajnoczi
@ 2012-03-28 13:16   ` Alon Levy
  2012-03-28 13:33     ` Alon Levy
  2012-03-28 14:26     ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Alon Levy
  0 siblings, 2 replies; 10+ messages in thread
From: Alon Levy @ 2012-03-28 13:16 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Lluís Vilanova, stefanha, qemu-devel

On Wed, Mar 28, 2012 at 01:55:49PM +0100, Stefan Hajnoczi wrote:
> On Wed, Mar 28, 2012 at 8:55 AM, Alon Levy <alevy@redhat.com> wrote:
> > ---
> >  trace-events |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> We're always going to struggle with new trace events that add reserved
> keywords.  Fixing up trace-events is going to be an ongoing task so
> I'd like to also see tracetool automatically modify keywords 'next' ->
> 'next_'.  Do you want to send a patch to do that instead?

sure. For the new tracetool.py too ? :)

> 
> Stefan
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH trivial] trace-events: don't use dtrace reserved words in and next
  2012-03-28 13:16   ` Alon Levy
@ 2012-03-28 13:33     ` Alon Levy
  2012-03-28 13:35       ` Stefan Hajnoczi
  2012-03-28 14:26     ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Alon Levy
  1 sibling, 1 reply; 10+ messages in thread
From: Alon Levy @ 2012-03-28 13:33 UTC (permalink / raw)
  To: Stefan Hajnoczi, Lluís Vilanova, qemu-devel, stefanha

On Wed, Mar 28, 2012 at 03:16:34PM +0200, Alon Levy wrote:
> On Wed, Mar 28, 2012 at 01:55:49PM +0100, Stefan Hajnoczi wrote:
> > On Wed, Mar 28, 2012 at 8:55 AM, Alon Levy <alevy@redhat.com> wrote:
> > > ---
> > >  trace-events |    4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > We're always going to struggle with new trace events that add reserved
> > keywords.  Fixing up trace-events is going to be an ongoing task so
> > I'd like to also see tracetool automatically modify keywords 'next' ->
> > 'next_'.  Do you want to send a patch to do that instead?
> 

hmm, I changed to _next, not next_, if you'd like to change that and
commit I don't mind.

> sure. For the new tracetool.py too ? :)
> 
> > 
> > Stefan
> > 
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH trivial] trace-events: don't use dtrace reserved words in and next
  2012-03-28 13:33     ` Alon Levy
@ 2012-03-28 13:35       ` Stefan Hajnoczi
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2012-03-28 13:35 UTC (permalink / raw)
  To: Stefan Hajnoczi, Lluís Vilanova, qemu-devel, stefanha

On Wed, Mar 28, 2012 at 2:33 PM, Alon Levy <alevy@redhat.com> wrote:
> On Wed, Mar 28, 2012 at 03:16:34PM +0200, Alon Levy wrote:
>> On Wed, Mar 28, 2012 at 01:55:49PM +0100, Stefan Hajnoczi wrote:
>> > On Wed, Mar 28, 2012 at 8:55 AM, Alon Levy <alevy@redhat.com> wrote:
>> > > ---
>> > >  trace-events |    4 ++--
>> > >  1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > We're always going to struggle with new trace events that add reserved
>> > keywords.  Fixing up trace-events is going to be an ongoing task so
>> > I'd like to also see tracetool automatically modify keywords 'next' ->
>> > 'next_'.  Do you want to send a patch to do that instead?
>>
>
> hmm, I changed to _next, not next_, if you'd like to change that and
> commit I don't mind.

Thanks.  next_ can be a little safer when languages reserve
identifiers starting with '_'.  I can tweak it.

Stefan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words
  2012-03-28 13:16   ` Alon Levy
  2012-03-28 13:33     ` Alon Levy
@ 2012-03-28 14:26     ` Alon Levy
  2012-03-28 14:26       ` [Qemu-devel] [PATCH 2/2] tracetool: dtrace: warn on reserved word usage Alon Levy
                         ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Alon Levy @ 2012-03-28 14:26 UTC (permalink / raw)
  To: qemu-devel, Stefan Hajnoczi; +Cc: Lluís Vilanova

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 scripts/tracetool |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/tracetool b/scripts/tracetool
index 65bd0a1..e7cebf3 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -494,9 +494,9 @@ EOF
     i=1
     for arg in $arglist
     do
-        # 'limit' is a reserved keyword
-        if [ "$arg" = "limit" ]; then
-          arg="_limit"
+        # 'limit', 'in' and 'next' are reserved keywords
+        if [ "$arg" = "limit" -o "$arg" = "in" -o "$arg" = "next" ]; then
+          arg="_$arg"
         fi
         cat <<EOF
   $arg = \$arg$i;
-- 
1.7.9.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 2/2] tracetool: dtrace: warn on reserved word usage
  2012-03-28 14:26     ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Alon Levy
@ 2012-03-28 14:26       ` Alon Levy
  2012-03-28 16:26       ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Lee Essen
  2012-03-28 16:43       ` Peter Maydell
  2 siblings, 0 replies; 10+ messages in thread
From: Alon Levy @ 2012-03-28 14:26 UTC (permalink / raw)
  To: qemu-devel, Stefan Hajnoczi; +Cc: Lluís Vilanova

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 scripts/tracetool |    1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/tracetool b/scripts/tracetool
index e7cebf3..d011bb7 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -496,6 +496,7 @@ EOF
     do
         # 'limit', 'in' and 'next' are reserved keywords
         if [ "$arg" = "limit" -o "$arg" = "in" -o "$arg" = "next" ]; then
+          echo "reserved word used in line: $1" 1>&2
           arg="_$arg"
         fi
         cat <<EOF
-- 
1.7.9.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words
  2012-03-28 14:26     ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Alon Levy
  2012-03-28 14:26       ` [Qemu-devel] [PATCH 2/2] tracetool: dtrace: warn on reserved word usage Alon Levy
@ 2012-03-28 16:26       ` Lee Essen
  2012-03-28 16:38         ` Eric Blake
  2012-03-28 16:43       ` Peter Maydell
  2 siblings, 1 reply; 10+ messages in thread
From: Lee Essen @ 2012-03-28 16:26 UTC (permalink / raw)
  To: Alon Levy; +Cc: Stefan Hajnoczi, qemu-devel, Lluís Vilanova

On 28 Mar 2012, at 15:26, Alon Levy <alevy@redhat.com> wrote:

> Signed-off-by: Alon Levy <alevy@redhat.com>
> ---
> scripts/tracetool |    6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/tracetool b/scripts/tracetool
> index 65bd0a1..e7cebf3 100755
> --- a/scripts/tracetool
> +++ b/scripts/tracetool
> @@ -494,9 +494,9 @@ EOF
>     i=1
>     for arg in $arglist
>     do
> -        # 'limit' is a reserved keyword
> -        if [ "$arg" = "limit" ]; then
> -          arg="_limit"
> +        # 'limit', 'in' and 'next' are reserved keywords
> +        if [ "$arg" = "limit" -o "$arg" = "in" -o "$arg" = "next" ]; then
> +          arg="_$arg"
>         fi
>         cat <<EOF
>   $arg = \$arg$i;
> -- 
> 1.7.9.3

Could we add 'self' to this list?

Lee.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words
  2012-03-28 16:26       ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Lee Essen
@ 2012-03-28 16:38         ` Eric Blake
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Blake @ 2012-03-28 16:38 UTC (permalink / raw)
  To: Lee Essen; +Cc: Stefan Hajnoczi, Alon Levy, qemu-devel, Lluís Vilanova

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

On 03/28/2012 10:26 AM, Lee Essen wrote:

>> +        # 'limit', 'in' and 'next' are reserved keywords
>> +        if [ "$arg" = "limit" -o "$arg" = "in" -o "$arg" = "next" ]; then

[ ... -o ... ] is not portable.  POSIX says you must break it into:
[ ... ] || [ ... ]

or, more efficiently for this particular filtering, rewrite this as:

# munge reserved words
case $arg in
  limit | in | next ) arg=_$arg ;;
esac

> 
> Could we add 'self' to this list?

and using case makes it easier to add more reserved words:

case $arg in
  limit | in | next | self ) arg=_$arg ;;
esac

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words
  2012-03-28 14:26     ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Alon Levy
  2012-03-28 14:26       ` [Qemu-devel] [PATCH 2/2] tracetool: dtrace: warn on reserved word usage Alon Levy
  2012-03-28 16:26       ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Lee Essen
@ 2012-03-28 16:43       ` Peter Maydell
  2 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2012-03-28 16:43 UTC (permalink / raw)
  To: Alon Levy; +Cc: Stefan Hajnoczi, qemu-devel, Lluís Vilanova

2012/3/28 Alon Levy <alevy@redhat.com>:
> -        # 'limit' is a reserved keyword
> -        if [ "$arg" = "limit" ]; then
> -          arg="_limit"
> +        # 'limit', 'in' and 'next' are reserved keywords
> +        if [ "$arg" = "limit" -o "$arg" = "in" -o "$arg" = "next" ]; then
> +          arg="_$arg"
>         fi

The test -a and -o options are obsolete in POSIX shell scripts
(use "if [ foo ] && [ bar ]" instead).

In this case it would be neater to use 'case' anyway:
    case "$arg" in
        limit|in|next)
            arg="_$arg"
            ;;
    esac

-- PMM

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-03-28 16:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-28  7:55 [Qemu-devel] [PATCH trivial] trace-events: don't use dtrace reserved words in and next Alon Levy
2012-03-28 12:55 ` Stefan Hajnoczi
2012-03-28 13:16   ` Alon Levy
2012-03-28 13:33     ` Alon Levy
2012-03-28 13:35       ` Stefan Hajnoczi
2012-03-28 14:26     ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Alon Levy
2012-03-28 14:26       ` [Qemu-devel] [PATCH 2/2] tracetool: dtrace: warn on reserved word usage Alon Levy
2012-03-28 16:26       ` [Qemu-devel] [PATCH 1/2] tracetool: dtrace: handle in and next reserved words Lee Essen
2012-03-28 16:38         ` Eric Blake
2012-03-28 16:43       ` Peter Maydell

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.