re PR preprocessor/61977 (powerpc preprocessor breaks on lines that end with "vector")

PR preprocessor/61977
	* lex.c (cpp_peek_token): Temporarily clear pfile->cb.line_change.

	* gcc.target/powerpc/pr61977-1.c: New test.
	* gcc.target/powerpc/pr61977-2.c: New test.

From-SVN: r221839
This commit is contained in:
Jakub Jelinek 2015-04-02 13:57:02 +02:00 committed by Jakub Jelinek
parent 860f8be450
commit b8cd77f40c
5 changed files with 34 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2015-04-02 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/61977
* gcc.target/powerpc/pr61977-1.c: New test.
* gcc.target/powerpc/pr61977-2.c: New test.
2015-04-01 Paolo Carlini <paolo.carlini@oracle.com> 2015-04-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56100 PR c++/56100

View File

@ -0,0 +1,8 @@
/* PR preprocessor/61977 */
/* { dg-do preprocess } */
/* { dg-options "-mno-altivec -mno-vsx" } */
int y; vector
int x;
/* { dg-final { scan-file "pr61977-1.i" "(^|\\n)int y; vector\\n" } } */

View File

@ -0,0 +1,8 @@
/* PR preprocessor/61977 */
/* { dg-do preprocess } */
/* { dg-options "-maltivec" } */
int y; vector
int x;
/* { dg-final { scan-file "pr61977-2.i" "(^|\\n)int y; __attribute__\\(\\(altivec\\(vector__\\)\\)\\)\\n" } } */

View File

@ -1,3 +1,8 @@
2015-04-02 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/61977
* lex.c (cpp_peek_token): Temporarily clear pfile->cb.line_change.
2015-03-23 Jakub Jelinek <jakub@redhat.com> 2015-03-23 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/65238 PR preprocessor/65238

View File

@ -2080,6 +2080,12 @@ cpp_peek_token (cpp_reader *pfile, int index)
count = index; count = index;
pfile->keep_tokens++; pfile->keep_tokens++;
/* For peeked tokens temporarily disable line_change reporting,
until the tokens are parsed for real. */
void (*line_change) (cpp_reader *, const cpp_token *, int)
= pfile->cb.line_change;
pfile->cb.line_change = NULL;
do do
{ {
peektok = _cpp_lex_token (pfile); peektok = _cpp_lex_token (pfile);
@ -2090,6 +2096,7 @@ cpp_peek_token (cpp_reader *pfile, int index)
_cpp_backup_tokens_direct (pfile, count + 1); _cpp_backup_tokens_direct (pfile, count + 1);
pfile->keep_tokens--; pfile->keep_tokens--;
pfile->cb.line_change = line_change;
return peektok; return peektok;
} }