Lines Matching full:macro
59 * Macro Expansion:: Macro expansion algorithm.
153 might be a macro, and the tokens of a macro expansion do not have the
154 `BOL' flag set. The macro expansion may even be empty, and the next
160 in the middle of a macro expansion. Therefore, if the state variable
166 unterminated macro argument list.
169 arguments to a macro is treated as whitespace. This white space is
170 important in case the macro argument is stringified. The state variable
172 arguments to a macro call. It is set to 1 when looking for the opening
173 parenthesis to a function-like macro, and 2 when collecting the actual
247 macro expansion we don't want to complain with each use of the macro.
252 `__VA_ARGS__' in the expansion of a variable-argument macro. Therefore
288 token stream. For example, after the name of a function-like macro, it
318 Two issues remain: what about tokens that arise from macro
327 The tokens forming a macro's replacement list are collected by the
329 `cpp_destroy'. So if a macro is expanded in the line of tokens, the
341 function-like macro name might lie on a different line, and the front
348 function-like macro. In the near future cpplib will export an
358 conditional blocks, and invalidates the control macro of the
364 File: cppinternals.info, Node: Hash Nodes, Next: Macro Expansion, Prev: Lexer, Up: Top
372 well as keywords, directive names, macro names and so on. For example,
385 for a normal macro points to a structure with more information
386 about the macro, such as whether it is function-like, how many
401 currently a macro, or a macro that has since been undefined with
409 and pasting macro operators `#' and `##'. Named operator hash
419 each identifier in the macro's expansion, lookup to see if it is an
425 File: cppinternals.info, Node: Macro Expansion, Next: Token Spacing, Prev: Hash Nodes, Up: Top
427 Macro Expansion Algorithm
430 Macro expansion is a tricky operation, fraught with nasty corner cases
437 of how things like nested macro expansion, stringification and token
443 The preprocessor stores macro expansions in tokenized form. This saves
447 is all you need to get the replacement list of a macro.
449 If the macro is a function-like macro the preprocessor also stores
451 table entry of each parameter's identifier. Further, in the macro's
457 parameters to the macro, both for dumping with e.g., `-dD', and to warn
458 about non-trivial macro redefinitions when the parameter names have
461 Macro expansion overview
465 list of `cpp_context' structures, which together represent the macro
468 normally holds the unexpanded replacement list of the innermost macro
481 If it encounters an identifier that is both a macro and enabled for
482 expansion, cpplib prepares to push a new context for that macro on the
485 replacement list of that macro. In the case of function-like macros,
487 list, stored as `CPP_MACRO_ARG' tokens, with the appropriate macro
489 its expanded argument, the argument will have been fully macro expanded
499 to mark the macro disabled for expansion (except for special macros
500 like `__TIME__'). The macro is re-enabled when its context is later
502 ordering ensures that a macro is disabled whilst its expansion is being
514 the macro in question was disabled.
522 parenthesis in its macro's argument list), and when it replaces its
523 parameter in the macro's replacement list, the subsequent token happens
531 importantly ensures that the macro corresponding to the current context
540 argument, `foo' does not expand even though the macro is enabled, since
543 the macro invocation]. This still leaves the argument token `foo'
546 ineligible for future expansion, since the macro is now disabled. It
547 is disabled because the replacement list `bar foo' of the macro is
551 then tested whether the macro were disabled it would be subtly wrong.
556 Looking for a function-like macro's opening parenthesis
591 end of a line if it happens to be in the middle of a macro argument
593 situations where no macro expansion is involved, so the optimization is
597 File: cppinternals.info, Node: Token Spacing, Next: Line Numbering, Prev: Macro Expansion, Up: Top
605 taking special measures, this might not be the case because of macro
625 avoidance". Token addition and removal can only occur because of macro
627 and after each macro replacement, each argument replacement, and
637 Now consider the result of the following macro expansion:
647 space preceding `add' in the macro invocation, _not_ replacement list.
649 the macro replacement list, and `3' has no preceding space because
654 in-progress macro expansions. So instead of modifying the two tokens
658 in front of every macro expansion and expanded macro argument. These
661 in the macro invocation, and `y' and `z' in the macro replacement list,
665 example if a macro's first replacement token expands straight into
666 another macro.
679 But what if a macro expansion is left? Adjusting the above example
692 tokens, one per macro invocation, before the token `baz'. We would
697 any of these macro expansions could be stringified, where spacing
700 So, this demonstrates that not just entering macro and argument
703 macro expansions, as well as after each replaced argument in a macro's
748 * If the token results from a macro expansion, the line of the macro
750 of function-like macro expansion.
755 replacement list of a macro expansion carries the location of the token
756 within the `#define' directive, because cpplib expands a macro by
767 macro expansions, it might also be helpful for the user to see the
768 original location in the macro definition that the token came from.
774 token is fairly useless if the token came from a macro expansion. All
856 must have come directly from the source file--no macro expansion
857 must have been involved. This is because macro definitions can
866 `_stack_include_file' sets the controlling macro `mi_cmacro' to `NULL',
879 pass the controlling macro to the function `push_conditional'. cpplib
882 onto the stack. In this structure it records the controlling macro for
885 controlling macro for that block is cleared to `NULL'. Otherwise, it
887 sets `mi_valid' to true and stores the controlling macro in `mi_cmacro'.
891 With this, and requiring top-of-file to record a controlling macro, and
903 remembers the controlling macro associated with the file. Subsequent
905 controlling macro is defined, effecting the optimization.
913 in order in a `#if' expression. If so, they return the guard macro to
915 `enter_macro_context' sets `mi_valid' to false, so if a macro was
954 macro is defined when we leave the header file for the first time. If
1008 * macro expansion: Macro Expansion. (line 6)
1009 * macro representation (internal): Macro Expansion. (line 19)
1028 Node: Macro Expansion21146