qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] tracetool: Forbid argument name 'next'


From: Lluís Vilanova
Subject: Re: [Qemu-devel] [PATCH 2/2] tracetool: Forbid argument name 'next'
Date: Mon, 12 Mar 2012 13:16:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)

Stefan Hajnoczi writes:

> On Mon, Mar 12, 2012 at 9:34 AM, Kevin Wolf <address@hidden> 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 <address@hidden>
>> ---
>>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]