diff mbox series

[PR,95013] EOF location is at end of file

Message ID e2efb42c-3065-3e84-1a99-f48492b26119@acm.org
State New
Headers show
Series [PR,95013] EOF location is at end of file | expand

Commit Message

Nathan Sidwell May 12, 2020, 8:42 p.m. UTC
My recent C++ parser change to pay attention to EOF location uncovered a 
separate bug.  The preprocesor's EOF logic would set the EOF location to 
be the beginning of the last line of text in the file -- not the 'line' 
after that, which contains no characters.  Mostly.  This fixes things so 
that when we attempt to read the last line of the main file, we don't 
pop the buffer until the tokenizer has a chance to create an EOF token 
with the correct location information.  It is then responsible for 
popping the buffer.  As it happens, raw string literal tokenizing 
contained a bug -- it would increment the line number prematurely, 
because it cached buffer->cur in a local variable, but checked 
buffer->cur before updating it to figure out if it was at end of file. 
We fix up that too.

The EOF token intentionally doesn't have a column number -- it's not a 
position on a line, it's a non-existant line.

The testsuite churn is just correcting the EOF location diagnostics. 
This time I've made sure to check all testsuites, sorry obj-c++ folks.

pushed to master.

nathan

Comments

H.J. Lu May 13, 2020, 12:23 a.m. UTC | #1
On Tue, May 12, 2020 at 2:24 PM Nathan Sidwell <nathan@acm.org> wrote:
>
> My recent C++ parser change to pay attention to EOF location uncovered a
> separate bug.  The preprocesor's EOF logic would set the EOF location to
> be the beginning of the last line of text in the file -- not the 'line'
> after that, which contains no characters.  Mostly.  This fixes things so
> that when we attempt to read the last line of the main file, we don't
> pop the buffer until the tokenizer has a chance to create an EOF token
> with the correct location information.  It is then responsible for
> popping the buffer.  As it happens, raw string literal tokenizing
> contained a bug -- it would increment the line number prematurely,
> because it cached buffer->cur in a local variable, but checked
> buffer->cur before updating it to figure out if it was at end of file.
> We fix up that too.
>
> The EOF token intentionally doesn't have a column number -- it's not a
> position on a line, it's a non-existant line.
>
> The testsuite churn is just correcting the EOF location diagnostics.
> This time I've made sure to check all testsuites, sorry obj-c++ folks.
>
> pushed to master.
>
> nathan
>
> --
> Nathan Sidwell

I got

ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
.+1 "
ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
.+1 "
ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
.+1 "
ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
.+1 "
ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
.+1 "
ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
.+1 "

on Linux/x86:

https://gcc.gnu.org/pipermail/gcc-regression/2020-May/072573.html
Christophe Lyon May 13, 2020, 6:44 a.m. UTC | #2
On Wed, 13 May 2020 at 02:24, H.J. Lu via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Tue, May 12, 2020 at 2:24 PM Nathan Sidwell <nathan@acm.org> wrote:
> >
> > My recent C++ parser change to pay attention to EOF location uncovered a
> > separate bug.  The preprocesor's EOF logic would set the EOF location to
> > be the beginning of the last line of text in the file -- not the 'line'
> > after that, which contains no characters.  Mostly.  This fixes things so
> > that when we attempt to read the last line of the main file, we don't
> > pop the buffer until the tokenizer has a chance to create an EOF token
> > with the correct location information.  It is then responsible for
> > popping the buffer.  As it happens, raw string literal tokenizing
> > contained a bug -- it would increment the line number prematurely,
> > because it cached buffer->cur in a local variable, but checked
> > buffer->cur before updating it to figure out if it was at end of file.
> > We fix up that too.
> >
> > The EOF token intentionally doesn't have a column number -- it's not a
> > position on a line, it's a non-existant line.
> >
> > The testsuite churn is just correcting the EOF location diagnostics.
> > This time I've made sure to check all testsuites, sorry obj-c++ folks.
> >
> > pushed to master.
> >
> > nathan
> >
> > --
> > Nathan Sidwell
>
> I got
>
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
>
> on Linux/x86:
>
> https://gcc.gnu.org/pipermail/gcc-regression/2020-May/072573.html
>

The updated testcase was missing a comment. I pushed this obvious fix:

commit a7b7818f3dbd14cc7577d25dcebaded07395c476
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date:   Wed May 13 06:41:19 2020 +0000

    [PR 95013] Fix gcc.dg/unclosed-init.c

    2020-05-13  Christophe Lyon  <christophe.lyon@linaro.org>

        PR preprocessor/95013
        * gcc.dg/unclosed-init.c: Add missing comment in dg-error.

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5a4215b..03b61dd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-13  Christophe Lyon  <christophe.lyon@linaro.org>
+
+       PR preprocessor/95013
+       * gcc.dg/unclosed-init.c: Add missing comment in dg-error.
+
 2020-05-13  Bin Cheng  <bin.cheng@linux.alibaba.com>

        PR tree-optimization/94969
