This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/16249] New: Add support for variadic stap macros


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]