Project

General

Profile

Actions

Bug #3208

closed

Macros with a variable number of arguments support

Added by Denis Efremov over 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
High
Category:
-
Start date:
07/13/2012
Due date:
% Done:

0%

Estimated time:
Detected in build:
svn
Platform:
Published in build:
b503ab3

Description

Aspectator doesn't support macros with a variable number of arguments as join points (or [primitive] pointcuts).

Examples of macros:
#define info(format, args...) pr_info(format, args)
#define dbg(format, ...) pr_debug(format, ## VA_ARGS)


Related issues 1 (0 open1 closed)

Related to C Instrumentation Framework - Bug #3131: Wrong handling of function-like non-argument macrosClosedEvgeny Novikov06/27/2012

Actions
Actions #1

Updated by Evgeny Novikov over 12 years ago

  • Status changed from New to Open
  • Priority changed from Normal to High

Thank you for your report. The bug is related with incomplete macros processing in aspect parser like #3131. In fact grammar rules for macros processing is so:

primitive_pointcut_signature_macro: LDV_ID | LDV_ID '(' macro_param ')'
macro_param: LDV_ID | macro_param ',' LDV_ID

Most likely I have implemented them without respect to the C grammar that describes the following rules (I have omitted some of them):
control-line:
  # define identifier replacement-list new-line
  # define identifier lparen identifier-listopt ) replacement-list new-line
  # define identifier lparen ... ) replacement-list new-line
  # define identifier lparen identifier-list , ... ) replacement-list new-line
text-line: pp-tokensopt new-line
non-directive: pp-tokens new-line
lparen: a ( character not immediately preceded by white-space
replacement-list: pp-tokensopt
pp-tokens: 
  preprocessing-token 
  pp-tokens preprocessing-token
new-line: the new-line character

Actions #2

Updated by Evgeny Novikov over 12 years ago

How many rules/advices cannot be written because of this drawback?

Actions #3

Updated by Evgeny Novikov over 12 years ago

  • Status changed from Open to Resolved
  • Published in build set to 97616c6

Fixed in commit 97616c6 of the master branch. Waiting while tests finish. Close it if it will work for you.

Actions #4

Updated by Denis Efremov over 12 years ago

Still fails on such input:

around: define( printf(args...) ) {
({ check_in_interrupt(); 0; })
}

Actions #5

Updated by Evgeny Novikov over 12 years ago

Denis Efremov wrote:

Still fails on such input:

around: define( printf(args...) ) {
({ check_in_interrupt(); 0; })
}

Try this one:

around: define( printf(args, ...) )
{
        ({ check_in_interrupt(); 0; })
}

Actions #6

Updated by Denis Efremov over 12 years ago

The latter works, but these macros are not equal. If someone want them to be equal, he should write printf(...) instead printf(args, ...).

Example of such form of macro http://lxr.linux.no/#linux+v3.4.6/fs/bfs/bfs.h#L44

Actions #7

Updated by Evgeny Novikov over 12 years ago

  • Status changed from Resolved to Open

It looks like a GCC extension, thus, it should be implemented accordingly. Sorry, that I have missed this from your description.

Actions #8

Updated by Evgeny Novikov over 12 years ago

  • Status changed from Open to Resolved
  • Published in build changed from 97616c6 to cc8018c

Finally fixed in commit cc8018c of the master branch. Will be available after testing. Close if it will work for you.

Actions #9

Updated by Denis Efremov over 12 years ago

Still fails on such input:

around: define( printf(level,args...) )
{
   ({ check_in_interrupt(); 0; })
}

Actions #10

Updated by Evgeny Novikov over 12 years ago

  • Status changed from Resolved to Open

Therefore I have to fix it again.

Actions #11

Updated by Evgeny Novikov about 12 years ago

  • Status changed from Open to Resolved
  • Published in build changed from cc8018c to b503ab3

Commit b503ab3 eventually has fixed the issue. Because of corresponding aspectator change isn't critical (just added one more branch of macro signatures processing) I will skip thorough testing this time.
Denis, please, test the fix and close the bug if all is okay.

Actions #12

Updated by Evgeny Novikov almost 12 years ago

  • Status changed from Resolved to Closed

I hope that it does can be closed.

Actions

Also available in: Atom PDF