diff --git a/gcc/testsuite/gcc.dg/unclosed-init.c
b/gcc/testsuite/gcc.dg/unclosed-init.c
index 16c42c4..0a0ca21 100644
--- a/gcc/testsuite/gcc.dg/unclosed-init.c
+++ b/gcc/testsuite/gcc.dg/unclosed-init.c
@@ -1,3 +1,3 @@
 int unclosed[] = { /* { dg-message "18: to match this '.'" } */
   42
- /* { dg-error "-: expected '.' at end of input" { target *-*-* } .+1 } */
+ /* { dg-error "-: expected '.' at end of input" "" { target *-*-* } .+1 } */


Thanks,

Christophe

>
> --
> H.J.
Nathan Sidwell May 13, 2020, 12:26 p.m. UTC | #3
On 5/13/20 2:44 AM, Christophe Lyon wrote:
> On Wed, 13 May 2020 at 02:24, H.J. Lu via Gcc-patches

>      [PR 95013] Fix gcc.dg/unclosed-init.c
> 
>      2020-05-13  Christophe Lyon  <christophe.lyon@linaro.org>
> 
>          PR preprocessor/95013
>          * gcc.dg/unclosed-init.c: Add missing comment in dg-error.

Thanks for beating me to it.

nathan
diff mbox series

Patch

2020-05-12  Nathan Sidwell  <nathan@acm.org>

	libcpp/
	EOF location is at end of file
	PR preprocessor/95013
	* lex.c (lex_raw_string): Process line notes before incrementing.
	Correct incrementing condition.  Adjust for new
	_cpp_get_fresh_line EOF behaviour.
	(_cpp_get_fresh_line): Do not pop buffer at EOF, increment line
	instead.
	(_cpp_lex_direct): Adjust for new _cpp_get_fresh_line behaviour.
	(cpp_directive_only_process): Assert we got a fresh line.
	* traditional.c (_cpp_read_logical_line_trad): Adjust for new
	_cpp_get_fresh_line behaviour.

	gcc/testsuite/
	* c-c++-common/goacc/pr79428-1.c: Adjust EOF diagnostic location.
	* c-c++-common/gomp/pr79428-2.c: Likewise.
	* g++.dg/cpp0x/decltype63.C: Likewise.
	* g++.dg/cpp0x/gen-attrs-64.C: Likewise.
	* g++.dg/cpp0x/pr68726.C: Likewise.
	* g++.dg/cpp0x/pr78341.C: Likewise.
	* g++.dg/cpp1y/pr65202.C: Likewise.
	* g++.dg/cpp1y/pr65340.C: Likewise.
	* g++.dg/cpp1y/pr68578.C: Likewise.
	* g++.dg/cpp1z/class-deduction44.C: Likewise.
	* g++.dg/diagnostic/unclosed-extern-c.C: Likewise.
	* g++.dg/diagnostic/unclosed-function.C: Likewise.
	* g++.dg/diagnostic/unclosed-namespace.C: Likewise.
	* g++.dg/diagnostic/unclosed-struct.C: Likewise.
	* g++.dg/ext/pr84598.C: Likewise.
	* g++.dg/other/switch4.C: Likewise.
	* g++.dg/parse/attr4.C: Likewise.
	* g++.dg/parse/cond4.C: Likewise.
	* g++.dg/parse/crash10.C: Likewise.
	* g++.dg/parse/crash18.C: Likewise.
	* g++.dg/parse/crash27.C: Likewise.
	* g++.dg/parse/crash34.C: Likewise.
	* g++.dg/parse/crash35.C: Likewise.
	* g++.dg/parse/crash52.C: Likewise.
	* g++.dg/parse/crash59.C: Likewise.
	* g++.dg/parse/crash61.C: Likewise.
	* g++.dg/parse/crash67.C: Likewise.
	* g++.dg/parse/error14.C: Likewise.
	* g++.dg/parse/error56.C: Likewise.
	* g++.dg/parse/invalid1.C: Likewise.
	* g++.dg/parse/parameter-declaration-1.C: Likewise.
	* g++.dg/parse/parser-pr28152-2.C: Likewise.
	* g++.dg/parse/parser-pr28152.C: Likewise.
	* g++.dg/parse/pr68722.C: Likewise.
	* g++.dg/pr46852.C: Likewise.
	* g++.dg/pr46868.C: Likewise.
	* g++.dg/template/crash115.C: Likewise.
	* g++.dg/template/crash43.C: Likewise.
	* g++.dg/template/crash90.C: Likewise.
	* g++.dg/template/error-recovery1.C: Likewise.
	* g++.dg/template/error57.C: Likewise.
	* g++.old-deja/g++.other/crash31.C: Likewise.
	* gcc.dg/empty-source-2.c: Likewise.
	* gcc.dg/empty-source-3.c: Likewise.
	* gcc.dg/noncompile/pr30552-3.c: Likewise.
	* gcc.dg/noncompile/pr35447-1.c: Likewise.
	* gcc.dg/pr20245-1.c: Likewise.
	* gcc.dg/pr28419.c: Likewise.
	* gcc.dg/rtl/truncated-rtl-file.c: Likewise.
	* gcc.dg/unclosed-init.c: Likewise.
	* obj-c++.dg/property/property-neg-6.mm: Likewise.
	* obj-c++.dg/syntax-error-10.mm: Likewise.
	* obj-c++.dg/syntax-error-8.mm: Likewise.
	* obj-c++.dg/syntax-error-9.mm: Likewise.

diff --git i/libcpp/lex.c w/libcpp/lex.c
index 3bcf073710e..043852d14e2 100644
--- i/libcpp/lex.c
+++ w/libcpp/lex.c
@@ -1897,12 +1897,13 @@  lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base,
 
 	  BUF_APPEND (base, cur - base);
 
-	  if (pfile->buffer->cur < pfile->buffer->rlimit)
+	  pfile->buffer->cur = cur-1;
+	  _cpp_process_line_notes (pfile, false);
+
+	  if (pfile->buffer->next_line < pfile->buffer->rlimit)
 	    CPP_INCREMENT_LINE (pfile, 0);
 	  pfile->buffer->need_line = true;
 
-	  pfile->buffer->cur = cur-1;
-	  _cpp_process_line_notes (pfile, false);
 	  if (!_cpp_get_fresh_line (pfile))
 	    {
 	      location_t src_loc = token->src_loc;
@@ -1914,6 +1915,8 @@  lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base,
 		_cpp_release_buff (pfile, first_buff);
 	      cpp_error_with_line (pfile, CPP_DL_ERROR, src_loc, 0,
 				   "unterminated raw string");
+	      /* Now pop the buffer that _cpp_get_fresh_line did not.  */
+	      _cpp_pop_buffer (pfile);
 	      return;
 	    }
 
@@ -2651,8 +2654,6 @@  _cpp_lex_token (cpp_reader *pfile)
 bool
 _cpp_get_fresh_line (cpp_reader *pfile)
 {
-  int return_at_eof;
-
   /* We can't get a new line until we leave the current directive.  */
   if (pfile->state.in_directive)
     return false;
@@ -2683,10 +2684,17 @@  _cpp_get_fresh_line (cpp_reader *pfile)
 	  buffer->next_line = buffer->rlimit;
 	}
 
-      return_at_eof = buffer->return_at_eof;
-      _cpp_pop_buffer (pfile);
-      if (pfile->buffer == NULL || return_at_eof)
-	return false;
+      if (buffer->prev && !buffer->return_at_eof)
+	_cpp_pop_buffer (pfile);
+      else
+	{
+	  /* End of translation.  Do not pop the buffer yet. Increment
+	     line number so that the EOF token is on a line of its own
+	     (_cpp_lex_direct doesn't increment in that case, because
+	     it's hard for it to distinguish this special case). */
+	  CPP_INCREMENT_LINE (pfile, 0);
+	  return false;
+	}
     }
 }
 
