Commit 101e910b by Nathan Sidwell

[Diagnostic Patch] don't print column zero

https://gcc.gnu.org/ml/gcc-patches/2017-10/msg01911.html
	* diagnostic.c (maybe_line_and_column): New.
	(diagnostic_get_location_text): Use it.
	(diagnostic_report_current_module): Likewise.
	(test_diagnostic_get_location_text): Add tests.

	* lib/gcc-dg.exp (process-message): Use -: for no column.
	* c-c++-common/cilk-plus/CK/cilk_for_grain_errors.c: Mark elided
	column messages.
	* c-c++-common/cpp/pr58844-1.c: Likewise.
	* c-c++-common/cpp/pr58844-2.c: Likewise.
	* c-c++-common/cpp/warning-zero-location.c: Likewise.
	* g++.dg/diagnostic/pr77949.C: Likewise.
	* g++.dg/gomp/macro-4.C: Likewise.
	* gcc.dg/Wunknownprag.c: Likewise.
	* gcc.dg/builtin-redefine.c: Likewise.
	* gcc.dg/cpp/Wunknown-pragmas-1.c: Likewise.
	* gcc.dg/cpp/Wunused.c: Likewise.
	* gcc.dg/cpp/misspelled-directive-1.c: Likewise.
	* gcc.dg/cpp/redef2.c: Likewise.
	* gcc.dg/cpp/redef3.c: Likewise.
	* gcc.dg/cpp/redef4.c: Likewise.
	* gcc.dg/cpp/trad/Wunused.c: Likewise.
	* gcc.dg/cpp/trad/argcount.c: Likewise.
	* gcc.dg/cpp/trad/comment-3.c: Likewise.
	* gcc.dg/cpp/trad/comment.c: Likewise.
	* gcc.dg/cpp/trad/defined.c: Likewise.
	* gcc.dg/cpp/trad/directive.c: Likewise.
	* gcc.dg/cpp/trad/funlike-3.c: Likewise.
	* gcc.dg/cpp/trad/funlike.c: Likewise.
	* gcc.dg/cpp/trad/literals-2.c: Likewise.
	* gcc.dg/cpp/trad/macro.c: Likewise.
	* gcc.dg/cpp/trad/pr65238-4.c: Likewise.
	* gcc.dg/cpp/trad/recurse-1.c: Likewise.
	* gcc.dg/cpp/trad/recurse-2.c: Likewise.
	* gcc.dg/cpp/trad/redef2.c: Likewise.
	* gcc.dg/cpp/ucnid-11.c: Likewise.
	* gcc.dg/cpp/unc1.c: Likewise.
	* gcc.dg/cpp/unc2.c: Likewise.
	* gcc.dg/cpp/unc3.c: Likewise.
	* gcc.dg/cpp/unc4.c: Likewise.
	* gcc.dg/cpp/undef2.c: Likewise.
	* gcc.dg/cpp/warn-redefined-2.c: Likewise.
	* gcc.dg/cpp/warn-redefined.c: Likewise.
	* gcc.dg/cpp/warn-unused-macros-2.c: Likewise.
	* gcc.dg/cpp/warn-unused-macros.c: Likewise.
	* gcc.dg/empty-source-2.c: Likewise.
	* gcc.dg/empty-source-3.c: Likewise.
	* gcc.dg/gomp/macro-4.c: Likewise.
	* gcc.dg/noncompile/pr35447-1.c: Likewise.
	* gcc.dg/plugin/location-overflow-test-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.

