diff --git a/pre-process.c b/pre-process.c index fb3430a..73a58be 100644 --- a/pre-process.c +++ b/pre-process.c @@ -573,6 +573,9 @@ static struct token **substitute(struct token **list, struct token *body, struct case TOKEN_MACRO_ARGUMENT: arg = args[body->argnum].expanded; count = &args[body->argnum].n_normal; + if (preprocess_hook) { + preprocess_hook->substitute_arg (&added, &args[body->argnum].expanded); + } if (eof_token(arg)) { state = Normal; continue; @@ -650,7 +653,7 @@ static int expand(struct token **list, struct symbol *sym) if (preprocess_hook && preprocess_hook->expand_arg) { int i; for (i = 0; i < nargs; i++) { - preprocess_hook->expand_arg(token, sym, i, args[i].orig, args[i].expanded); + preprocess_hook->expand_arg(token, sym, i, args[i].orig, &args[i].expanded); free_preprocessor_line(args[i].orig); } } diff --git a/token.h b/token.h index 985d1f5..c45d6be 100644 --- a/token.h +++ b/token.h @@ -175,7 +175,8 @@ struct preprocess_hook { void (*expand_macro)(struct token *macro, struct symbol *sym, struct token *parent, struct token **replace, struct token **replace_tail); void (*expand_arg)(struct token *macro, struct symbol *sym, int arg, - struct token *orig, struct token *expanded); + struct token *orig, struct token **expanded); + void (*substitute_arg)(struct token **dest, struct token **argp); }; #define MAX_STRING 4095