From: Jakub Jelinek Date: Thu, 2 Apr 2015 11:57:02 +0000 (+0200) Subject: re PR preprocessor/61977 (powerpc preprocessor breaks on lines that end with "vector") X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b8cd77f40ce01c28d0186e55c92e9fa4b887cf65;p=gcc.git 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 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d024bc938e4..a22eb607808 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-04-02 Jakub Jelinek + + PR preprocessor/61977 + * gcc.target/powerpc/pr61977-1.c: New test. + * gcc.target/powerpc/pr61977-2.c: New test. + 2015-04-01 Paolo Carlini PR c++/56100 diff --git a/gcc/testsuite/gcc.target/powerpc/pr61977-1.c b/gcc/testsuite/gcc.target/powerpc/pr61977-1.c new file mode 100644 index 00000000000..50e6d28161d --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr61977-1.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr61977-2.c b/gcc/testsuite/gcc.target/powerpc/pr61977-2.c new file mode 100644 index 00000000000..305e45f6467 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr61977-2.c @@ -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" } } */ diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index daaa11ea127..829abba8cf9 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2015-04-02 Jakub Jelinek + + PR preprocessor/61977 + * lex.c (cpp_peek_token): Temporarily clear pfile->cb.line_change. + 2015-03-23 Jakub Jelinek PR preprocessor/65238 diff --git a/libcpp/lex.c b/libcpp/lex.c index bca56299132..d1e221110fc 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -2080,6 +2080,12 @@ cpp_peek_token (cpp_reader *pfile, int index) count = index; 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 { peektok = _cpp_lex_token (pfile); @@ -2090,6 +2096,7 @@ cpp_peek_token (cpp_reader *pfile, int index) _cpp_backup_tokens_direct (pfile, count + 1); pfile->keep_tokens--; + pfile->cb.line_change = line_change; return peektok; }