From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S74CA-0005mt-0a for qemu-devel@nongnu.org; Mon, 12 Mar 2012 08:18:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S74C4-000895-G8 for qemu-devel@nongnu.org; Mon, 12 Mar 2012 08:17:45 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:40193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S74C4-00088V-5I for qemu-devel@nongnu.org; Mon, 12 Mar 2012 08:17:40 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <1331544868-31655-1-git-send-email-kwolf@redhat.com> <1331544868-31655-2-git-send-email-kwolf@redhat.com> Date: Mon, 12 Mar 2012 13:16:11 +0100 In-Reply-To: (Stefan Hajnoczi's message of "Mon, 12 Mar 2012 11:01:06 +0000") Message-ID: <8762eakoac.fsf@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2] tracetool: Forbid argument name 'next' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel@nongnu.org Stefan Hajnoczi writes: > On Mon, Mar 12, 2012 at 9:34 AM, Kevin Wolf 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. >>=20 >> Signed-off-by: Kevin Wolf >> --- >> =C2=A0scripts/tracetool | =C2=A0 =C2=A04 ++++ >> =C2=A01 files changed, 4 insertions(+), 0 deletions(-) >>=20 >> diff --git a/scripts/tracetool b/scripts/tracetool >> index 4c9951d..f892af4 100755 >> --- a/scripts/tracetool >> +++ b/scripts/tracetool >> @@ -81,6 +81,10 @@ get_args() >> =C2=A0 =C2=A0 args=3D${1#*\(} >> =C2=A0 =C2=A0 args=3D${args%%\)*} >> =C2=A0 =C2=A0 echo "$args" >> + >> + =C2=A0 =C2=A0if (echo "$args" | grep "[ *]next\($\|[, ]\)" > /dev/null= 2>&1); then >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0echo -e "\n#error 'next' is a bad argument = name (clash with systemtap keyword)\n " >> + =C2=A0 =C2=A0fi > 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 th= at less patches have to be rebased. In addition, there's a nice 'error' routine to handle this type of cases. Lluis --=20 "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