Lines Matching refs:macro

1 /* CPP Library - traditional lexical analysis and macro expansion.
24 /* The replacement text of a function-like macro is stored as a
43 /* Structure holding information about a function-like macro
50 /* An array of size the number of macro parameters + 1, containing
51 the offsets of the start of each macro argument in the output
56 /* The hashnode of the macro. */
59 /* The offset of the macro name in the output buffer. */
62 /* The line the macro name appeared on. */
72 /* Lexing state. It is mostly used to prevent macro expansion. */
120 /* Skip a C-style block comment in a macro as a result of -CC.
123 Return true if the macro has not been termined, in that case set
149 macro.
323 /* Return true if NODE is a fun_like macro. */
332 return node->value.macro->fun_like;
336 macro. */
339 struct fun_macro *macro)
345 n = node->value.macro->paramc;
347 if (macro->buff)
348 _cpp_release_buff (pfile, macro->buff);
349 macro->buff = _cpp_get_buff (pfile, (n + 1) * sizeof (size_t));
350 macro->args = (size_t *) BUFF_FRONT (macro->buff);
351 macro->node = node;
352 macro->offset = start - pfile->out.base;
353 macro->paramc = n;
354 macro->argc = 0;
359 save_argument (struct fun_macro *macro, size_t offset)
361 macro->argc++;
362 if (macro->argc <= macro->paramc)
363 macro->args[macro->argc] = offset;
374 If BUILTIN_MACRO_ARG is true, this is called to macro expand
377 _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro,
440 /* If this is a macro's expansion, pop it. */
498 cur = copy_comment (pfile, cur, macro != 0);
515 if (!pfile->state.skipping && (quote == 0 || macro))
541 /* Remove the object-like macro's name from the
549 else if (macro && node->type == NT_MACRO_ARG)
554 save_replacement_text (pfile, macro, node->value.arg_index);
613 macro arguments aren't immediately expanded, they in
614 the end are because the macro with replaced arguments
636 /* Remove the macro's invocation from the
702 cpp_macro *m = fmacro.node->value.macro;
716 /* Remove the macro's invocation from the
731 /* A '#' from a macro doesn't start a directive. */
817 "unterminated argument list invoking macro \"%s\"",
822 /* Push a context holding the replacement text of the macro NODE on
824 macro with no arguments. */
843 cpp_macro *macro = node->value.macro;
844 macro->used = 1;
845 text = macro->exp.text;
846 len = macro->count;
852 /* Returns TRUE if traditional macro recursion is detected. */
866 20 deep since the first invocation of this macro must be
876 if (context->c.macro == node && depth > 20)
886 "detected recursion whilst expanding macro \"%s\"",
893 object-like non-builtin macro. */
895 _cpp_replacement_text_len (const cpp_macro *macro)
899 if (macro->fun_like && (macro->paramc != 0))
904 for (exp = macro->exp.text;;)
911 len += NODE_LEN (macro->parm.params[b->arg_index - 1]);
916 len = macro->count;
925 _cpp_copy_replacement_text (const cpp_macro *macro, uchar *dest)
927 if (macro->fun_like && (macro->paramc != 0))
931 for (exp = macro->exp.text;;)
940 param = macro->parm.params[b->arg_index - 1];
948 memcpy (dest, macro->exp.text, macro->count);
949 dest += macro->count;
955 /* Push a context holding the replacement text of the macro NODE on
957 macro with no arguments. */
961 cpp_macro *macro = fmacro->node->value.macro;
963 if (macro->paramc == 0)
976 for (exp = macro->exp.text;;)
995 for (exp = macro->exp.text;;)
1062 /* So we free buffer allocation when macro is left. */
1067 /* Read and record the parameters, if any, of a function-like macro
1109 cpp_error (pfile, CPP_DL_ERROR, "syntax error in macro parameter list");
1117 the replacement text for the current macro, followed by argument
1121 save_replacement_text (cpp_reader *pfile, cpp_macro *macro,
1127 if (macro->paramc == 0)
1134 macro->exp.text = exp;
1135 macro->count = len;
1144 if (macro->count + blen > BUFF_ROOM (pfile->a_buff))
1145 _cpp_extend_buff (pfile, &pfile->a_buff, macro->count + blen);
1148 block = (struct block *) (exp + macro->count);
1149 macro->exp.text = exp;
1159 macro->count += blen;
1163 BUFF_FRONT (pfile->a_buff) += macro->count;
1167 /* Analyze and save the replacement text of a macro. Returns true on
1180 has not been updated for the macro name for in-file defines. */
1186 /* Is this a function-like macro? */
1197 cpp_macro *macro = NULL;
1201 macro = _cpp_new_macro (pfile, cmk_traditional,
1203 macro->parm.params = params;
1204 macro->paramc = nparms;
1205 macro->fun_like = fun_like != 0;
1214 _cpp_scan_out_logical_line (pfile, macro, false);
1219 if (macro)
1227 save_replacement_text (pfile, macro, 0);
1230 return macro;