public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Canonical list of reserved words ?
@ 2012-11-01 14:49 Daniel P. Berrange
  2012-11-01 15:42 ` Frank Ch. Eigler
  2012-11-01 15:49 ` Josh Stone
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2012-11-01 14:49 UTC (permalink / raw)
  To: systemtap

We've had fairly frequent bugs in QEMU where generated tapsets contain
variables clashing with systemd reserved words. eg

  https://bugzilla.redhat.com/show_bug.cgi?id=871286

Currently QEMU's generator does this

            for name in e.args.names():
                # Append underscore to reserved keywords
                if name in ('limit', 'in', 'next', 'self', 'function'):
                    name += '_'
                out('  %s = $arg%d;' % (name, i))
                i += 1


To avoid this proper in future I'm looking for a full list of all
systemtap reserved words. I've looked at the docs but not found a
clear list yet, so can someone point me int he right direction


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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

* Re: Canonical list of reserved words ?
  2012-11-01 14:49 Canonical list of reserved words ? Daniel P. Berrange
@ 2012-11-01 15:42 ` Frank Ch. Eigler
  2012-11-01 15:49 ` Josh Stone
  1 sibling, 0 replies; 4+ messages in thread
From: Frank Ch. Eigler @ 2012-11-01 15:42 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: systemtap

"Daniel P. Berrange" <berrange@redhat.com> writes:

> We've had fairly frequent bugs in QEMU where generated tapsets contain
> variables clashing with systemd reserved words. [...]

>             for name in e.args.names():
>                 # Append underscore to reserved keywords
>                 if name in ('limit', 'in', 'next', 'self', 'function'):
>                     name += '_'
>                 out('  %s = $arg%d;' % (name, i))
>                 i += 1

Right, that's inconvenient.  Maybe prefix with them all with "q"?
("self" isn't a keyword fwiw.)


> To avoid this proper in future I'm looking for a full list of all
> systemtap reserved words. I've looked at the docs but not found a
> clear list yet, so can someone point me int he right direction

I don't see it in the docs, but the parser source code fesses up
thusly:

% grep keywords.insert parse.cxx
      keywords.insert("probe");
      keywords.insert("global");
      keywords.insert("function");
      keywords.insert("if");
      keywords.insert("else");
      keywords.insert("for");
      keywords.insert("foreach");
      keywords.insert("in");
      keywords.insert("limit");
      keywords.insert("return");
      keywords.insert("delete");
      keywords.insert("while");
      keywords.insert("break");
      keywords.insert("continue");
      keywords.insert("next");
      keywords.insert("string");
      keywords.insert("long");
      keywords.insert("try");
      keywords.insert("catch");


- FChE

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

* Re: Canonical list of reserved words ?
  2012-11-01 14:49 Canonical list of reserved words ? Daniel P. Berrange
  2012-11-01 15:42 ` Frank Ch. Eigler
@ 2012-11-01 15:49 ` Josh Stone
  2012-11-01 15:53   ` Daniel P. Berrange
  1 sibling, 1 reply; 4+ messages in thread
From: Josh Stone @ 2012-11-01 15:49 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: systemtap

On 11/01/2012 07:49 AM, Daniel P. Berrange wrote:
> We've had fairly frequent bugs in QEMU where generated tapsets contain
> variables clashing with systemd reserved words. eg
> 
>   https://bugzilla.redhat.com/show_bug.cgi?id=871286
> 
> Currently QEMU's generator does this
> 
>             for name in e.args.names():
>                 # Append underscore to reserved keywords
>                 if name in ('limit', 'in', 'next', 'self', 'function'):
>                     name += '_'
>                 out('  %s = $arg%d;' % (name, i))
>                 i += 1
> 
> 
> To avoid this proper in future I'm looking for a full list of all
> systemtap reserved words. I've looked at the docs but not found a
> clear list yet, so can someone point me int he right direction

If it's not in the docs, we should probably add it.

In the source, the list of keywords is populated here:
http://sourceware.org/git/gitweb.cgi?p=systemtap.git;a=blob;f=parse.cxx#l1329

  probe global function if else for foreach in limit return delete
  while break continue next string long try catch

Your list includes "self", which isn't actually significant in stap, but
that's typical enough that maybe you should just leave it in, and we'll
feel free to add that one later. :)

Josh

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

* Re: Canonical list of reserved words ?
  2012-11-01 15:49 ` Josh Stone
@ 2012-11-01 15:53   ` Daniel P. Berrange
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2012-11-01 15:53 UTC (permalink / raw)
  To: Josh Stone; +Cc: systemtap

On Thu, Nov 01, 2012 at 08:49:10AM -0700, Josh Stone wrote:
> On 11/01/2012 07:49 AM, Daniel P. Berrange wrote:
> > We've had fairly frequent bugs in QEMU where generated tapsets contain
> > variables clashing with systemd reserved words. eg
> > 
> >   https://bugzilla.redhat.com/show_bug.cgi?id=871286
> > 
> > Currently QEMU's generator does this
> > 
> >             for name in e.args.names():
> >                 # Append underscore to reserved keywords
> >                 if name in ('limit', 'in', 'next', 'self', 'function'):
> >                     name += '_'
> >                 out('  %s = $arg%d;' % (name, i))
> >                 i += 1
> > 
> > 
> > To avoid this proper in future I'm looking for a full list of all
> > systemtap reserved words. I've looked at the docs but not found a
> > clear list yet, so can someone point me int he right direction
> 
> If it's not in the docs, we should probably add it.
> 
> In the source, the list of keywords is populated here:
> http://sourceware.org/git/gitweb.cgi?p=systemtap.git;a=blob;f=parse.cxx#l1329
> 
>   probe global function if else for foreach in limit return delete
>   while break continue next string long try catch
> 
> Your list includes "self", which isn't actually significant in stap, but
> that's typical enough that maybe you should just leave it in, and we'll
> feel free to add that one later. :)

Thanks Josh / Frank,  I'll update QEMU to match this list.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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

end of thread, other threads:[~2012-11-01 15:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-01 14:49 Canonical list of reserved words ? Daniel P. Berrange
2012-11-01 15:42 ` Frank Ch. Eigler
2012-11-01 15:49 ` Josh Stone
2012-11-01 15:53   ` Daniel P. Berrange

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 read-only IMAP folder(s) and NNTP newsgroup(s).