aboutsummaryrefslogtreecommitdiff
path: root/libcpp/lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp/lex.c')
-rw-r--r--libcpp/lex.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 914703f..62a28f8 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -41,8 +41,8 @@ struct token_spelling
static const unsigned char *const digraph_spellings[] =
{ U"%:", U"%:%:", U"<:", U":>", U"<%", U"%>" };
-#define OP(e, s) { SPELL_OPERATOR, U s },
-#define TK(e, s) { s, U #e },
+#define OP(e, s) { SPELL_OPERATOR, U s },
+#define TK(e, s) { SPELL_ ## s, U #e },
static const struct token_spelling token_spellings[N_TTYPES] = { TTYPE_TABLE };
#undef OP
#undef TK
@@ -736,7 +736,16 @@ _cpp_lex_token (cpp_reader *pfile)
handles the directive as normal. */
&& pfile->state.parsing_args != 1
&& _cpp_handle_directive (pfile, result->flags & PREV_WHITE))
- continue;
+ {
+ if (pfile->directive_result.type == CPP_PADDING)
+ continue;
+ else
+ {
+ result = &pfile->directive_result;
+ break;
+ }
+ }
+
if (pfile->cb.line_change && !pfile->state.skipping)
pfile->cb.line_change (pfile, result, pfile->state.parsing_args);
}
@@ -1573,6 +1582,8 @@ cpp_token_val_index (cpp_token *tok)
return CPP_TOKEN_FLD_ARG_NO;
else if (tok->type == CPP_PADDING)
return CPP_TOKEN_FLD_SOURCE;
+ else if (tok->type == CPP_PRAGMA)
+ return CPP_TOKEN_FLD_STR;
/* else fall through */
default:
return CPP_TOKEN_FLD_NONE;