diff options
author | Zack Weinberg <zack@codesourcery.com> | 2004-09-18 00:53:50 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2004-09-18 00:53:50 +0000 |
commit | 8f8e9aa5c1b48a6a6a40839fec7ce986cfb6b303 (patch) | |
tree | 60adaba7e7c1f378d329b3a602df3862f5395b04 /libcpp/directives.c | |
parent | bf3b7cd307678b263047bdd49adb08440302d0e0 (diff) | |
download | gcc-8f8e9aa5c1b48a6a6a40839fec7ce986cfb6b303.zip gcc-8f8e9aa5c1b48a6a6a40839fec7ce986cfb6b303.tar.gz gcc-8f8e9aa5c1b48a6a6a40839fec7ce986cfb6b303.tar.bz2 |
directives.c (do_pragma): Save current buffer position before lexing the pragma keywords...
* directives.c (do_pragma): Save current buffer position
before lexing the pragma keywords; don't call
_cpp_backup_tokens in the defer_pragmas case.
From-SVN: r87687
Diffstat (limited to 'libcpp/directives.c')
-rw-r--r-- | libcpp/directives.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libcpp/directives.c b/libcpp/directives.c index b2b6b32..49f95ca 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; |