From-SVN: r254691
parent 7ccdf51f
2017-11-13 Nathan Sidwell <nathan@acm.org>
* diagnostic.c (maybe_line_and_column): New.
(diagnostic_get_location_text): Use it.
(diagnostic_report_current_module): Likewise.
(test_diagnostic_get_location_text): Add tests.
2017-11-13 Luis Machado <luis.machado@linaro.org> 2017-11-13 Luis Machado <luis.machado@linaro.org>
* doc/md.texi (Specifying processor pipeline description): Fix * doc/md.texi (Specifying processor pipeline description): Fix
...@@ -291,6 +291,25 @@ diagnostic_get_color_for_kind (diagnostic_t kind) ...@@ -291,6 +291,25 @@ diagnostic_get_color_for_kind (diagnostic_t kind)
return diagnostic_kind_color[kind]; return diagnostic_kind_color[kind];
} }
/* Return a formatted line and column ':%line:%column'. Elided if
zero. The result is a statically allocated buffer. */
static const char *
maybe_line_and_column (int line, int col)
{
static char result[32];
if (line)
{
size_t l = snprintf (result, sizeof (result),
col ? ":%d:%d" : ":%d", line, col);
gcc_checking_assert (l < sizeof (result));
}
else
result[0] = 0;
return result;
}
/* Return a malloc'd string describing a location e.g. "foo.c:42:10". /* Return a malloc'd string describing a location e.g. "foo.c:42:10".
The caller is responsible for freeing the memory. */ The caller is responsible for freeing the memory. */
...@@ -301,19 +320,13 @@ diagnostic_get_location_text (diagnostic_context *context, ...@@ -301,19 +320,13 @@ diagnostic_get_location_text (diagnostic_context *context,
pretty_printer *pp = context->printer; pretty_printer *pp = context->printer;
const char *locus_cs = colorize_start (pp_show_color (pp), "locus"); const char *locus_cs = colorize_start (pp_show_color (pp), "locus");
const char *locus_ce = colorize_stop (pp_show_color (pp)); const char *locus_ce = colorize_stop (pp_show_color (pp));
const char *file = s.file ? s.file : progname;
int line = strcmp (file, N_("<built-in>")) ? s.line : 0;
int col = context->show_column ? s.column : 0;
if (s.file == NULL) const char *line_col = maybe_line_and_column (line, col);
return build_message_string ("%s%s:%s", locus_cs, progname, locus_ce); return build_message_string ("%s%s%s:%s", locus_cs, file,
line_col, locus_ce);
if (!strcmp (s.file, N_("<built-in>")))
return build_message_string ("%s%s:%s", locus_cs, s.file, locus_ce);
if (context->show_column)
return build_message_string ("%s%s:%d:%d:%s", locus_cs, s.file, s.line,
s.column, locus_ce);
else
return build_message_string ("%s%s:%d:%s", locus_cs, s.file, s.line,
locus_ce);
} }
/* Return a malloc'd string describing a location and the severity of the /* Return a malloc'd string describing a location and the severity of the
...@@ -575,21 +588,20 @@ diagnostic_report_current_module (diagnostic_context *context, location_t where) ...@@ -575,21 +588,20 @@ diagnostic_report_current_module (diagnostic_context *context, location_t where)
if (! MAIN_FILE_P (map)) if (! MAIN_FILE_P (map))
{ {
map = INCLUDED_FROM (line_table, map); map = INCLUDED_FROM (line_table, map);
if (context->show_column) const char *line_col
pp_verbatim (context->printer, = maybe_line_and_column (LAST_SOURCE_LINE (map),
"In file included from %r%s:%d:%d%R", "locus", context->show_column
LINEMAP_FILE (map), ? LAST_SOURCE_COLUMN (map) : 0);
LAST_SOURCE_LINE (map), LAST_SOURCE_COLUMN (map)); pp_verbatim (context->printer,
else "In file included from %r%s%s%R", "locus",
pp_verbatim (context->printer, LINEMAP_FILE (map), line_col);
"In file included from %r%s:%d%R", "locus",
LINEMAP_FILE (map), LAST_SOURCE_LINE (map));
while (! MAIN_FILE_P (map)) while (! MAIN_FILE_P (map))
{ {
map = INCLUDED_FROM (line_table, map); map = INCLUDED_FROM (line_table, map);
line_col = maybe_line_and_column (LAST_SOURCE_LINE (map), 0);
pp_verbatim (context->printer, pp_verbatim (context->printer,
",\n from %r%s:%d%R", "locus", ",\n from %r%s%s%R", "locus",
LINEMAP_FILE (map), LAST_SOURCE_LINE (map)); LINEMAP_FILE (map), line_col);
} }
pp_verbatim (context->printer, ":"); pp_verbatim (context->printer, ":");
pp_newline (context->printer); pp_newline (context->printer);
...@@ -1663,7 +1675,14 @@ test_diagnostic_get_location_text () ...@@ -1663,7 +1675,14 @@ test_diagnostic_get_location_text ()
assert_location_text ("PROGNAME:", NULL, 0, 0, true); assert_location_text ("PROGNAME:", NULL, 0, 0, true);
assert_location_text ("<built-in>:", "<built-in>", 42, 10, true); assert_location_text ("<built-in>:", "<built-in>", 42, 10, true);
assert_location_text ("foo.c:42:10:", "foo.c", 42, 10, true); assert_location_text ("foo.c:42:10:", "foo.c", 42, 10, true);
assert_location_text ("foo.c:42:", "foo.c", 42, 0, true);
assert_location_text ("foo.c:", "foo.c", 0, 10, true);
assert_location_text ("foo.c:42:", "foo.c", 42, 10, false); assert_location_text ("foo.c:42:", "foo.c", 42, 10, false);
assert_location_text ("foo.c:", "foo.c", 0, 10, false);
maybe_line_and_column (INT_MAX, INT_MAX);
maybe_line_and_column (INT_MIN, INT_MIN);
progname = old_progname; progname = old_progname;
} }
......
2017-11-13 Nathan Sidwell <nathan@acm.org>
* lib/gcc-dg.exp (process-message): Use -: for no column.
* c-c++-common/cilk-plus/CK/cilk_for_grain_errors.c: Mark elided
column messages.
* c-c++-common/cpp/pr58844-1.c: Likewise.
* c-c++-common/cpp/pr58844-2.c: Likewise.
* c-c++-common/cpp/warning-zero-location.c: Likewise.
* g++.dg/diagnostic/pr77949.C: Likewise.
* g++.dg/gomp/macro-4.C: Likewise.
* gcc.dg/Wunknownprag.c: Likewise.
* gcc.dg/builtin-redefine.c: Likewise.
* gcc.dg/cpp/Wunknown-pragmas-1.c: Likewise.
* gcc.dg/cpp/Wunused.c: Likewise.
* gcc.dg/cpp/misspelled-directive-1.c: Likewise.
* gcc.dg/cpp/redef2.c: Likewise.
* gcc.dg/cpp/redef3.c: Likewise.
* gcc.dg/cpp/redef4.c: Likewise.
* gcc.dg/cpp/trad/Wunused.c: Likewise.
* gcc.dg/cpp/trad/argcount.c: Likewise.
* gcc.dg/cpp/trad/comment-3.c: Likewise.
* gcc.dg/cpp/trad/comment.c: Likewise.
* gcc.dg/cpp/trad/defined.c: Likewise.
* gcc.dg/cpp/trad/directive.c: Likewise.
* gcc.dg/cpp/trad/funlike-3.c: Likewise.
* gcc.dg/cpp/trad/funlike.c: Likewise.
* gcc.dg/cpp/trad/literals-2.c: Likewise.
* gcc.dg/cpp/trad/macro.c: Likewise.
* gcc.dg/cpp/trad/pr65238-4.c: Likewise.
* gcc.dg/cpp/trad/recurse-1.c: Likewise.
* gcc.dg/cpp/trad/recurse-2.c: Likewise.
* gcc.dg/cpp/trad/redef2.c: Likewise.
* gcc.dg/cpp/ucnid-11.c: Likewise.
* gcc.dg/cpp/unc1.c: Likewise.
* gcc.dg/cpp/unc2.c: Likewise.
* gcc.dg/cpp/unc3.c: Likewise.
* gcc.dg/cpp/unc4.c: Likewise.
* gcc.dg/cpp/undef2.c: Likewise.
* gcc.dg/cpp/warn-redefined-2.c: Likewise.
* gcc.dg/cpp/warn-redefined.c: Likewise.
* gcc.dg/cpp/warn-unused-macros-2.c: Likewise.
* gcc.dg/cpp/warn-unused-macros.c: Likewise.
* gcc.dg/empty-source-2.c: Likewise.
* gcc.dg/empty-source-3.c: Likewise.
* gcc.dg/gomp/macro-4.c: Likewise.
* gcc.dg/noncompile/pr35447-1.c: Likewise.
* gcc.dg/plugin/location-overflow-test-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.
2017-11-13 Charles Baylis <charles.baylis@linaro.org> 2017-11-13 Charles Baylis <charles.baylis@linaro.org>
* gfortran.dg/ieee/ieee_8.f90: xfail for aarch64*-*-gnu* * gfortran.dg/ieee/ieee_8.f90: xfail for aarch64*-*-gnu*
2017-11-13 Jakub Jelinek <jakub@redhat.com> 2017-11-13 Jakub Jelinek <jakub@redhat.com>
......
...@@ -18,7 +18,7 @@ int main(int argc, char **argv) ...@@ -18,7 +18,7 @@ int main(int argc, char **argv)
_Cilk_for (int ii = 0; ii < 10; ii++) _Cilk_for (int ii = 0; ii < 10; ii++)
Array1[ii] = 0; Array1[ii] = 0;
#pragma cilk grainsiz = 2 /* { dg-warning "ignoring #pragma cilk grainsiz" } */ #pragma cilk grainsiz = 2 /* { dg-warning "-:ignoring #pragma cilk grainsiz" } */
_Cilk_for (int ii = 0; ii < 10; ii++) _Cilk_for (int ii = 0; ii < 10; ii++)
Array1[ii] = 0; Array1[ii] = 0;
......
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
#define A x######x #define A x######x
int A = 1; int A = 1;
#define A x######x /* { dg-message "previous definition" } */ #define A x######x /* { dg-message "-:previous definition" } */
#define A x##x /* { dg-warning "redefined" } */ #define A x##x /* { dg-warning "-:redefined" } */
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
#define A x######x #define A x######x
int A = 1; int A = 1;
#define A x######x /* { dg-message "previous definition" } */ #define A x######x /* { dg-message "-:previous definition" } */
#define A x##x /* { dg-warning "redefined" } */ #define A x##x /* { dg-warning "-:redefined" } */
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
{ dg-do compile } { dg-do compile }
*/ */
#define _GNU_SOURCE /* { dg-warning "redefined" } */ #define _GNU_SOURCE /* { dg-warning "-:redefined" } */
/* { dg-message "" "#define _GNU_SOURCE" {target *-*-* } 0 } */ /* { dg-message "" "#define _GNU_SOURCE" {target *-*-* } 0 } */
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
/* Very long line, where a missing semicolon would be suggested for /* Very long line, where a missing semicolon would be suggested for
insertion at column 4097. */ insertion at column 4097. */
class test { } class test { }
// { dg-error "0: expected .;. after class definition" "" { target *-*-* } .-1 } // { dg-error "-: expected .;. after class definition" "" { target *-*-* } .-1 }
...@@ -10,9 +10,9 @@ void bar (void); ...@@ -10,9 +10,9 @@ void bar (void);
void void
foo (void) foo (void)
{ {
#pragma omp p // { dg-warning "ignoring #pragma omp _Pragma" } #pragma omp p // { dg-warning "-:ignoring #pragma omp _Pragma" }
bar (); bar ();
omp_p // { dg-warning "ignoring #pragma omp _Pragma" } omp_p // { dg-warning "-:ignoring #pragma omp _Pragma" }
bar (); bar ();
} }
...@@ -22,8 +22,8 @@ foo (void) ...@@ -22,8 +22,8 @@ foo (void)
void void
baz (void) baz (void)
{ {
#pragma omp parallel // { dg-warning "ignoring #pragma omp serial" } #pragma omp parallel // { dg-warning "-:ignoring #pragma omp serial" }
bar (); bar ();
omp_parallel // { dg-warning "ignoring #pragma omp serial" } omp_parallel // { dg-warning "-:ignoring #pragma omp serial" }
bar (); bar ();
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* We used to get "unspellable token: CPP_EOF" warnings. */ /* We used to get "unspellable token: CPP_EOF" warnings. */
#pragma /* { dg-warning "ignoring #pragma" } */ #pragma /* { dg-warning "-:ignoring #pragma" } */
#pragma ~ /* { dg-warning "ignoring #pragma" } */ #pragma ~ /* { dg-warning "-:ignoring #pragma" } */
#pragma baz /* { dg-warning "ignoring #pragma" } */ #pragma baz /* { dg-warning "-:ignoring #pragma" } */
#pragma baz baz /* { dg-warning "ignoring #pragma" } */ #pragma baz baz /* { dg-warning "-:ignoring #pragma" } */
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
#define __TIME__ "X" /* Define while undefined. */ #define __TIME__ "X" /* Define while undefined. */
#define __TIME__ "X" /* Re-define while defined. */ /* { dg-line time_prev } */ #define __TIME__ "X" /* Re-define while defined. */ /* { dg-line time_prev } */
#define __TIME__ "Y" /* { dg-warning "\"__TIME__\" redefined" } */ #define __TIME__ "Y" /* { dg-warning "-:\"__TIME__\" redefined" } */
/* { dg-message "previous definition" "" { target *-*-* } time_prev } */ /* { dg-message "-:previous definition" "" { target *-*-* } time_prev } */
#undef __TIME__ /* Undefine while defined. */ #undef __TIME__ /* Undefine while defined. */
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
#define __DATE__ "X" /* Define while undefined. */ #define __DATE__ "X" /* Define while undefined. */
#define __DATE__ "X" /* Re-define while defined. */ /* { dg-line date_prev } */ #define __DATE__ "X" /* Re-define while defined. */ /* { dg-line date_prev } */
#define __DATE__ "Y" /* { dg-warning "\"__DATE__\" redefined" } */ #define __DATE__ "Y" /* { dg-warning "-:\"__DATE__\" redefined" } */
/* { dg-message "previous definition" "" { target *-*-* } date_prev } */ /* { dg-message "-:previous definition" "" { target *-*-* } date_prev } */
#undef __DATE__ /* Undefine while defined. */ #undef __DATE__ /* Undefine while defined. */
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
#define __TIMESTAMP__ "X" /* Define while already defined. */ #define __TIMESTAMP__ "X" /* Define while already defined. */
#define __TIMESTAMP__ "X" /* Re-define while defined. */ /* { dg-line timestamp_prev } */ #define __TIMESTAMP__ "X" /* Re-define while defined. */ /* { dg-line timestamp_prev } */
#define __TIMESTAMP__ "Y" /* { dg-warning "\"__TIMESTAMP__\" redefined" } */ #define __TIMESTAMP__ "Y" /* { dg-warning "-:\"__TIMESTAMP__\" redefined" } */
/* { dg-message "previous definition" "" { target *-*-* } timestamp_prev } */ /* { dg-message "-:previous definition" "" { target *-*-* } timestamp_prev } */
#undef __TIMESTAMP__ /* Undefine while defined. */ #undef __TIMESTAMP__ /* Undefine while defined. */
...@@ -71,9 +71,9 @@ ...@@ -71,9 +71,9 @@
/* { dg-bogus "Expected built-in is not defined" "" { target *-*-* } .-1 } */ /* { dg-bogus "Expected built-in is not defined" "" { target *-*-* } .-1 } */
#endif #endif
#define __LINE__ 0 /* { dg-warning "\"__LINE__\" redef" } */ #define __LINE__ 0 /* { dg-warning "-:\"__LINE__\" redef" } */
#define __INCLUDE_LEVEL__ 0 /* { dg-warning "\"__INCLUDE_LEVEL__\" redef" } */ #define __INCLUDE_LEVEL__ 0 /* { dg-warning "-:\"__INCLUDE_LEVEL__\" redef" } */
#define __COUNTER__ 0 /* { dg-warning "\"__COUNTER__\" redef" } */ #define __COUNTER__ 0 /* { dg-warning "-:\"__COUNTER__\" redef" } */
int unused; /* Silence `ISO C forbids an empty translation unit' warning. */ int unused; /* Silence `ISO C forbids an empty translation unit' warning. */
...@@ -5,25 +5,25 @@ ...@@ -5,25 +5,25 @@
/* Make sure we get warnings in the expected lines. */ /* Make sure we get warnings in the expected lines. */
#pragma unknown1 /* { dg-warning "unknown1" "unknown1" } */ #pragma unknown1 /* { dg-warning "-:unknown1" "unknown1" } */
#define COMMA , #define COMMA ,
#define FOO(x) x #define FOO(x) x
#define BAR(x) _Pragma("unknown_before") x #define BAR(x) _Pragma("unknown_before") x
#define BAZ(x) x _Pragma("unknown_after") #define BAZ(x) x _Pragma("unknown_after")
int _Pragma("unknown2") bar1; /* { dg-warning "unknown2" "unknown2" } */ int _Pragma("unknown2") bar1; /* { dg-warning "-:unknown2" "unknown2" } */
FOO(int _Pragma("unknown3") bar2); /* { dg-warning "unknown3" "unknown3" } */ FOO(int _Pragma("unknown3") bar2); /* { dg-warning "-:unknown3" "unknown3" } */
int BAR(bar3); /* { dg-warning "unknown_before" "unknown_before 1" } */ int BAR(bar3); /* { dg-warning "-:unknown_before" "unknown_before 1" } */
BAR(int bar4); /* { dg-warning "unknown_before" "unknown_before 2" } */ BAR(int bar4); /* { dg-warning "-:unknown_before" "unknown_before 2" } */
int BAZ(bar5); /* { dg-warning "unknown_after" "unknown_after 1" } */ int BAZ(bar5); /* { dg-warning "-:unknown_after" "unknown_after 1" } */
int BAZ(bar6;) /* { dg-warning "unknown_after" "unknown_after 2" } */ int BAZ(bar6;) /* { dg-warning "-:unknown_after" "unknown_after 2" } */
FOO(int bar7; _Pragma("unknown4")) /* { dg-warning "unknown4" "unknown4" } */ FOO(int bar7; _Pragma("unknown4")) /* { dg-warning "-:unknown4" "unknown4" } */
#pragma unknown5 /* { dg-warning "unknown5" "unknown5" } */ #pragma unknown5 /* { dg-warning "-:unknown5" "unknown5" } */
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
#define used3 /* { dg-bogus "used" } */ #define used3 /* { dg-bogus "used" } */
#define used4 used4 /* { dg-bogus "used" } */ #define used4 used4 /* { dg-bogus "used" } */
#define unused5 /* { dg-warning "used" } */ #define unused5 /* { dg-warning "-:used" } */
#define unused6 /* { dg-warning "used" } */ #define unused6 /* { dg-warning "-:used" } */
#define unused7() /* { dg-warning "used" } */ #define unused7() /* { dg-warning "-:used" } */
#if defined used1 #if defined used1
#endif #endif
......
#ifndef SOME_GUARD /* { dg-error "unterminated" } */ #ifndef SOME_GUARD /* { dg-error "-:unterminated" } */
#if 1 #if 1
/* Typo here: "endfi" should have been "endif". */ /* Typo here: "endfi" should have been "endif". */
......
...@@ -17,15 +17,15 @@ ...@@ -17,15 +17,15 @@
#define foo(x) x #define foo(x) x
#define foo(x)x /* { dg-bogus "redefined" "redefined foo" } */ #define foo(x)x /* { dg-bogus "redefined" "redefined foo" } */
/* { dg-warning "redefined" "redef mac" { target *-*-* } 7 } /* { dg-warning "-:redefined" "redef mac" { target *-*-* } 7 }
{ dg-warning "redefined" "redef mac" { target *-*-* } 8 } { dg-warning "-:redefined" "redef mac" { target *-*-* } 8 }
{ dg-warning "redefined" "redef mac" { target *-*-* } 9 } { dg-warning "-:redefined" "redef mac" { target *-*-* } 9 }
{ dg-warning "redefined" "redef ro" { target *-*-* } 12 } { dg-warning "-:redefined" "redef ro" { target *-*-* } 12 }
{ dg-warning "redefined" "redef va" { target *-*-* } 15 } { dg-warning "-:redefined" "redef va" { target *-*-* } 15 }
{ dg-message "previous" "prev def mac" { target *-*-* } 6 } { dg-message "-:previous" "prev def mac" { target *-*-* } 6 }
{ dg-message "previous" "prev def mac" { target *-*-* } 7 } { dg-message "-:previous" "prev def mac" { target *-*-* } 7 }
{ dg-message "previous" "prev def mac" { target *-*-* } 8 } { dg-message "-:previous" "prev def mac" { target *-*-* } 8 }
{ dg-message "previous" "prev def ro" { target *-*-* } 11 } { dg-message "-:previous" "prev def ro" { target *-*-* } 11 }
{ dg-message "previous" "prev def va" { target *-*-* } 14 } { dg-message "-:previous" "prev def va" { target *-*-* } 14 }
*/ */
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
#define D 1 2 #define D 1 2
#define E #define E
/* { dg-warning "redefined" "redef A" { target *-*-* } 7 } /* { dg-warning "-:redefined" "redef A" { target *-*-* } 7 }
{ dg-warning "redefined" "redef B" { target *-*-* } 9 } { dg-warning "-:redefined" "redef B" { target *-*-* } 9 }
{ dg-warning "redefined" "redef D" { target *-*-* } 11 } { dg-warning "-:redefined" "redef D" { target *-*-* } 11 }
{ dg-warning "redefined" "redef E" { target *-*-* } 12 } { dg-warning "-:redefined" "redef E" { target *-*-* } 12 }
{ dg-message "previous" "prev def A" { target *-*-* } 6 } { dg-message "-:previous" "prev def A" { target *-*-* } 6 }
{ dg-message "previous" "prev def B" { target *-*-* } 8 } { dg-message "-:previous" "prev def B" { target *-*-* } 8 }
{ dg-message "previous" "prev def D/E" { target *-*-* } 0 } { dg-message "-:previous" "prev def D/E" { target *-*-* } 0 }
*/ */
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
#define used3 /* { dg-bogus "used" } */ #define used3 /* { dg-bogus "used" } */
#define used4 something /* { dg-bogus "used" } */ #define used4 something /* { dg-bogus "used" } */
#define unused5 /* { dg-warning "used" } */ #define unused5 /* { dg-warning "-:used" } */
#define unused6 /* { dg-warning "used" } */ #define unused6 /* { dg-warning "-:used" } */
#define unused7() /* { dg-warning "used" } */ #define unused7() /* { dg-warning "-:used" } */
#if defined used1 #if defined used1
#endif #endif
......
...@@ -7,15 +7,15 @@ ...@@ -7,15 +7,15 @@
#define g(x, y) x y #define g(x, y) x y
#define h() #define h()
f(); /* { dg-bogus "requires 1" "no arg is 1 empty arg" } */ f(); /* { dg-bogus "-:requires 1" "no arg is 1 empty arg" } */
f( ); /* { dg-bogus "macro" "1 arg to 1 param macro" } */ f( ); /* { dg-bogus "-:macro" "1 arg to 1 param macro" } */
f(1,); /* { dg-error "passed 2" "2 args to 1 param macro" } */ f(1,); /* { dg-error "-:passed 2" "2 args to 1 param macro" } */
f(1,2); /* { dg-error "passed 2" "2 args to 1 param macro" } */ f(1,2); /* { dg-error "-:passed 2" "2 args to 1 param macro" } */
h(); /* { dg-bogus "macro" "no arg to 1 param macro" } */ h(); /* { dg-bogus "-:macro" "no arg to 1 param macro" } */
h( ); /* { dg-error "passed 1" "1 arg to 0 param macro" } */ h( ); /* { dg-error "-:passed 1" "1 arg to 0 param macro" } */
h(1,2); /* { dg-error "passed 2" "2 args to 0 param macro" } */ h(1,2); /* { dg-error "-:passed 2" "2 args to 0 param macro" } */
g(); /* { dg-error "requires 2" "0 args to 2 param macro" } */ g(); /* { dg-error "-:requires 2" "0 args to 2 param macro" } */
g( ); /* { dg-error "requires 2" "1 args to 2 param macro" } */ g( ); /* { dg-error "-:requires 2" "1 args to 2 param macro" } */
g( ,2); /* { dg-bogus "requires 2" "2 args to 2 param macro" } */ g( ,2); /* { dg-bogus "-:requires 2" "2 args to 2 param macro" } */
g(,); /* { dg-bogus "requires 2" "2 args to 2 param macro" } */ g(,); /* { dg-bogus "-:requires 2" "2 args to 2 param macro" } */
g(1,2,3); /* { dg-error "passed 3" "3 args to 2 param macro" } */ g(1,2,3); /* { dg-error "-:passed 3" "3 args to 2 param macro" } */
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
/* { dg-do preprocess } */ /* { dg-do preprocess } */
#if 0 #if 0
#endif // /* { dg-warning "extra tokens" } */ #endif // /* { dg-warning "-:extra tokens" } */
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
/* { dg-do preprocess } */ /* { dg-do preprocess } */
/* { dg-error "unterminated comment" } /* { dg-error "-:unterminated comment" }
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#error REGPARMS should be defined #error REGPARMS should be defined
#endif #endif
#define defined /* { dg-error "defined" } */ #define defined /* { dg-error "-:defined" } */
/* No diagnostics, though you could argue there should be. */ /* No diagnostics, though you could argue there should be. */
#if defined defined #if defined defined
......
...@@ -12,7 +12,7 @@ HASH ...@@ -12,7 +12,7 @@ HASH
/* Directives with their #s indented are not recognized. */ /* Directives with their #s indented are not recognized. */
#if 0 /* { dg-bogus "unterminated" } */ #if 0 /* { dg-bogus "unterminated" } */
#wrong /* { dg-error "invalid" } */ #wrong /* { dg-error "-:invalid" } */
#define foo 2 #define foo 2
#define bar + 3 #define bar + 3
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#define f(x) x #define f(x) x
#if 2 f(/* { dg-error "unterminated" "unterminated macro in directive" } */ #if 2 f(/* { dg-error "-:unterminated" "unterminated macro in directive" } */
) )
#endif #endif
f( /* { dg-error "unterminated" "unterminated macro" } */ f( /* { dg-error "-:unterminated" "unterminated macro" } */
...@@ -21,5 +21,5 @@ ...@@ -21,5 +21,5 @@
# error /* { dg-bogus "error" "empty macro" } */ # error /* { dg-bogus "error" "empty macro" } */
#endif #endif
#if f paren 6) /* { dg-error "missing binary" "macro-expanded parenthesis" } */ #if f paren 6) /* { dg-error "-:missing binary" "macro-expanded parenthesis" } */
#endif #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
recognized. */ recognized. */
/* { dg-do preprocess } */ /* { dg-do preprocess } */
/* { dg-warning "missing terminating" "bad charconst" { target *-*-* } .+2 } */ /* { dg-warning "-:missing terminating" "bad charconst" { target *-*-* } .+2 } */
/* { dg-error "not valid" "bad charconst" { target *-*-* } .+1 } */ /* { dg-error "-:not valid" "bad charconst" { target *-*-* } .+1 } */
#if 'x #if 'x
#endif #endif
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
/* { dg-do preprocess } */ /* { dg-do preprocess } */
#define f(x) #define f(x)
#define g(x, y...) /* { dg-error "macro parameter list" } */ #define g(x, y...) /* { dg-error "-:macro parameter list" } */
#if 0 #if 0
#define f(a,b) /* { dg-bogus "passed 2 arguments" } */ #define f(a,b) /* { dg-bogus "passed 2 arguments" } */
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#if __has_attribute(__has_attribute(unused)) #if __has_attribute(__has_attribute(unused))
#endif #endif
/* { dg-error "unterminated argument list invoking macro .__has_attribute." "" {target "*-*-*"} 5 } */ /* { dg-error "-:unterminated argument list invoking macro .__has_attribute." "" {target "*-*-*"} 5 } */
/* { dg-error "#if with no expression" "" {target "*-*-*"} 5 } */ /* { dg-error "-:#if with no expression" "" {target "*-*-*"} 5 } */
/* { dg-error "unterminated argument list invoking macro .__has_attribute." "" {target "*-*-*"} 7 } */ /* { dg-error "-:unterminated argument list invoking macro .__has_attribute." "" {target "*-*-*"} 7 } */
/* { dg-error "macro .__has_attribute. passed 2 arguments, but takes just 1" "" {target "*-*-*"} 9 } */ /* { dg-error "-:macro .__has_attribute. passed 2 arguments, but takes just 1" "" {target "*-*-*"} 9 } */
/* { dg-error "missing ... in expression" "" {target "*-*-*"} 9 } */ /* { dg-error "-:missing ... in expression" "" {target "*-*-*"} 9 } */
/* { dg-error "macro .__has_attribute. requires an identifier" "" {target "*-*-*"} 11 } */ /* { dg-error "-:macro .__has_attribute. requires an identifier" "" {target "*-*-*"} 11 } */
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
/* { dg-do preprocess } */ /* { dg-do preprocess } */
#define foo foo #define foo foo
foo /* { dg-error "detected recursion" } */ foo /* { dg-error "-:detected recursion" } */
#define bar a bar b #define bar a bar b
bar /* { dg-error "detected recursion" } */ bar /* { dg-error "-:detected recursion" } */
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
/* { dg-do preprocess } */ /* { dg-do preprocess } */
#define foo() foo() #define foo() foo()
foo(); /* { dg-error "detected recursion" } */ foo(); /* { dg-error "-:detected recursion" } */
#define bar() bar baz() bar #define bar() bar baz() bar
bar(); /* { dg-bogus "detected recursion" } */ bar(); /* { dg-bogus "detected recursion" } */
#define baz() foo() #define baz() foo()
baz(); /* { dg-error "detected recursion" } */ baz(); /* { dg-error "-:detected recursion" } */
#define a(x) x(a) #define a(x) x(a)
a(a); /* { dg-error "detected recursion" } */ a(a); /* { dg-error "-:detected recursion" } */
...@@ -2,31 +2,31 @@ ...@@ -2,31 +2,31 @@
/* { dg-do preprocess } */ /* { dg-do preprocess } */
#define foo bar /* { dg-message "previous def" "foo prev def" } */ #define foo bar /* { dg-message "-:previous def" "foo prev def" } */
#define foo barr /* { dg-warning "redefined" "foo redefined" } */ #define foo barr /* { dg-warning "-:redefined" "foo redefined" } */
#undef foo #undef foo
#define foo bar /* { dg-message "previous def" "foo prev def 2" } */ #define foo bar /* { dg-message "-:previous def" "foo prev def 2" } */
#define foo() bar /* { dg-warning "redefined" "foo redefined 2" } */ #define foo() bar /* { dg-warning "-:redefined" "foo redefined 2" } */
#undef foo #undef foo
#define foo() bar /* { dg-message "previous def" "foo prev def" } */ #define foo() bar /* { dg-message "-:previous def" "foo prev def" } */
#define foo() barr /* { dg-warning "redefined" "foo redefined" } */ #define foo() barr /* { dg-warning "-:redefined" "foo redefined" } */
#define quux(thud) a thud b /* { dg-message "previous def" "quux prev def" } */ #define quux(thud) a thud b /* { dg-message "-:previous def" "quux prev def" } */
#define quux(thu) a thud b /* { dg-warning "redefined" "quux redefined" } */ #define quux(thu) a thud b /* { dg-warning "-:redefined" "quux redefined" } */
#define bar(x, y) x+y /* { dg-message "previous def" "bar prev def" } */ #define bar(x, y) x+y /* { dg-message "-:previous def" "bar prev def" } */
#define bar(x, y) x+x /* { dg-warning "redefined" "bar redefined" } */ #define bar(x, y) x+x /* { dg-warning "-:redefined" "bar redefined" } */
#define bat(x, y) x+y /* { dg-message "previous def" "bat prev def" } */ #define bat(x, y) x+y /* { dg-message "-:previous def" "bat prev def" } */
#define bat(x, y) x+ y /* { dg-warning "redefined" "bat redefined" } */ #define bat(x, y) x+ y /* { dg-warning "-:redefined" "bat redefined" } */
#define baz(x, y) x+y /* { dg-message "previous def" "baz prev def" } */ #define baz(x, y) x+y /* { dg-message "-:previous def" "baz prev def" } */
#define baz(x, y) x +y /* { dg-warning "redefined" "baz redefined" } */ #define baz(x, y) x +y /* { dg-warning "-:redefined" "baz redefined" } */
#define f(x, y) "x y" /* { dg-message "previous def" "f prev def" } */ #define f(x, y) "x y" /* { dg-message "-:previous def" "f prev def" } */
#define f(x, y) "x y" /* { dg-warning "redefined" "f redefined" } */ #define f(x, y) "x y" /* { dg-warning "-:redefined" "f redefined" } */
#define g(x, y) 'x' /* { dg-message "previous def" "g prev def" } */ #define g(x, y) 'x' /* { dg-message "-:previous def" "g prev def" } */
#define g(x, y) ' x' /* { dg-warning "redefined" "g redefined" } */ #define g(x, y) ' x' /* { dg-warning "-:redefined" "g redefined" } */
...@@ -4,23 +4,23 @@ ...@@ -4,23 +4,23 @@
/* { dg-options "-std=c99 -pedantic-errors" } */ /* { dg-options "-std=c99 -pedantic-errors" } */
/* Different spelling of UCN in expansion. */ /* Different spelling of UCN in expansion. */
#define m1 \u00c1 /* { dg-message "previous definition" } */ #define m1 \u00c1 /* { dg-message "-:previous definition" } */
#define m1 \u00C1 /* { dg-error "redefined" } */ #define m1 \u00C1 /* { dg-error "-:redefined" } */
#define m1ok \u00c1 #define m1ok \u00c1
#define m1ok \u00c1 #define m1ok \u00c1
/* Different spelling of UCN in argument name. */ /* Different spelling of UCN in argument name. */
#define m2(\u00c1) /* { dg-message "previous definition" } */ #define m2(\u00c1) /* { dg-message "-:previous definition" } */
#define m2(\u00C1) /* { dg-error "redefined" } */ #define m2(\u00C1) /* { dg-error "-:redefined" } */
#define m2ok(\u00c1) #define m2ok(\u00c1)
#define m2ok(\u00c1) #define m2ok(\u00c1)
/* Same spelling in argument name but different spelling when used in /* Same spelling in argument name but different spelling when used in
expansion. */ expansion. */
#define m3(\u00c1) \u00c1 /* { dg-message "previous definition" } */ #define m3(\u00c1) \u00c1 /* { dg-message "-:previous definition" } */
#define m3(\u00c1) \u00C1 /* { dg-error "redefined" } */ #define m3(\u00c1) \u00C1 /* { dg-error "-:redefined" } */
#define m3ok(\u00c1) \u00C1 #define m3ok(\u00c1) \u00C1
#define m3ok(\u00c1) \u00C1 #define m3ok(\u00c1) \u00C1
......
/* Tests for un-terminated conditionals: 1. */ /* Tests for un-terminated conditionals: 1. */
/* { dg-do preprocess } */ /* { dg-do preprocess } */
#if 1 /* { dg-error "unterminated" "unterminated #if" } */ #if 1 /* { dg-error "-:unterminated" "unterminated #if" } */
#ifdef notdef /* { dg-bogus "unterminated" "nested terminated #ifdef" } */ #ifdef notdef /* { dg-bogus "unterminated" "nested terminated #ifdef" } */
......
/* Tests for unterminated conditionals: 2. */ /* Tests for unterminated conditionals: 2. */
/* { dg-do preprocess } */ /* { dg-do preprocess } */
#ifdef __sparc__ /* { dg-error "unterminated" "unterminated if-elif-elif..." } */ #ifdef __sparc__ /* { dg-error "-:unterminated" "unterminated if-elif-elif..." } */
sparc sparc
#elif defined __powerpc__ #elif defined __powerpc__
ppc ppc
......
/* Tests for unterminated conditionals: 3. */ /* Tests for unterminated conditionals: 3. */
/* { dg-do preprocess } */ /* { dg-do preprocess } */
#if 1 /* { dg-error "#else" "unterminated #else" } */ #if 1 /* { dg-error "-:#else" "unterminated #else" } */
#else #else
...@@ -36,4 +36,4 @@ ignored ...@@ -36,4 +36,4 @@ ignored
/* dg.exp doesn't read the included files for tags, so we have to /* dg.exp doesn't read the included files for tags, so we have to
do them explicitly here. */ do them explicitly here. */
/* { dg-error "#if" "unc1.c: unterminated #if" { target *-*-* } 4 } */ /* { dg-error "-:#if" "unc1.c: unterminated #if" { target *-*-* } 4 } */
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
/* { dg-do preprocess } */ /* { dg-do preprocess } */
#undef __DATE__ /* { dg-warning "undefining" "__DATE__" } */ #undef __DATE__ /* { dg-warning "-:undefining \"__DATE__\"" } */
#undef __TIME__ /* { dg-warning "undefining" "__TIME__" } */ #undef __TIME__ /* { dg-warning "-:undefining \"__TIME__\"" } */
#undef __FILE__ /* { dg-warning "undefining" "__FILE__" } */ #undef __FILE__ /* { dg-warning "-:undefining \"__FILE__\"" } */
#undef __LINE__ /* { dg-warning "undefining" "__LINE__" } */ #undef __LINE__ /* { dg-warning "undefining \"__LINE__\"" } */
#undef __STDC__ /* { dg-warning "undefining" "__STDC__" } */ #undef __STDC__ /* { dg-warning "undefining \"__STDC__\"" } */
/* These should be protected from #undef, but aren't, because they /* These should be protected from #undef, but aren't, because they
are set with normal #define commands - and on top of that, some are set with normal #define commands - and on top of that, some
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
// { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } .-1 } // { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } .-1 }
#endif #endif
#define __TIME__ "X" // { dg-error "\"__TIME__\" redefined .-Werror=builtin-macro-redefined." } #define __TIME__ "X" // { dg-error "-:\"__TIME__\" redefined .-Werror=builtin-macro-redefined." }
#define __TIME__ "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } #define __TIME__ "Y" // { dg-bogus "-Wbuiltin-macro-redefined" }
// { dg-warning "\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 } // { dg-warning "-:\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 }
// { dg-message "previous definition" "previous-1" { target *-*-* } 9 } // { dg-message "-:previous definition" "previous-1" { target *-*-* } 9 }
#define X "X" #define X "X"
#define X "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } #define X "Y" // { dg-bogus "-Wbuiltin-macro-redefined" }
// { dg-warning "\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 } // { dg-warning "-:\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 }
// { dg-message "previous definition" "previous-2" { target *-*-* } 15 } // { dg-message "-:previous definition" "previous-2" { target *-*-* } 15 }
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
// { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } .-1 } // { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } .-1 }
#endif #endif
#define __TIME__ "X" // { dg-warning "\"__TIME__\" redefined .-Wbuiltin-macro-redefined." } #define __TIME__ "X" // { dg-warning "-:\"__TIME__\" redefined .-Wbuiltin-macro-redefined." }
#define __TIME__ "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } #define __TIME__ "Y" // { dg-bogus "-Wbuiltin-macro-redefined" }
// { dg-warning "\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 } // { dg-warning "-:\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } .-1 }
// { dg-message "previous definition" "previous-1" { target *-*-* } 9 } // { dg-message "-:previous definition" "previous-1" { target *-*-* } 9 }
#define X "X" #define X "X"
#define X "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } #define X "Y" // { dg-bogus "-Wbuiltin-macro-redefined" }
// { dg-warning "\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 } // { dg-warning "-:\"X\" redefined" "not-builtin-2" { target *-*-* } .-1 }
// { dg-message "previous definition" "previous-2" { target *-*-* } 15 } // { dg-message "-:previous definition" "previous-2" { target *-*-* } 15 }
// { dg-do preprocess } // { dg-do preprocess }
// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=unused-macros" } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=unused-macros" }
/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */
#define X X // { dg-error "macro \"X\" is not used .-Werror=unused-macros." } #define X X // { dg-error "-:macro \"X\" is not used .-Werror=unused-macros." }
// { dg-do preprocess } // { dg-do preprocess }
// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wunused-macros" } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Wunused-macros" }
#define X X // { dg-warning "macro \"X\" is not used .-Wunused-macros." } #define X X // { dg-warning "-:macro \"X\" is not used .-Wunused-macros." }
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-pedantic" } */ /* { dg-options "-pedantic" } */
/* { dg-warning "ISO C forbids an empty translation unit" "empty" } */ /* { dg-warning "-:ISO C forbids an empty translation unit" "empty" } */
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-pedantic-errors" } */ /* { dg-options "-pedantic-errors" } */
/* { dg-error "ISO C forbids an empty translation unit" "empty" } */ /* { dg-error "-:ISO C forbids an empty translation unit" "empty" } */
...@@ -10,9 +10,9 @@ void bar (void); ...@@ -10,9 +10,9 @@ void bar (void);
void void
foo (void) foo (void)
{ {
#pragma omp p /* { dg-warning "ignoring #pragma omp _Pragma" } */ #pragma omp p /* { dg-warning "-:ignoring #pragma omp _Pragma" } */
bar (); bar ();
omp_p /* { dg-warning "ignoring #pragma omp _Pragma" } */ omp_p /* { dg-warning "-:ignoring #pragma omp _Pragma" } */
bar (); bar ();
} }
...@@ -22,8 +22,8 @@ foo (void) ...@@ -22,8 +22,8 @@ foo (void)
void void
baz (void) baz (void)
{ {
#pragma omp parallel /* { dg-warning "ignoring #pragma omp serial" } */ #pragma omp parallel /* { dg-warning "-:ignoring #pragma omp serial" } */
bar (); bar ();
omp_parallel /* { dg-warning "ignoring #pragma omp serial" } */ omp_parallel /* { dg-warning "-:ignoring #pragma omp serial" } */
bar (); bar ();
} }
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
void foo() void foo()
{ {
({ int i().; }); /* { dg-error "expected" } */ ({ int i().; }); /* { dg-error "expected" } */
} /* { dg-error "expected" } */ } /* { dg-error "-:expected" } */
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
numbers are available. */ numbers are available. */
/* Verify that we're in column-less mode. */ /* Verify that we're in column-less mode. */
extern unknown_type test; /* { dg-error "0: unknown type name" } */ extern unknown_type test; /* { dg-error "-:unknown type name" } */
/* PR c++/68819: verify that -Wmisleading-indentation is suppressed. */ /* PR c++/68819: verify that -Wmisleading-indentation is suppressed. */
...@@ -13,7 +13,7 @@ int ...@@ -13,7 +13,7 @@ int
fn_1 (int flag) fn_1 (int flag)
{ {
int x = 4, y = 5; int x = 4, y = 5;
if (flag) x = 3; y = 2; /* { dg-message "disabled from this point" } */ if (flag) x = 3; y = 2; /* { dg-message "-:disabled from this point" } */
return x * y; return x * y;
} }
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "" } */ /* { dg-options "" } */
void foo() x; /* { dg-error "expected" } */ void foo() x; /* { dg-error "-:expected" } */
/* { dg-do compile } */ /* { dg-do compile } */
void foo() void foo()
const char* p = __FUNCTION__; /* { dg-error "" } */ const char* p = __FUNCTION__; /* { dg-error "" } */
/* { dg-error "-:expected" "" } */
void __RTL test (void) void __RTL test (void)
{ /* { dg-error "no closing brace" } */ { /* { dg-error "-:no closing brace" } */
int unclosed[] = { /* { dg-message "18: to match this '.'" } */ int unclosed[] = { /* { dg-message "18: to match this '.'" } */
42 42
/* { dg-error "0: expected '.' at end of input" } */ /* { dg-error "-: expected '.' at end of input" } */
...@@ -1092,24 +1092,27 @@ proc process-message { msgproc msgprefix dgargs } { ...@@ -1092,24 +1092,27 @@ proc process-message { msgproc msgprefix dgargs } {
set newentry [lindex ${dg-messages} end] set newentry [lindex ${dg-messages} end]
set expmsg [lindex $newentry 2] set expmsg [lindex $newentry 2]
set column ""
# Handle column numbers from the specified expression (if there is # Handle column numbers from the specified expression (if there is
# one) and set up the search expression that will be used by DejaGnu. # one) and set up the search expression that will be used by DejaGnu.
if [regexp "^(\[0-9\]+):" $expmsg "" column] { if [regexp {^-:} $expmsg] {
# The expected column is -, so shouldn't appear.
set expmsg [string range $expmsg 2 end]
} elseif [regexp {^[0-9]+:} $expmsg column] {
# The expression in the directive included a column number. # The expression in the directive included a column number.
# Remove "COLUMN:" from the original expression and move it # Remove it from the original expression and move it
# to the proper place in the search expression. # to the proper place in the search expression.
regsub "^\[0-9\]+:" $expmsg "" expmsg set expmsg [string range $expmsg [string length $column] end]
set expmsg "$column: $msgprefix\[^\n\]*$expmsg"
} elseif [string match "" [lindex $newentry 0]] { } elseif [string match "" [lindex $newentry 0]] {
# The specified line number is 0; don't expect a column number. # The specified line number is 0; don't expect a column number.
set expmsg "$msgprefix\[^\n\]*$expmsg"
} else { } else {
# There is no column number in the search expression, but we # There is no column number in the search expression, but we
# should expect one in the message itself. # should expect one in the message itself.
set expmsg "\[0-9\]+: $msgprefix\[^\n\]*$expmsg" set column {[0-9]+:}
} }
set expmsg "$column $msgprefix\[^\n\]*$expmsg"
set newentry [lreplace $newentry 2 2 $expmsg] set newentry [lreplace $newentry 2 2 $expmsg]
set dg-messages [lreplace ${dg-messages} end end $newentry] set dg-messages [lreplace ${dg-messages} end end $newentry]
verbose "process-message:\n${dg-messages}" 2 verbose "process-message:\n${dg-messages}" 2
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment