This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug translator/16249] New: Add support for variadic stap macros
- From: "jistone at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Mon, 25 Nov 2013 22:20:45 +0000
- Subject: [Bug translator/16249] New: Add support for variadic stap macros
- Auto-submitted: auto-generated
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.