@@ -2740,6 +2748,8 @@  _cpp_lex_direct (cpp_reader *pfile)
 	      /* Tell the compiler the line number of the EOF token.  */
 	      result->src_loc = pfile->line_table->highest_line;
 	      result->flags = BOL;
+	      /* Now pop the buffer that _cpp_get_fresh_line did not.  */
+	      _cpp_pop_buffer (pfile);
 	    }
 	  return result;
 	}
@@ -3975,7 +3985,8 @@  cpp_directive_only_process (cpp_reader *pfile,
 		  /* Prep things for directive handling. */
 		  buffer->next_line = pos;
 		  buffer->need_line = true;
-		  _cpp_get_fresh_line (pfile);
+		  bool ok = _cpp_get_fresh_line (pfile);
+		  gcc_checking_assert (ok);
 
 		  /* Ensure proper column numbering for generated
 		     error messages. */
diff --git i/libcpp/traditional.c w/libcpp/traditional.c
index 039fcfe27f5..77adb3bf595 100644
--- i/libcpp/traditional.c
+++ w/libcpp/traditional.c
@@ -312,7 +312,11 @@  _cpp_read_logical_line_trad (cpp_reader *pfile)
   do
     {
       if (pfile->buffer->need_line && !_cpp_get_fresh_line (pfile))
-	return false;
+	{
+	  /* Now pop the buffer that _cpp_get_fresh_line did not.  */
+	  _cpp_pop_buffer (pfile);
+	  return false;
+	}
     }
   while (!_cpp_scan_out_logical_line (pfile, NULL, false)
 	 || pfile->state.skipping);
diff --git i/gcc/testsuite/c-c++-common/goacc/pr79428-1.c w/gcc/testsuite/c-c++-common/goacc/pr79428-1.c
index cf4aeaf6841..68dea5b145e 100644
--- i/gcc/testsuite/c-c++-common/goacc/pr79428-1.c
+++ w/gcc/testsuite/c-c++-common/goacc/pr79428-1.c
@@ -3,4 +3,6 @@ 
 void
 foo ()
 {
-#pragma acc routine /* { dg-error ".#pragma acc routine. must be at file scope|expected" } */
+#pragma acc routine /* { dg-error ".#pragma acc routine. must be at file scope" } */
+// { dg-error "expected" "end" { target c } .-1 }
+// { dg-error "-:expected" "end" { target c++ } .+1 }
diff --git i/gcc/testsuite/c-c++-common/gomp/pr79428-2.c w/gcc/testsuite/c-c++-common/gomp/pr79428-2.c
index a26c462dbbd..0914963b8f9 100644
--- i/gcc/testsuite/c-c++-common/gomp/pr79428-2.c
+++ w/gcc/testsuite/c-c++-common/gomp/pr79428-2.c
@@ -4,4 +4,6 @@  void
 foo ()
 {
 #pragma omp sections
-#pragma omp section /* { dg-error "'#pragma omp section' may only be used in '#pragma omp sections' construct|not allowed|expected" } */
+#pragma omp section /* { dg-error "'#pragma omp section' may only be used in '#pragma omp sections' construct|not allowed" } */
+// { dg-error "expected" "end" { target c } .-1 }
+// { dg-error "-:expected" "end" { target c++ } .+1 }
diff --git i/gcc/testsuite/g++.dg/cpp0x/decltype63.C w/gcc/testsuite/g++.dg/cpp0x/decltype63.C
index 7dded0aedd8..b588bc3e5ef 100644
--- i/gcc/testsuite/g++.dg/cpp0x/decltype63.C
+++ w/gcc/testsuite/g++.dg/cpp0x/decltype63.C
@@ -5,4 +5,4 @@  template<typename T>
 class C{
  T t;
   decltype(t)::a:: // { dg-error "expected" }
-// { dg-error "-:expected"  }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C w/gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C
index 7fb7c3358fc..822b64ea460 100644
--- i/gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C
+++ w/gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C
@@ -2,4 +2,4 @@ 
 // { dg-do compile { target c++11 } }
 
 namespace alignas() N  {} // { dg-error "expected"  }
-// { dg-error "-:expected"  }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/cpp0x/pr68726.C w/gcc/testsuite/g++.dg/cpp0x/pr68726.C
index 262a1027c43..636a20c83be 100644
--- i/gcc/testsuite/g++.dg/cpp0x/pr68726.C
+++ w/gcc/testsuite/g++.dg/cpp0x/pr68726.C
@@ -5,4 +5,4 @@  template <typename> struct A {
   template <typename... _Args>
   using __has_construct typename __construct_helper<_Args...>::type;  // { dg-error "expected" }
 } struct : A<int> {   // { dg-error "expected" }
-  // { dg-error "-:expected" }
+  // { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/cpp0x/pr78341.C w/gcc/testsuite/g++.dg/cpp0x/pr78341.C
index dbf0059a6ff..8573f9f0824 100644
--- i/gcc/testsuite/g++.dg/cpp0x/pr78341.C
+++ w/gcc/testsuite/g++.dg/cpp0x/pr78341.C
@@ -2,4 +2,4 @@ 
 // { dg-do compile { target c++11 } }
 
 alignas (alignas double // { dg-error "expected" }
-// { dg-error "-:expected" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/cpp1y/pr65202.C w/gcc/testsuite/g++.dg/cpp1y/pr65202.C
index 0d217c7bc4e..a76f8da689c 100644
--- i/gcc/testsuite/g++.dg/cpp1y/pr65202.C
+++ w/gcc/testsuite/g++.dg/cpp1y/pr65202.C
@@ -25,4 +25,4 @@  int main()
     foo<ns::bar> f;
     adl::swap(f, f) // { dg-error "expected ';'" }
 }
-// { dg-error "-:expected '.'" "expected end of namespace" }
+// { dg-error "-:expected '.'" "expected end of namespace" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/cpp1y/pr65340.C w/gcc/testsuite/g++.dg/cpp1y/pr65340.C
index 848eff965e5..d3e03f75df3 100644
--- i/gcc/testsuite/g++.dg/cpp1y/pr65340.C
+++ w/gcc/testsuite/g++.dg/cpp1y/pr65340.C
@@ -16,4 +16,5 @@  struct traverse {
 };
 }
 auto &traverse = constant < functors :: traverse > ;
-operator()()->decltype(traverse(0, 0)) // { dg-error "no match|expected" }
+operator()()->decltype(traverse(0, 0))// { dg-error "no match"  }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/cpp1y/pr68578.C w/gcc/testsuite/g++.dg/cpp1y/pr68578.C
index 3fe07230117..18edd83cd7f 100644
--- i/gcc/testsuite/g++.dg/cpp1y/pr68578.C
+++ w/gcc/testsuite/g++.dg/cpp1y/pr68578.C
@@ -1,3 +1,4 @@ 
 // { dg-do compile { target c++14 } }
 
-template <typename> struct bar foo; template <> struct foo<>:  // { dg-error "class template|expected" }
+template <typename> struct bar foo; template <> struct foo<>:  // { dg-error "class template" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/cpp1z/class-deduction44.C w/gcc/testsuite/g++.dg/cpp1z/class-deduction44.C
index af91c89e463..95caa992a21 100644
--- i/gcc/testsuite/g++.dg/cpp1z/class-deduction44.C
+++ w/gcc/testsuite/g++.dg/cpp1z/class-deduction44.C
@@ -3,4 +3,4 @@ 
 
 template <typename> struct A;
 template <typename> struct B : A < B { , // { dg-error ""  }
-// { dg-error "-:expected"  }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/diagnostic/unclosed-extern-c.C w/gcc/testsuite/g++.dg/diagnostic/unclosed-extern-c.C
index 4a2519b3a7c..f905e4f3cc9 100644
--- i/gcc/testsuite/g++.dg/diagnostic/unclosed-extern-c.C
+++ w/gcc/testsuite/g++.dg/diagnostic/unclosed-extern-c.C
@@ -10,4 +10,4 @@  void bar (void);
 
 void test (void);
 // { message "12: to match this '.'" "" { target *-*-* } open_extern_c }
-/* { dg-error "-:expected '.' at end of input"  } */
+/* { dg-error "-:expected '.' at end of input" "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/g++.dg/diagnostic/unclosed-function.C w/gcc/testsuite/g++.dg/diagnostic/unclosed-function.C
index c3a0bc67868..4d841d5c6f4 100644
--- i/gcc/testsuite/g++.dg/diagnostic/unclosed-function.C
+++ w/gcc/testsuite/g++.dg/diagnostic/unclosed-function.C
@@ -1,4 +1,4 @@ 
 void test (void)
 { /* { dg-message "1: to match this '.'" } */
   int filler;
-  /* { dg-error "-:expected '.' at end of input" } */
+  /* { dg-error "-:expected '.' at end of input" "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/g++.dg/diagnostic/unclosed-namespace.C w/gcc/testsuite/g++.dg/diagnostic/unclosed-namespace.C
index 959354fc912..0887bc1e813 100644
--- i/gcc/testsuite/g++.dg/diagnostic/unclosed-namespace.C
+++ w/gcc/testsuite/g++.dg/diagnostic/unclosed-namespace.C
@@ -1,3 +1,3 @@ 
 namespace unclosed { /* { dg-message "20: to match this '.'" } */
 int filler;
-/* { dg-error "-:expected '.' at end of input" } */
+/* { dg-error "-:expected '.' at end of input" "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/g++.dg/diagnostic/unclosed-struct.C w/gcc/testsuite/g++.dg/diagnostic/unclosed-struct.C
index cf8f1e419bb..e68e5996204 100644
--- i/gcc/testsuite/g++.dg/diagnostic/unclosed-struct.C
+++ w/gcc/testsuite/g++.dg/diagnostic/unclosed-struct.C
@@ -1,3 +1,3 @@ 
 struct unclosed { /* { dg-message "17: to match this '.'" } */
   int dummy;
-  // { dg-error "-:expected"  }
+  // { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/ext/pr84598.C w/gcc/testsuite/g++.dg/ext/pr84598.C
index 4b2cc07b474..8b78e0fddea 100644
--- i/gcc/testsuite/g++.dg/ext/pr84598.C
+++ w/gcc/testsuite/g++.dg/ext/pr84598.C
@@ -1,4 +1,4 @@ 
 // { dg-options "-fpermissive -w" }
 
 template<int b> __attribute__ a([] { class c, __attribute__(vector_size(operator+()))) d; // { dg-error "" }
-// { dg-error "-:expected" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/other/switch4.C w/gcc/testsuite/g++.dg/other/switch4.C
index 63203460a39..5d0047b89c8 100644
--- i/gcc/testsuite/g++.dg/other/switch4.C
+++ w/gcc/testsuite/g++.dg/other/switch4.C
@@ -4,4 +4,4 @@  class a b;  // { dg-error "aggregate" }
 void c() {
   switch ()  // { dg-error "expected" }
   case b  // { dg-error "expected" }
-    // { dg-error "-:expected" }
+    // { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/attr4.C w/gcc/testsuite/g++.dg/parse/attr4.C
index 7713fc96c64..160c33e2625 100644
--- i/gcc/testsuite/g++.dg/parse/attr4.C
+++ w/gcc/testsuite/g++.dg/parse/attr4.C
@@ -1,3 +1,4 @@ 
 // PR c++/93684 - ICE-on-invalid with broken attribute.
 
-[[a:: // { dg-error "expected|expected" }
+[[a:: // { dg-error "expected" }
+  // { dg-error "-:expected" "" { target c++14 } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/cond4.C w/gcc/testsuite/g++.dg/parse/cond4.C
index ae210e0d750..893caeaa571 100644
--- i/gcc/testsuite/g++.dg/parse/cond4.C
+++ w/gcc/testsuite/g++.dg/parse/cond4.C
@@ -4,3 +4,4 @@ 
 void foo()                                                                                                                              
 {                                                                                                                                       
   if (struct A{}// { dg-error "types may not be defined|expected" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/crash10.C w/gcc/testsuite/g++.dg/parse/crash10.C
index 0a1a70349f1..7e2dec6bcb3 100644
--- i/gcc/testsuite/g++.dg/parse/crash10.C
+++ w/gcc/testsuite/g++.dg/parse/crash10.C
@@ -9,4 +9,4 @@  class
 {
   typename::
 ; // { dg-error "expected" }
- // { dg-error "-:expected" }
+ // { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/crash18.C w/gcc/testsuite/g++.dg/parse/crash18.C
index bf68be1a73c..596d3109ccc 100644
--- i/gcc/testsuite/g++.dg/parse/crash18.C
+++ w/gcc/testsuite/g++.dg/parse/crash18.C
@@ -4,4 +4,4 @@ 
 // PR 18095: ICE
 // Origin: Volker Reichelt <reichelt@gcc.gnu.org>
 
-struct A // { dg-error "-:expected" }
+struct A // { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/crash27.C w/gcc/testsuite/g++.dg/parse/crash27.C
index 217928781d3..08977b2a4a8 100644
--- i/gcc/testsuite/g++.dg/parse/crash27.C
+++ w/gcc/testsuite/g++.dg/parse/crash27.C
@@ -1,4 +1,5 @@ 
 // Bug: 23225
 
 void Dispatcher()
-	 (__builtin_offsetof (ArgsType, largeMsgLen)) // { dg-error "initialize|end of input" }
+	 (__builtin_offsetof (ArgsType, largeMsgLen)) // { dg-error "initialize" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/crash34.C w/gcc/testsuite/g++.dg/parse/crash34.C
index 181e5841747..86f79cc4aef 100644
--- i/gcc/testsuite/g++.dg/parse/crash34.C
+++ w/gcc/testsuite/g++.dg/parse/crash34.C
@@ -3,4 +3,5 @@ 
 
 void foo()
 {
-  namespace N { /* { dg-error "is not allowed|at end of input" } */
+  namespace N { /* { dg-error "is not allowed" } */
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/crash35.C w/gcc/testsuite/g++.dg/parse/crash35.C
index 3cae70949db..05f0a631a31 100644
--- i/gcc/testsuite/g++.dg/parse/crash35.C
+++ w/gcc/testsuite/g++.dg/parse/crash35.C
@@ -4,4 +4,4 @@ 
 struct a {};
 
 class foo : public a, a		// { dg-error "duplicate base" }
-{ // { dg-error "-:at end of input" } 
+{ // { dg-error "-:at end of input" "" { target *-*-* } .+1 } 
diff --git i/gcc/testsuite/g++.dg/parse/crash52.C w/gcc/testsuite/g++.dg/parse/crash52.C
index bc7f03c8d97..5dfb69c41d6 100644
--- i/gcc/testsuite/g++.dg/parse/crash52.C
+++ w/gcc/testsuite/g++.dg/parse/crash52.C
@@ -1,3 +1,4 @@ 
 // PR c++/39053
 
-void foo() = // { dg-error "initialized|expected" }
+void foo() = // { dg-error "initialized" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/crash59.C w/gcc/testsuite/g++.dg/parse/crash59.C
index 59947515943..7526b08e105 100644
--- i/gcc/testsuite/g++.dg/parse/crash59.C
+++ w/gcc/testsuite/g++.dg/parse/crash59.C
@@ -1,4 +1,4 @@ 
 // PR c++/53003
 
 struct A{ void a{} return b  // { dg-error "16:function definition" }
-// { dg-error "-:expected" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/crash61.C w/gcc/testsuite/g++.dg/parse/crash61.C
index e41e15105af..713fe9f15e1 100644
--- i/gcc/testsuite/g++.dg/parse/crash61.C
+++ w/gcc/testsuite/g++.dg/parse/crash61.C
@@ -5,4 +5,4 @@ 
 struct pair { constexpr pair (const) : }; // { dg-error "" }
 template <0> make_pair () {}		  // { dg-error "" }
 pair prefix[] = { 0, make_pair }	  // { dg-error "" }
-// { dg-error "-:expected" "" { target c++11 } }
+// { dg-error "-:expected" "" { target c++11 } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/crash67.C w/gcc/testsuite/g++.dg/parse/crash67.C
index 8ae6e32aa50..2a5bb3f1d91 100644
--- i/gcc/testsuite/g++.dg/parse/crash67.C
+++ w/gcc/testsuite/g++.dg/parse/crash67.C
@@ -4,4 +4,4 @@ 
 class x0;
 template <x1> x2() {  // { dg-error "declared|type" }
 x0 x3 = x3. // { dg-error "incomplete type" }
-// { dg-error "-:expected" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/error14.C w/gcc/testsuite/g++.dg/parse/error14.C
index 15ebe24f4d7..fd654180007 100644
--- i/gcc/testsuite/g++.dg/parse/error14.C
+++ w/gcc/testsuite/g++.dg/parse/error14.C
@@ -20,4 +20,4 @@  struct X
 		  //    }
 
 };   // { dg-error "1:expected primary-expression before '.' token" "primary"  }
-// { dg-error "-:expected" "at end of input" }
+// { dg-error "-:expected" "at end of input" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/error56.C w/gcc/testsuite/g++.dg/parse/error56.C
index aa0b5d2bed2..11d31973138 100644
--- i/gcc/testsuite/g++.dg/parse/error56.C
+++ w/gcc/testsuite/g++.dg/parse/error56.C
@@ -4,4 +4,4 @@  template <0> int __copy_streambufs_eof; // { dg-error "" }
 class {
 // { dg-error "forbids" "" { target *-*-* } .+1 }
     friend __copy_streambufs_eof <> ( // { dg-error "" }
- // { dg-error "-:expected" }
+ // { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/invalid1.C w/gcc/testsuite/g++.dg/parse/invalid1.C
index 72bc720bedc..cb4ef1a6902 100644
--- i/gcc/testsuite/g++.dg/parse/invalid1.C
+++ w/gcc/testsuite/g++.dg/parse/invalid1.C
@@ -3,4 +3,4 @@ 
 // { dg-options "-w" }
 
 int foo ( foo += *[ // { dg-error "expected" }
-// { dg-error "-:invalid|expected" }
+// { dg-error "-:invalid|expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/parameter-declaration-1.C w/gcc/testsuite/g++.dg/parse/parameter-declaration-1.C
index 98e82c89223..c6106d5206e 100644
--- i/gcc/testsuite/g++.dg/parse/parameter-declaration-1.C
+++ w/gcc/testsuite/g++.dg/parse/parameter-declaration-1.C
@@ -4,4 +4,4 @@ 
 
 struct {
   a(void = 0; a(0), a(0) // { dg-error "" }
-// { dg-error "-:expected" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C w/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C
index bf329248f6b..28048bd1a9a 100644
--- i/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C
+++ w/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C
@@ -8,4 +8,4 @@  main (void)
 
   z = __complex__ (1.90000007326203904e+19, 0.0);   // { dg-error "expected primary-expression before '__complex__'" "primary-expression" } 
   z = __complex__ (1.0e+0, 0.0) / z;    // { dg-error "expected primary-expression before '__complex__'" "primaty-expression" } 
-  // { dg-error "-:at end of input" "end" }
+  // { dg-error "-:at end of input" "end" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/parser-pr28152.C w/gcc/testsuite/g++.dg/parse/parser-pr28152.C
index 048cb501a57..34617340fab 100644
--- i/gcc/testsuite/g++.dg/parse/parser-pr28152.C
+++ w/gcc/testsuite/g++.dg/parse/parser-pr28152.C
@@ -8,4 +8,4 @@  main (void)
 
   z = _Complex (1.90000007326203904e+19, 0.0);   // { dg-error "expected primary-expression before '_Complex'" "primary-expression" } 
   z = _Complex (1.0e+0, 0.0) / z;    // { dg-error "expected primary-expression before '_Complex'" "primary-expression" } 
-  // { dg-error "-:at end of input" "end" }
+  // { dg-error "-:at end of input" "end" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/parse/pr68722.C w/gcc/testsuite/g++.dg/parse/pr68722.C
index 2901cbfe191..26f6d11cfe1 100644
--- i/gcc/testsuite/g++.dg/parse/pr68722.C
+++ w/gcc/testsuite/g++.dg/parse/pr68722.C
@@ -6,4 +6,4 @@  class A {
   A _M_ios_locale ios_base(ios_base &) template <_Traits> class basic_ios {  // { dg-error "" }
     basic_ios basic_ios = operator= // { dg-error "" }
 // { dg-prune-output "file ends in default argument" }
-// { dg-error "-:expected" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/pr46852.C w/gcc/testsuite/g++.dg/pr46852.C
index 9be1b92413c..5cfeaf96e19 100644
--- i/gcc/testsuite/g++.dg/pr46852.C
+++ w/gcc/testsuite/g++.dg/pr46852.C
@@ -5,4 +5,4 @@  template
 <
 class
 { // { dg-error "" }
-// { dg-error "-:"  }
+// { dg-error "-:" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/pr46868.C w/gcc/testsuite/g++.dg/pr46868.C
index dec79aaf114..25b8c966f4d 100644
--- i/gcc/testsuite/g++.dg/pr46868.C
+++ w/gcc/testsuite/g++.dg/pr46868.C
@@ -2,4 +2,4 @@ 
 // { dg-do compile }
 
 template < int > struct S { S < // { dg-error "" }
-  // { dg-error "-:expected" }
+  // { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/template/crash115.C w/gcc/testsuite/g++.dg/template/crash115.C
index 84b284770ee..c1a72352714 100644
--- i/gcc/testsuite/g++.dg/template/crash115.C
+++ w/gcc/testsuite/g++.dg/template/crash115.C
@@ -1,4 +1,4 @@ 
 // PR c++/56534
 
 template < struct template rebind < > // { dg-error "expected|must follow" }
-// { dg-error "-:expected"  }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/template/crash43.C w/gcc/testsuite/g++.dg/template/crash43.C
index a5161d887b9..3647a17cad8 100644
--- i/gcc/testsuite/g++.dg/template/crash43.C
+++ w/gcc/testsuite/g++.dg/template/crash43.C
@@ -5,4 +5,4 @@  extern "C" {
   struct ___is_pod {
     enum {
       __value = (sizeof(__gnu_internal::__test_type<_Tp>(0)))}; // { dg-error "expected|declared"  }
-// { dg-error "-:expected"  }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/template/crash90.C w/gcc/testsuite/g++.dg/template/crash90.C
index 4cfc40822a8..e2a58e31819 100644
--- i/gcc/testsuite/g++.dg/template/crash90.C
+++ w/gcc/testsuite/g++.dg/template/crash90.C
@@ -4,4 +4,6 @@  template < unsigned >
 struct A ;
 template < typename >
 struct B ;
-template < typename T , A < B < T > {}// { dg-error "initializer|parse error|type|expected" }
+template < typename T , A < B < T > {} // { dg-error "parse error|non-type|initializer" }
+
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/template/error-recovery1.C w/gcc/testsuite/g++.dg/template/error-recovery1.C
index 05f39803071..6f9ce6d6bc2 100644
--- i/gcc/testsuite/g++.dg/template/error-recovery1.C
+++ w/gcc/testsuite/g++.dg/template/error-recovery1.C
@@ -7,4 +7,4 @@  template < typename > struct T
   template < bool > struct T < S > // { dg-error "" }
   {
     void f () { // { dg-error "expected" }
-// { dg-error "-:expected"  }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.dg/template/error57.C w/gcc/testsuite/g++.dg/template/error57.C
index f3d87c53bca..121fbb1d523 100644
--- i/gcc/testsuite/g++.dg/template/error57.C
+++ w/gcc/testsuite/g++.dg/template/error57.C
@@ -2,4 +2,4 @@ 
 
 template <int()> struct a;
 template <int(b)> a < b		// { dg-error "int" }
-// { dg-error "-:expected"  }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/g++.old-deja/g++.other/crash31.C w/gcc/testsuite/g++.old-deja/g++.other/crash31.C
index 734c3f4e31a..610dfe11270 100644
--- i/gcc/testsuite/g++.old-deja/g++.other/crash31.C
+++ w/gcc/testsuite/g++.old-deja/g++.other/crash31.C
@@ -7,4 +7,4 @@  struct foo
 {
   foo();
 };
-// { dg-error "-:expected" }
+// { dg-error "-:expected" "" { target *-*-* } .+1 }
diff --git i/gcc/testsuite/gcc.dg/empty-source-2.c w/gcc/testsuite/gcc.dg/empty-source-2.c
index e0180ec9475..67906f9e8dd 100644
--- i/gcc/testsuite/gcc.dg/empty-source-2.c
+++ w/gcc/testsuite/gcc.dg/empty-source-2.c
@@ -3,4 +3,4 @@ 
 /* { dg-do compile } */
 /* { dg-options "-pedantic" } */
 
-/* { dg-warning "-:ISO C forbids an empty translation unit" "empty" } */
+/* { dg-warning "-:ISO C forbids an empty translation unit" "empty" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/gcc.dg/empty-source-3.c w/gcc/testsuite/gcc.dg/empty-source-3.c
index f8c58b3ef3f..f2877159fe4 100644
--- i/gcc/testsuite/gcc.dg/empty-source-3.c
+++ w/gcc/testsuite/gcc.dg/empty-source-3.c
@@ -4,4 +4,4 @@ 
 /* { dg-do compile } */
 /* { dg-options "-pedantic-errors" } */
 
-/* { dg-error "-:ISO C forbids an empty translation unit" "empty" } */
+/* { dg-error "-:ISO C forbids an empty translation unit" "empty" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/gcc.dg/noncompile/pr30552-3.c w/gcc/testsuite/gcc.dg/noncompile/pr30552-3.c
index 7b48e763ece..23cc7e6b253 100644
--- i/gcc/testsuite/gcc.dg/noncompile/pr30552-3.c
+++ w/gcc/testsuite/gcc.dg/noncompile/pr30552-3.c
@@ -12,4 +12,5 @@  int main()
   int g()
     int a[( {int b} )]; /* { dg-error "braced-group within expression allowed only inside a function|declaration for parameter" } */
   return 0; /* { dg-error "expected declaration specifiers before" } */
-} /* { dg-error "expected declaration specifiers before|end of input|expected declaration or statement at end of input" } */
+} /* { dg-error "expected declaration" } */
+/* { dg-error "-:expected" "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/gcc.dg/noncompile/pr35447-1.c w/gcc/testsuite/gcc.dg/noncompile/pr35447-1.c
index b9bbb733fae..499b9595f3c 100644
--- i/gcc/testsuite/gcc.dg/noncompile/pr35447-1.c
+++ w/gcc/testsuite/gcc.dg/noncompile/pr35447-1.c
@@ -4,4 +4,5 @@ 
 void foo()
 {
   ({ int i().; }); /* { dg-error "expected" } */
-} /* { dg-error "-:expected" } */
+} /* { dg-error "expected declaration" }
+/* { dg-error "-:expected" "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/gcc.dg/pr20245-1.c w/gcc/testsuite/gcc.dg/pr20245-1.c
index b5767d88b7b..ac880740662 100644
--- i/gcc/testsuite/gcc.dg/pr20245-1.c
+++ w/gcc/testsuite/gcc.dg/pr20245-1.c
@@ -2,4 +2,5 @@ 
 /* { dg-do compile } */
 /* { dg-options "" } */
 
-void foo() x; /* { dg-error "-:expected" } */
+void foo() x; /* { dg-error "expected" } */
+/* { dg-error "-:expected" "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/gcc.dg/pr28419.c w/gcc/testsuite/gcc.dg/pr28419.c
index 9974864034b..d418a165b1e 100644
--- i/gcc/testsuite/gcc.dg/pr28419.c
+++ w/gcc/testsuite/gcc.dg/pr28419.c
@@ -1,4 +1,4 @@ 
 /* { dg-do compile } */
 void foo() 
 const char* p = __FUNCTION__; /* { dg-error "" } */
-/* { dg-error "-:expected" "" } */
+/* { dg-error "-:expected" "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/gcc.dg/rtl/truncated-rtl-file.c w/gcc/testsuite/gcc.dg/rtl/truncated-rtl-file.c
index fffb4d7011a..28d898bba92 100644
--- i/gcc/testsuite/gcc.dg/rtl/truncated-rtl-file.c
+++ w/gcc/testsuite/gcc.dg/rtl/truncated-rtl-file.c
@@ -1,2 +1,2 @@ 
 void __RTL test (void)
-{ /* { dg-error "-:no closing brace" } */
+{ /* { dg-error "-:no closing brace" "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/gcc.dg/unclosed-init.c w/gcc/testsuite/gcc.dg/unclosed-init.c
index 3deb88e777c..16c42c43e55 100644
--- i/gcc/testsuite/gcc.dg/unclosed-init.c
+++ w/gcc/testsuite/gcc.dg/unclosed-init.c
@@ -1,3 +1,3 @@ 
 int unclosed[] = { /* { dg-message "18: to match this '.'" } */
   42
- /* { dg-error "-: expected '.' at end of input" } */
+ /* { dg-error "-: expected '.' at end of input" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/obj-c++.dg/property/property-neg-6.mm w/gcc/testsuite/obj-c++.dg/property/property-neg-6.mm
index c4a22eb6d20..1db6f0ba1b8 100644
--- i/gcc/testsuite/obj-c++.dg/property/property-neg-6.mm
+++ w/gcc/testsuite/obj-c++.dg/property/property-neg-6.mm
@@ -6,4 +6,4 @@ 
   int iVar;
 }
 @property int FooBar /* { dg-error "expected ';' at end of input" } */
-		     /* { dg-error "expected '@end' at end of input" "" { target *-*-* } .-1 } */
+		     /* { dg-error "-:expected '@end' at end of input" "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/obj-c++.dg/syntax-error-10.mm w/gcc/testsuite/obj-c++.dg/syntax-error-10.mm
index e45abccfc7d..6fcf96f769e 100644
--- i/gcc/testsuite/obj-c++.dg/syntax-error-10.mm
+++ w/gcc/testsuite/obj-c++.dg/syntax-error-10.mm
@@ -1 +1,2 @@ 
-@interface /* { dg-error "expected identifier" } */
+@interface
+/* { dg-error "-:expected identifier" "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/obj-c++.dg/syntax-error-8.mm w/gcc/testsuite/obj-c++.dg/syntax-error-8.mm
index 731ffda5f5e..f7cfe0e0895 100644
--- i/gcc/testsuite/obj-c++.dg/syntax-error-8.mm
+++ w/gcc/testsuite/obj-c++.dg/syntax-error-8.mm
@@ -1 +1 @@ 
-@interface A /* { dg-error "expected ..end." } */
\ No newline at end of file
+@interface A /* { dg-error "-:expected ..end." "" { target *-*-* } .+1 } */
diff --git i/gcc/testsuite/obj-c++.dg/syntax-error-9.mm w/gcc/testsuite/obj-c++.dg/syntax-error-9.mm
index 352dd34cf94..ae104e5c140 100644
--- i/gcc/testsuite/obj-c++.dg/syntax-error-9.mm
+++ w/gcc/testsuite/obj-c++.dg/syntax-error-9.mm
@@ -1,3 +1,3 @@ 
 @implementation SaturnDoc /* { dg-warning "cannot find interface declaration" } */
 - read: (void*)aStream ggg /* { dg-error "expected .:. at end of input" } */
-/* { dg-error "expected ..end. at end of input" "" { target *-*-* } .-1 } */
\ No newline at end of file
+/* { dg-error "-:expected ..end. at end of input" "" { target *-*-* } .+1 } */