[Bug translator/16249] New: Add support for variadic stap macros
jistone at redhat dot com
sourceware-bugzilla@sourceware.org
Mon Nov 25 22:20:00 GMT 2013
https://sourceware.org/bugzilla/show_bug.cgi?id=16249
Bug ID: 16249
Summary: Add support for variadic stap macros
Product: systemtap
Version: unspecified
Status: NEW
Severity: enhancement
Priority: P2
Component: translator
Assignee: systemtap at sourceware dot org
Reporter: jistone at redhat dot com
It would be nice to allow variadic macros in stap scripts. Possible examples:
@define trace(...) %( println(gettimeofday_ms(), @__VA_ARGS__) %)
@define trace(args...) %( println(gettimeofday_ms(), @args) %)
I think I like the explicitly-named version better.
It wouldn't have to be the sole argument either:
@define trace(fmt, args...) %(
printf("%8d %16s[%5d] " @fmt "\n",
gettimeofday_ms(), execname(), pid(), @args)
%)
GNU CPP also has a special "##__VA_ARGS__" syntax for when there are no args at
all, it will squash a preceding comma token. I wouldn't use "##" in stap
script, but maybe something like @@args, or just always do this implicitly.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Systemtap
mailing list