>>>>> "Arnaud" == Arnaud Charlet <[email protected]> writes:
Arnaud> /* Callbacks for when a macro is expanded, or tested (whether
Arnaud> defined or not at the time) in #ifdef, #ifndef or "defined". */
Arnaud> void (*used_define) (cpp_reader *, unsigned int, cpp_hashnode *);
Arnaud> Is the intent that used_define should only be called when used
Arnaud> in an #ifdef as explained by the documented, or also when
Arnaud> expanded in the source code?
I don't know the intent aside from what is in the comment.
However, it looks like this is used to implement -dU:
`U'
Like `D' except that only macros that are expanded, or whose
definedness is tested in preprocessor directives, are output;
the output is delayed until the use or test of the macro; and
`#undef' directives are also output for macros tested but
undefined at the time.
I suppose the idea is to emit each used macro a single time only, the
code seems to confirm this.
Arnaud> If the above is correct, what I'm interested in is a callback
Arnaud> that will be called each time a macro is expanded or tested
Arnaud> *anywhere* in the source code (for the purpose of generating
Arnaud> cross-reference info for macros), so would the addition of a new
Arnaud> callback (e.g.
Arnaud> void (*used) (cpp_reader *, unsigned int, cpp_hashnode *);
Arnaud> ) be acceptable in principle? If so, I'll post a formal patch on
Arnaud> gcc-patches@
Yes, this would be fine.
Tom