X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=libcpp%2Fdirectives.c;h=49f95ca338953fce6f5627a9cd6e44bda8847bc6;hp=b2b6b32e6c1599549dbed13654ef3c72e188572a;hb=e9cc3617d6f7247ec3c804e3681d166a57529bb0;hpb=b085c511605220f34536dddc5853ecdfc2eaa5a9 diff --git a/libcpp/directives.c b/libcpp/directives.c index b2b6b32e6c1..49f95ca3389 100644 --- a/libcpp/directives.c +++ b/libcpp/directives.c @@ -1145,6 +1145,11 @@ do_pragma (cpp_reader *pfile) const cpp_token *token, *pragma_token = pfile->cur_token; unsigned int count = 1; + /* Save the current position so that defer_pragmas mode can + copy the entire current line to a string. It will not work + to use _cpp_backup_tokens as that does not reverse buffer->cur. */ + const uchar *line_start = CPP_BUFFER (pfile)->cur; + pfile->state.prevent_expansion++; token = cpp_get_token (pfile); @@ -1174,13 +1179,11 @@ do_pragma (cpp_reader *pfile) else if (CPP_OPTION (pfile, defer_pragmas)) { /* Squirrel away the pragma text. Pragmas are newline-terminated. */ - const uchar *line_start, *line_end; + const uchar *line_end; uchar *s; cpp_string body; cpp_token *ptok; - _cpp_backup_tokens (pfile, count); - line_start = CPP_BUFFER (pfile)->cur; line_end = ustrchr (line_start, '\n'); body.len = (line_end - line_start) + 1;