re PR preprocessor/61977 (powerpc preprocessor breaks on lines that end with "vector")
authorJakub Jelinek <jakub@redhat.com>
Thu, 2 Apr 2015 11:57:02 +0000 (13:57 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 2 Apr 2015 11:57:02 +0000 (13:57 +0200)
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

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr61977-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr61977-2.c [new file with mode: 0644]
libcpp/ChangeLog
libcpp/lex.c

index d024bc938e423b07eb46267558a318625bbd4eda..a22eb607808a69f8d780d4a2c721bbe9fa019d6f 100644 (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>
 
        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 (file)
index 0000000..50e6d28
--- /dev/null
@@ -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 (file)
index 0000000..305e45f
--- /dev/null
@@ -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" } } */
index daaa11ea1275ea2f0be4df944226521abfb6385c..829abba8cf916ee60496d8c23c3b5a9fa90e5d4a 100644 (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>
 
        PR preprocessor/65238
index bca56299132bfa8ee13025bed4f753837305dbb9..d1e221110fce4420e73077cf92036e1838505568 100644 (file)
@@ -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;
 }