From 584a7c462b32f779ea389198aaedf882199bf794 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez?= Date: Sat, 22 Aug 2015 12:44:51 +0000 Subject: [PATCH] Fix column location in c_lex_with_flags errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit gcc/testsuite/ChangeLog: 2015-08-22 Manuel López-Ibáñez * gcc.dg/cpp/multiline-2.c: Add column numbers. * gcc.dg/dollar.c: Likewise. * gcc.dg/pragma-message.c: Likewise. * g++.dg/cpp1y/digit-sep-neg.C: Likewise. * c-c++-common/raw-string-14.c: Likewise. gcc/c-family/ChangeLog: 2015-08-22 Manuel López-Ibáñez * c-lex.c (c_lex_with_flags): Use explicit locations. From-SVN: r227096 --- gcc/c-family/ChangeLog | 4 ++++ gcc/c-family/c-lex.c | 6 +++--- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/c-c++-common/raw-string-14.c | 2 +- gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C | 6 +++--- gcc/testsuite/gcc.dg/cpp/multiline-2.c | 2 +- gcc/testsuite/gcc.dg/dollar.c | 2 +- gcc/testsuite/gcc.dg/pragma-message.c | 6 +++--- 8 files changed, 24 insertions(+), 12 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index eb717a03878..2a5758aac59 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2015-08-22 Manuel López-Ibáñez + + * c-lex.c (c_lex_with_flags): Use explicit locations. + 2015-08-18 Trevor Saunders * c-ada-spec.h, c-common.c, c-common.h, c-format.c, c-format.h, diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index e9937163609..55ceb20a01f 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -523,11 +523,11 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags, cppchar_t c = tok->val.str.text[0]; if (c == '"' || c == '\'') - error ("missing terminating %c character", (int) c); + error_at (*loc, "missing terminating %c character", (int) c); else if (ISGRAPH (c)) - error ("stray %qc in program", (int) c); + error_at (*loc, "stray %qc in program", (int) c); else - error ("stray %<\\%o%> in program", (int) c); + error_at (*loc, "stray %<\\%o%> in program", (int) c); } goto retry; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 945ef0124fc..ba2444dd24f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2015-08-22 Manuel López-Ibáñez + + * gcc.dg/cpp/multiline-2.c: Add column numbers. + * gcc.dg/dollar.c: Likewise. + * gcc.dg/pragma-message.c: Likewise. + * g++.dg/cpp1y/digit-sep-neg.C: Likewise. + * c-c++-common/raw-string-14.c: Likewise. + 2015-08-21 Patrick Palka * g++.old-deja/g++.jason/overload.C: Adjust to preserve original diff --git a/gcc/testsuite/c-c++-common/raw-string-14.c b/gcc/testsuite/c-c++-common/raw-string-14.c index 2eeb7258f49..2253ffea3cc 100644 --- a/gcc/testsuite/c-c++-common/raw-string-14.c +++ b/gcc/testsuite/c-c++-common/raw-string-14.c @@ -12,7 +12,7 @@ const void *s1 = R"??/ // { dg-error "invalid new-line" "invalid" { target *-*-* } 10 } // { dg-error "stray" "stray" { target *-*-* } 10 } // { dg-warning "missing terminating" "missing" { target *-*-* } 10 } - // { dg-error "missing terminating" "missing" { target *-*-* } 10 } + // { dg-error "19:missing terminating" "missing" { target *-*-* } 10 } const void *s2 = R"abcdefghijklmn??/(a)abcdefghijklmn???"; // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 16 } // { dg-error "stray" "stray" { target *-*-* } 16 } diff --git a/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C index 54e5ed19cdc..833fab7c50b 100644 --- a/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C +++ b/gcc/testsuite/g++.dg/cpp1y/digit-sep-neg.C @@ -10,7 +10,7 @@ main() i = 0004''000'000; // { dg-error "adjacent digit separators" } i = 0B1'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0'0; // OK i = 0b'0001'0000'0000'0000'0000'0000; // { dg-error "digit separator after base indicator" } - i = 0b0001'0000'0000'0000'0000'0000'; // { dg-error "missing terminating" } + i = 0b0001'0000'0000'0000'0000'0000'; // { dg-error "38:missing terminating" } unsigned u = 0b0001'0000'0000'0000'0000'0000'U; // { dg-error "digit separator outside digit sequence" } double d = 0.0; @@ -18,10 +18,10 @@ main() d = 1.'602'176'565e-19; // { dg-error "digit separator adjacent to decimal point" } d = 1.602''176'565e-19; // { dg-error "adjacent digit separators" } d = 1.602'176'565'e-19; // { dg-error "digit separator adjacent to exponent" } - d = 1.602'176'565e'-19; // { dg-error "missing terminating" } + d = 1.602'176'565e'-19; // { dg-error "21:missing terminating" } d = 1.602'176'565e-'19; // { dg-error "digit separator adjacent to exponent" } d = 1.602'176'565e-1'9; // OK - d = 1.602'176'565e-19'; // { dg-error "missing terminating" } + d = 1.602'176'565e-19'; // { dg-error "24:missing terminating" } float f = 1.602'176'565e-19'F; // { dg-error "digit separator outside digit sequence" } } diff --git a/gcc/testsuite/gcc.dg/cpp/multiline-2.c b/gcc/testsuite/gcc.dg/cpp/multiline-2.c index 6a674b4dcd1..2841e00fb3b 100644 --- a/gcc/testsuite/gcc.dg/cpp/multiline-2.c +++ b/gcc/testsuite/gcc.dg/cpp/multiline-2.c @@ -9,6 +9,6 @@ const char *p = "line 1 " ""; /* The compiler front end sees this. */ -/* { dg-error "missing term" "multiline strings" { target *-*-* } 8 } */ +/* { dg-error "17:missing term" "multiline strings" { target *-*-* } 8 } */ /* { dg-error "missing term" "multiline strings" { target *-*-* } 9 } */ diff --git a/gcc/testsuite/gcc.dg/dollar.c b/gcc/testsuite/gcc.dg/dollar.c index 43407f227ed..e69c4e2ec83 100644 --- a/gcc/testsuite/gcc.dg/dollar.c +++ b/gcc/testsuite/gcc.dg/dollar.c @@ -6,4 +6,4 @@ /* Test that -fno-dollars-in-identifiers is honoured. Neil Booth, 17 May 2003. */ -int foobar$; /* { dg-error "stray '\\$'" } */ +int foobar$; /* { dg-error "11:stray '\\$'" } */ diff --git a/gcc/testsuite/gcc.dg/pragma-message.c b/gcc/testsuite/gcc.dg/pragma-message.c index 0f9c6bf447b..d4d1009fdef 100644 --- a/gcc/testsuite/gcc.dg/pragma-message.c +++ b/gcc/testsuite/gcc.dg/pragma-message.c @@ -16,13 +16,13 @@ matching dg-message), dejagnu will report these as excess errors. */ #pragma message " -/* { dg-error "missing terminating" "" { target *-*-* } 18 } */ +/* { dg-error "17:missing terminating" "" { target *-*-* } 18 } */ /* { dg-warning "expected a string" "" { target *-*-* } 18 } */ #pragma message "Bad 1 -/* { dg-error "missing terminating" "" { target *-*-* } 21 } */ +/* { dg-error "17:missing terminating" "" { target *-*-* } 21 } */ /* { dg-warning "expected a string" "" { target *-*-* } 21 } */ #pragma message ("Bad 2 -/* { dg-error "missing terminating" "" { target *-*-* } 24 } */ +/* { dg-error "18:missing terminating" "" { target *-*-* } 24 } */ /* { dg-warning "expected a string" "" { target *-*-* } 24 } */ #pragma message ("Bad 3" /* { dg-warning "malformed '#pragma message" "" { target *-*-* } 27 } */ -- 2.30.2