#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "cpplib.h"
#include "cpphash.h"
goto new_context;
}
}
- else if (macro && node->arg_index)
+ else if (macro && (node->flags & NODE_MACRO_ARG) != 0)
{
/* Found a parameter in the replacement text of a
#define. Remove its name from the output. */
pfile->out.cur = out_start;
- save_replacement_text (pfile, macro, node->arg_index);
+ save_replacement_text (pfile, macro, node->value.arg_index);
out = pfile->out.base;
}
else if (lex_state == ls_hash)
{
cpp_macro *m = fmacro.node->value.macro;
+ m->used = 1;
lex_state = ls_none;
save_argument (&fmacro, out - pfile->out.base);
break;
case '#':
- if (out - 1 == pfile->out.base && !pfile->state.in_directive)
+ if (out - 1 == pfile->out.base
+ /* A '#' from a macro doesn't start a directive. */
+ && !pfile->context->prev
+ && !pfile->state.in_directive)
{
/* A directive. With the way _cpp_handle_directive
currently works, we only want to call it if either we
{
bool do_it = false;
- if (is_numstart (*cur))
+ if (is_numstart (*cur)
+ && CPP_OPTION (pfile, lang) != CLK_ASM)
do_it = true;
else if (is_idstart (*cur))
/* Check whether we know this directive, but don't
advance. */
- do_it = lex_identifier (pfile, cur)->directive_index != 0;
+ do_it = lex_identifier (pfile, cur)->is_directive;
if (do_it || CPP_OPTION (pfile, lang) != CLK_ASM)
{
else
{
cpp_macro *macro = node->value.macro;
+ macro->used = 1;
text = macro->exp.text;
len = macro->count;
}
cpp_reader *pfile;
cpp_hashnode *node;
{
- bool recursing = node->flags & NODE_DISABLED;
+ bool recursing = !!(node->flags & NODE_DISABLED);
/* Object-like macros that are already expanding are necessarily
recursive.