* [Qemu-devel] [PATCH 1/2] trace-events: Rename 'next' argument
@ 2012-03-12 9:34 Kevin Wolf
2012-03-12 9:34 ` [Qemu-devel] [PATCH 2/2] tracetool: Forbid argument name 'next' Kevin Wolf
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2012-03-12 9:34 UTC (permalink / raw)
To: stefanha; +Cc: kwolf, qemu-devel
'next' is a systemtap keyword, so it's a bad idea to use it as an
argument name.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
trace-events | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/trace-events b/trace-events
index 606d903..2a96353 100644
--- a/trace-events
+++ b/trace-events
@@ -530,7 +530,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 *nxt) "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.6.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] tracetool: Forbid argument name 'next'
2012-03-12 9:34 [Qemu-devel] [PATCH 1/2] trace-events: Rename 'next' argument Kevin Wolf
@ 2012-03-12 9:34 ` Kevin Wolf
2012-03-12 11:01 ` Stefan Hajnoczi
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2012-03-12 9:34 UTC (permalink / raw)
To: stefanha; +Cc: kwolf, qemu-devel
It has happened more than once that patches that look perfectly sane
and work with simpletrace broke systemtap because they use 'next' as an
argument name for a tracing function. However, 'next' is a keyword for
systemtap, so we shouldn't use it.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
scripts/tracetool | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/scripts/tracetool b/scripts/tracetool
index 4c9951d..f892af4 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -81,6 +81,10 @@ get_args()
args=${1#*\(}
args=${args%%\)*}
echo "$args"
+
+ if (echo "$args" | grep "[ *]next\($\|[, ]\)" > /dev/null 2>&1); then
+ echo -e "\n#error 'next' is a bad argument name (clash with systemtap keyword)\n "
+ fi
}
# Get the argument name list of a trace event
--
1.7.6.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] tracetool: Forbid argument name 'next'
2012-03-12 9:34 ` [Qemu-devel] [PATCH 2/2] tracetool: Forbid argument name 'next' Kevin Wolf
@ 2012-03-12 11:01 ` Stefan Hajnoczi
2012-03-12 11:09 ` Kevin Wolf
2012-03-12 12:16 ` Lluís Vilanova
0 siblings, 2 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2012-03-12 11:01 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
On Mon, Mar 12, 2012 at 9:34 AM, Kevin Wolf <kwolf@redhat.com> wrote:
> It has happened more than once that patches that look perfectly sane
> and work with simpletrace broke systemtap because they use 'next' as an
> argument name for a tracing function. However, 'next' is a keyword for
> systemtap, so we shouldn't use it.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> scripts/tracetool | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/tracetool b/scripts/tracetool
> index 4c9951d..f892af4 100755
> --- a/scripts/tracetool
> +++ b/scripts/tracetool
> @@ -81,6 +81,10 @@ get_args()
> args=${1#*\(}
> args=${args%%\)*}
> echo "$args"
> +
> + if (echo "$args" | grep "[ *]next\($\|[, ]\)" > /dev/null 2>&1); then
> + echo -e "\n#error 'next' is a bad argument name (clash with systemtap keyword)\n "
> + fi
Good idea, let's prevent it from being used.
I don't think this is the way to do it because callers will parse
stdout and we're not guaranteed to be generating C code where #error
works. Instead, we can echo to stderr and do exit 1.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] tracetool: Forbid argument name 'next'
2012-03-12 11:01 ` Stefan Hajnoczi
@ 2012-03-12 11:09 ` Kevin Wolf
2012-03-12 12:16 ` Lluís Vilanova
1 sibling, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2012-03-12 11:09 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel
Am 12.03.2012 12:01, schrieb Stefan Hajnoczi:
> On Mon, Mar 12, 2012 at 9:34 AM, Kevin Wolf <kwolf@redhat.com> wrote:
>> It has happened more than once that patches that look perfectly sane
>> and work with simpletrace broke systemtap because they use 'next' as an
>> argument name for a tracing function. However, 'next' is a keyword for
>> systemtap, so we shouldn't use it.
>>
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> ---
>> scripts/tracetool | 4 ++++
>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/scripts/tracetool b/scripts/tracetool
>> index 4c9951d..f892af4 100755
>> --- a/scripts/tracetool
>> +++ b/scripts/tracetool
>> @@ -81,6 +81,10 @@ get_args()
>> args=${1#*\(}
>> args=${args%%\)*}
>> echo "$args"
>> +
>> + if (echo "$args" | grep "[ *]next\($\|[, ]\)" > /dev/null 2>&1); then
>> + echo -e "\n#error 'next' is a bad argument name (clash with systemtap keyword)\n "
>> + fi
>
> Good idea, let's prevent it from being used.
>
> I don't think this is the way to do it because callers will parse
> stdout and we're not guaranteed to be generating C code where #error
> works. Instead, we can echo to stderr and do exit 1.
Yes, we may generate something else additionally. But trace.h is
generated in any case and it will cause a compile error before any non-C
file is used.
I tried the 'exit 1' approach first and it doesn't really work. This
function is called from a subshell, so you don't exit tracetool but just
the one subshell and end up with a broken trace.h that will fail
compilation in the same place, just with a less helpful error message.
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] tracetool: Forbid argument name 'next'
2012-03-12 11:01 ` Stefan Hajnoczi
2012-03-12 11:09 ` Kevin Wolf
@ 2012-03-12 12:16 ` Lluís Vilanova
1 sibling, 0 replies; 5+ messages in thread
From: Lluís Vilanova @ 2012-03-12 12:16 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Kevin Wolf, qemu-devel
Stefan Hajnoczi writes:
> On Mon, Mar 12, 2012 at 9:34 AM, Kevin Wolf <kwolf@redhat.com> wrote:
>> It has happened more than once that patches that look perfectly sane
>> and work with simpletrace broke systemtap because they use 'next' as an
>> argument name for a tracing function. However, 'next' is a keyword for
>> systemtap, so we shouldn't use it.
>>
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> ---
>> scripts/tracetool | 4 ++++
>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/scripts/tracetool b/scripts/tracetool
>> index 4c9951d..f892af4 100755
>> --- a/scripts/tracetool
>> +++ b/scripts/tracetool
>> @@ -81,6 +81,10 @@ get_args()
>> args=${1#*\(}
>> args=${args%%\)*}
>> echo "$args"
>> +
>> + if (echo "$args" | grep "[ *]next\($\|[, ]\)" > /dev/null 2>&1); then
>> + echo -e "\n#error 'next' is a bad argument name (clash with systemtap keyword)\n "
>> + fi
> Good idea, let's prevent it from being used.
> I don't think this is the way to do it because callers will parse
> stdout and we're not guaranteed to be generating C code where #error
> works. Instead, we can echo to stderr and do exit 1.
I'd rather wait for the python version of tracetool to be integrated, so that
less patches have to be rebased.
In addition, there's a nice 'error' routine to handle this type of cases.
Lluis
--
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-12 12:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-12 9:34 [Qemu-devel] [PATCH 1/2] trace-events: Rename 'next' argument Kevin Wolf
2012-03-12 9:34 ` [Qemu-devel] [PATCH 2/2] tracetool: Forbid argument name 'next' Kevin Wolf
2012-03-12 11:01 ` Stefan Hajnoczi
2012-03-12 11:09 ` Kevin Wolf
2012-03-12 12:16 ` Lluís Vilanova
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).