diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 86882e5def93a3a0b25d7efff4d33a6faaeb0bed..9789c01fb9c1d2264748134d33f3af0adc7fe819 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-06-01 Aldy Hernandez <aldyh@redhat.com> + + * diagnostic.c (diagnostic_build_prefix): Always print columns. + (diagnostic_report_current_module): Print columns. + * common.opt (flag_show_column): Enable by default. + 2009-06-01 Luis Machado <luisgpm@br.ibm.com> * alias.c (find_base_term): Check for NULL term before returning. diff --git a/gcc/common.opt b/gcc/common.opt index c70639ec42d7e1bfaec7743a3b97052ddae0fb51..d3cbe169332404deef37aea6b15270e2b3a7b662 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1049,8 +1049,8 @@ Common Report Var(flag_see) Init(0) Eliminate redundant sign extensions using LCM. fshow-column -Common C ObjC C++ ObjC++ Report Var(flag_show_column) Init(0) -Show column numbers in diagnostics, when available. Default off +Common C ObjC C++ ObjC++ Report Var(flag_show_column) Init(1) +Show column numbers in diagnostics, when available. Default on fsignaling-nans Common Report Var(flag_signaling_nans) Optimization diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e7e223ed2a43f2aa783c39e756c58148756147c9..2aee90842eff7fe31b6f511be0d28b2fa48e00f5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2009-06-01 Aldy Hernandez <aldyh@redhat.com> + + * error.c (print_instantiation_partial_context): Print column + numbers. + 2009-05-29 Ian Lance Taylor <iant@google.com> * error.c (cp_printer): Don't use va_arg with enum type. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 004543dd210349082f29f556a0f777698b59b907..7be241dd02e738e8212361d852ec443e43f4acae 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -2705,19 +2705,30 @@ print_instantiation_partial_context (diagnostic_context *context, struct tinst_level *t, location_t loc) { expanded_location xloc; + const char *str; for (; ; t = t->next) { xloc = expand_location (loc); if (t == NULL) break; - pp_verbatim (context->printer, _("%s:%d: instantiated from %qs\n"), - xloc.file, xloc.line, - decl_as_string_translate (t->decl, - TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE)); + str = decl_as_string_translate (t->decl, + TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE); + if (flag_show_column) + pp_verbatim (context->printer, + _("%s:%d:%d: instantiated from %qs\n"), + xloc.file, xloc.line, xloc.column, str); + else + pp_verbatim (context->printer, + _("%s:%d: instantiated from %qs\n"), + xloc.file, xloc.line, str); loc = t->locus; } - pp_verbatim (context->printer, _("%s:%d: instantiated from here"), - xloc.file, xloc.line); + if (flag_show_column) + pp_verbatim (context->printer, _("%s:%d:%d: instantiated from here"), + xloc.file, xloc.line, xloc.column); + else + pp_verbatim (context->printer, _("%s:%d: instantiated from here"), + xloc.file, xloc.line); pp_base_newline (context->printer); } diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 42a40c6f33751d9d200f36ba94a5a415fe8c54df..3f7bab19d8b7222b13c49d8a281137859a01ee6d 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -162,7 +162,7 @@ diagnostic_build_prefix (diagnostic_info *diagnostic) return (s.file == NULL ? build_message_string ("%s: %s", progname, text) - : flag_show_column && s.column != 0 + : flag_show_column ? build_message_string ("%s:%d:%d: %s", s.file, s.line, s.column, text) : build_message_string ("%s:%d: %s", s.file, s.line, text)); } @@ -244,9 +244,15 @@ diagnostic_report_current_module (diagnostic_context *context) if (! MAIN_FILE_P (map)) { map = INCLUDED_FROM (line_table, map); - pp_verbatim (context->printer, - "In file included from %s:%d", - map->to_file, LAST_SOURCE_LINE (map)); + if (flag_show_column) + pp_verbatim (context->printer, + "In file included from %s:%d:%d", + map->to_file, + LAST_SOURCE_LINE (map), LAST_SOURCE_COLUMN (map)); + else + pp_verbatim (context->printer, + "In file included from %s:%d", + map->to_file, LAST_SOURCE_LINE (map)); while (! MAIN_FILE_P (map)) { map = INCLUDED_FROM (line_table, map); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 69613d1a36db11dc1dd9ca1b35a190023fb0f905..9e10c591404d73d64cdb19d2f4d674c6824ae900 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,46 @@ +2009-06-01 Aldy Hernandez <aldyh@redhat.com> + + * lib/gcc-dg.exp (dg-bogus): Override dg-bogus. + (process-message): Expect column numbers. + * gcc.dg/va-arg-2.c: Use line 0 to indicate no column. + * gcc.dg/pch/counter-2.c: Same. + * gcc.dg/pch/valid-2.c: Same. + * gcc.dg/pch/warn-1.c: Same. + * gcc.dg/pch/valid-1.c: Same. + * gcc.dg/cpp/include2a.c: Handle lack of columns. + * gcc.dg/cpp/syshdr.c: Same. + * gcc.dg/cpp/19940712-1.c: Same. + * gcc.dg/cpp/missing-header-1.c: Same. + * gcc.dg/cpp/unc4.c: Remove -fno-show-column. + * gcc.dg/cpp/tr-warn3.c: Same. + * gcc.dg/cpp/pr29612-2.c: Same. + * gcc.dg/cpp/tr-warn4.c: Same. + * gcc.dg/cpp/Wtrigraphs.c: Same. + * gcc.dg/cpp/poison.c: Same. + * gcc.dg/cpp/arith-3.c: Same. + * gcc.dg/cpp/sysmac2.c: Same. + * gcc.dg/cpp/cpp.exp: Same. + * gcc.dg/cpp/tr-warn5.c: Same. + * gcc.dg/cpp/include2.c: Same. + * gcc.dg/cpp/Wmissingdirs.c: Same. + * gcc.dg/cpp/Wmissingdirs.c: Same. + * gcc.dg/cpp/tr-warn6.c: Same. + * gcc.dg/cpp/Wtrigraphs-2.c: Same. + * gcc.dg/cpp/macspace1.c: Same. + * gcc.dg/cpp/escape-2.c: Same. + * gcc.dg/cpp/assert2.c: Same. + * gcc.dg/cpp/undef2.c: Same. + * gcc.dg/cpp/macspace2.c: Same. + * gcc.dg/cpp/tr-warn1.c: Same. + * gcc.dg/cpp/extratokens2.c: Same. + * gcc.dg/cpp/strify2.c: Same. + * gcc.dg/cpp/Wsignprom.c: Same. + * gcc.dg/cpp/redef2.c: Same. + * gcc.dg/cpp/trad/trad.exp: Same. + * gcc.dg/cpp/arith-1.c: Same. + * gcc.dg/cpp/extratokens.c: Same. + * gcc.dg/cpp/if-mpar.c: Same. + 2009-06-01 Olivier Hainque <hainque@adacore.com> * gnat.dg/nested_float_packed.ads: New test. diff --git a/gcc/testsuite/gcc.dg/cpp/19940712-1.c b/gcc/testsuite/gcc.dg/cpp/19940712-1.c index 98bcd767966d42b2a294f8269e3099fcef5dfacb..a79b2f5484d56bf867464a2a95f9ab9922e6a664 100644 --- a/gcc/testsuite/gcc.dg/cpp/19940712-1.c +++ b/gcc/testsuite/gcc.dg/cpp/19940712-1.c @@ -5,8 +5,9 @@ /* { dg-error "unterminated comment" "" { target *-*-* } 4 } */ /* { dg-error "unterminated comment" "header error" { target *-*-* } 8 } */ -#include "19940712-1.h" /* { dg-message "" } // In file included from: */ -#include "19940712-1a.h" /* { dg-message "" } // In file included from: */ +#include "19940712-1.h" +/* { dg-message "" "In file included from:" { target *-*-* } 0 } */ +#include "19940712-1a.h" #include "19940712-1b.h" /* comment start in comment error diff --git a/gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c b/gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c index 915aaa8de9885b5f9fa93e501c94af39908167c0..69b3aae3da603390ec85b2870513ff656d8a74fd 100644 --- a/gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c +++ b/gcc/testsuite/gcc.dg/cpp/Wmissingdirs.c @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=gnu99 -I /jolly/well/better/not/exist -Wmissing-include-dirs -fno-show-column" } */ +/* { dg-options "-std=gnu99 -I /jolly/well/better/not/exist -Wmissing-include-dirs" } */ /* Test that -Wmissing-include-dirs issues a warning when a specified directory does not exist. Source Ben Elliston, 2004-05-13. */ diff --git a/gcc/testsuite/gcc.dg/cpp/Wsignprom.c b/gcc/testsuite/gcc.dg/cpp/Wsignprom.c index 7cdbccb3cac978ab3def02608ef9c6d5af12df41..87d422b794fdcc89c4e8749a87b88177c910469e 100644 --- a/gcc/testsuite/gcc.dg/cpp/Wsignprom.c +++ b/gcc/testsuite/gcc.dg/cpp/Wsignprom.c @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-Wall -fshow-column" } */ +/* { dg-options "-Wall" } */ /* Test that -Wall emits the warnings about integer promotion changing the sign of an operand. */ diff --git a/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c b/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c index 43bf134842aea34d98af78f7b68b3ac66bf34205..8d61f2841f0fd3a1a48d80919d6c3baf238ae85d 100644 --- a/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c +++ b/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=c99 -Wtrigraphs -fno-show-column" } */ +/* { dg-options "-std=c99 -Wtrigraphs" } */ /* Test warnings for trigraphs in comments, with trigraphs enabled. Neil Booth. 4 May 2003. */ diff --git a/gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c b/gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c index 5ed6c98ad49ed7a71d1824f70c8bcbd33d457dcc..d4be2040c18328822ccd06476ff124c4c8b19282 100644 --- a/gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c +++ b/gcc/testsuite/gcc.dg/cpp/Wtrigraphs.c @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=gnu99 -Wtrigraphs -fno-show-column" } */ +/* { dg-options "-std=gnu99 -Wtrigraphs" } */ /* Test we don't double warn for trigraphs immediately after preceding text. Source Neil Booth. 22 Nov 2000. */ diff --git a/gcc/testsuite/gcc.dg/cpp/arith-1.c b/gcc/testsuite/gcc.dg/cpp/arith-1.c index 85d5848d8008b5909687ef502da96987bac811cc..99e3cd7be2e632ee75b95611346c3a2d82c40ef7 100644 --- a/gcc/testsuite/gcc.dg/cpp/arith-1.c +++ b/gcc/testsuite/gcc.dg/cpp/arith-1.c @@ -7,7 +7,7 @@ independent of target precision. */ /* { dg-do preprocess } */ -/* { dg-options -fno-show-column } */ +/* { dg-options "" } */ /* Test || operator and its short circuiting. */ #if 0 || 0 diff --git a/gcc/testsuite/gcc.dg/cpp/arith-3.c b/gcc/testsuite/gcc.dg/cpp/arith-3.c index cc5fd1b3bf7bef74162c6a921a56f697538260f1..3015d31657acf08765b4eaf118f7e2b6679968d1 100644 --- a/gcc/testsuite/gcc.dg/cpp/arith-3.c +++ b/gcc/testsuite/gcc.dg/cpp/arith-3.c @@ -9,7 +9,7 @@ Please keep changes to arith-2.c and arith-3.c in sync. */ /* { dg-do preprocess } */ -/* { dg-options "-std=c99 -fno-show-column" } */ +/* { dg-options "-std=c99" } */ #include <limits.h> diff --git a/gcc/testsuite/gcc.dg/cpp/assert2.c b/gcc/testsuite/gcc.dg/cpp/assert2.c index 130f7f5320a144e49bf47bdac75158f725ce3c05..5228bcbb3a912bac18b530ec3bc2cf2f51d99036 100644 --- a/gcc/testsuite/gcc.dg/cpp/assert2.c +++ b/gcc/testsuite/gcc.dg/cpp/assert2.c @@ -1,6 +1,6 @@ /* Malformed assertion tests. */ /* { dg-do preprocess } */ -/* { dg-options "-fno-show-column -Wno-deprecated" } */ +/* { dg-options "-Wno-deprecated" } */ #assert /* { dg-error "without predicate" "assert w/o predicate" } */ #assert % /* { dg-error "an identifier" "assert punctuation" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/cpp.exp b/gcc/testsuite/gcc.dg/cpp/cpp.exp index 1dc504e30ba8cc0d1fe1bdd128382d36f7ae6e0f..acf0898407b57b9289cf711ed69bdc6d85f0db06 100644 --- a/gcc/testsuite/gcc.dg/cpp/cpp.exp +++ b/gcc/testsuite/gcc.dg/cpp/cpp.exp @@ -37,7 +37,7 @@ dg-init # Main loop. dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,S} ]] \ - "-fno-show-column" $DEFAULT_CFLAGS + "" $DEFAULT_CFLAGS # All done. dg-finish diff --git a/gcc/testsuite/gcc.dg/cpp/escape-2.c b/gcc/testsuite/gcc.dg/cpp/escape-2.c index e79fa91cbe9e558cca2c4fb114b291c2eee6593f..902fad3a2c2e0a7c8e751bf9b0026a08dcef04b5 100644 --- a/gcc/testsuite/gcc.dg/cpp/escape-2.c +++ b/gcc/testsuite/gcc.dg/cpp/escape-2.c @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Free Software Foundation, Inc. */ /* { dg-do compile } */ -/* { dg-options "-pedantic -std=c99 -fno-show-column" } */ +/* { dg-options "-pedantic -std=c99" } */ /* This tests various diagnostics with -pedantic about escape sequences, for both the preprocessor and the compiler. diff --git a/gcc/testsuite/gcc.dg/cpp/escape.c b/gcc/testsuite/gcc.dg/cpp/escape.c index c9dd44e43e5bd7c84ba09be8b21f434aff2d96d2..e7d5e08dd49382ecd2e1b47d131852964b51d73a 100644 --- a/gcc/testsuite/gcc.dg/cpp/escape.c +++ b/gcc/testsuite/gcc.dg/cpp/escape.c @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Free Software Foundation, Inc. */ /* { dg-do compile } */ -/* { dg-options "-Wtraditional -std=c89 -fno-show-column" } */ +/* { dg-options "-Wtraditional -std=c89" } */ /* This tests various diagnostics with -Wtraditioanl about escape sequences, for both the preprocessor and the compiler. diff --git a/gcc/testsuite/gcc.dg/cpp/extratokens.c b/gcc/testsuite/gcc.dg/cpp/extratokens.c index d3e941bfff05239d2ea86a187b7cd7862d14284b..11d094af572d506f29c2496572acd4d6356653b1 100644 --- a/gcc/testsuite/gcc.dg/cpp/extratokens.c +++ b/gcc/testsuite/gcc.dg/cpp/extratokens.c @@ -1,7 +1,7 @@ /* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ -/* { dg-options "-fno-show-column -Wno-deprecated" } */ +/* { dg-options "-Wno-deprecated" } */ /* Tests all directives that do not permit excess tokens at the end of the line. */ diff --git a/gcc/testsuite/gcc.dg/cpp/extratokens2.c b/gcc/testsuite/gcc.dg/cpp/extratokens2.c index fe682bfa59d88cc1368082cf78276e1dda1e1663..8e69a96c5b50d5aa614a3198b8c19ebf45d866c0 100644 --- a/gcc/testsuite/gcc.dg/cpp/extratokens2.c +++ b/gcc/testsuite/gcc.dg/cpp/extratokens2.c @@ -1,7 +1,7 @@ /* Copyright (C) 2002 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ -/* { dg-options "-fno-show-column -Wno-endif-labels" } */ +/* { dg-options "-Wno-endif-labels" } */ /* Tests that -Wno-endif-labels correctly disables the checks done by default (and tested in extratokens.c). */ diff --git a/gcc/testsuite/gcc.dg/cpp/if-mpar.c b/gcc/testsuite/gcc.dg/cpp/if-mpar.c index 633cefcb44202ea30bad52fe66bebc0e4e507232..45dd78b1e673cef8e146cd7de9bfa17d983a0a8d 100644 --- a/gcc/testsuite/gcc.dg/cpp/if-mpar.c +++ b/gcc/testsuite/gcc.dg/cpp/if-mpar.c @@ -4,7 +4,6 @@ missing parenthesis message. */ /* { dg-do preprocess } */ -/* { dg-options "-fshow-column" } */ #if (1 /* { dg-error "5:missing '\\)'" "missing ')' no. 1" } */ #endif diff --git a/gcc/testsuite/gcc.dg/cpp/include2.c b/gcc/testsuite/gcc.dg/cpp/include2.c index 67f1065ae8c609f0128f4debc99ed2072feafc6a..de34255ec35180e3e97e96c76757a55b1819bf47 100644 --- a/gcc/testsuite/gcc.dg/cpp/include2.c +++ b/gcc/testsuite/gcc.dg/cpp/include2.c @@ -11,5 +11,5 @@ /* These error is No such file or directory, just once. However, this message is locale-dependent, so don't test for it. */ -/* { dg-error "silly" "" { target *-*-* } 10 } */ +/* { dg-error "silly" "" { target *-*-* } 0 } */ /* { dg-message "terminated" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/include2a.c b/gcc/testsuite/gcc.dg/cpp/include2a.c index 974f3f332630229111dd987d174564602e90e168..6a11c92cff262e695ba7c151b011cee5ca78198c 100644 --- a/gcc/testsuite/gcc.dg/cpp/include2a.c +++ b/gcc/testsuite/gcc.dg/cpp/include2a.c @@ -11,6 +11,6 @@ /* These error is No such file or directory, just once. However, this message is locale-dependent, so don't test for it. */ -/* { dg-error "silly" "" { target *-*-* } 10 } */ -/* { dg-error "missing" "" { target *-*-* } 10 } */ +/* { dg-error "silly" "" { target *-*-* } 0 } */ +/* { dg-error "missing" "" { target *-*-* } 0 } */ /* { dg-message "terminated" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/macspace1.c b/gcc/testsuite/gcc.dg/cpp/macspace1.c index daf14d2b1f13f4a3f070ba437c13280309b5a859..d8578448b64e9bf877976c08d5eafaf1db0b11ac 100644 --- a/gcc/testsuite/gcc.dg/cpp/macspace1.c +++ b/gcc/testsuite/gcc.dg/cpp/macspace1.c @@ -1,6 +1,6 @@ /* PR preprocessor/19475 */ /* { dg-do preprocess } */ -/* { dg-options "-std=iso9899:1990 -pedantic-errors -fno-show-column" } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ #define a! /* { dg-warning "missing whitespace" } */ #define b" /* { dg-warning "missing whitespace" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/macspace2.c b/gcc/testsuite/gcc.dg/cpp/macspace2.c index 7a81eceeac8b813639632b63a6a41065b79f4f89..1494fed18c3a56daa3fae39c62738194c48cb70b 100644 --- a/gcc/testsuite/gcc.dg/cpp/macspace2.c +++ b/gcc/testsuite/gcc.dg/cpp/macspace2.c @@ -1,6 +1,6 @@ /* PR preprocessor/19475 */ /* { dg-do preprocess } */ -/* { dg-options "-std=iso9899:1999 -pedantic-errors -fno-show-column" } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ #define a! /* { dg-error "requires whitespace" } */ #define b" /* { dg-error "requires whitespace" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/missing-header-1.c b/gcc/testsuite/gcc.dg/cpp/missing-header-1.c index 5445d4c4fec7a36e775fdddf7f8c6d0e2b0783fc..dbcc2b36167030b986a6f9ad85b6ef139359e921 100644 --- a/gcc/testsuite/gcc.dg/cpp/missing-header-1.c +++ b/gcc/testsuite/gcc.dg/cpp/missing-header-1.c @@ -2,7 +2,8 @@ /* { dg-do compile } */ /* { dg-options "" } */ -#include "nonexistent.h" /* { dg-error "nonexistent.h" } */ +#include "nonexistent.h" +/* { dg-message "nonexistent.h" "" { target *-*-* } 0 } */ /* { dg-message "terminated" "" { target *-*-* } 0 } */ /* This declaration should not receive any diagnostic. */ diff --git a/gcc/testsuite/gcc.dg/cpp/poison.c b/gcc/testsuite/gcc.dg/cpp/poison.c index d667183de316f443096123acaa23f5b456edccfb..f85405c0983e3b8671014ad86613dd821f843f75 100644 --- a/gcc/testsuite/gcc.dg/cpp/poison.c +++ b/gcc/testsuite/gcc.dg/cpp/poison.c @@ -1,5 +1,4 @@ -/* { dg-do preprocess } - { dg-options "-fno-show-column" } */ +/* { dg-do preprocess } */ #pragma GCC poison foo foo /* { dg-error "foo" "use of foo" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/pr29612-2.c b/gcc/testsuite/gcc.dg/cpp/pr29612-2.c index 813eb77af13af5b753188d1cf656b857bc55be30..fff10a843b44773e9285702240c623b57f33da6a 100644 --- a/gcc/testsuite/gcc.dg/cpp/pr29612-2.c +++ b/gcc/testsuite/gcc.dg/cpp/pr29612-2.c @@ -1,6 +1,6 @@ /* PR preprocessor/29612 */ /* { dg-do preprocess } */ -/* { dg-options "-Wtraditional -fno-show-column" } */ +/* { dg-options "-Wtraditional" } */ # 6 "pr29612-2.c" diff --git a/gcc/testsuite/gcc.dg/cpp/redef2.c b/gcc/testsuite/gcc.dg/cpp/redef2.c index 57fa3b1930b6d08dbe06cd9d5a4033ffdd635694..1dbc10033edfc8fc3e892e1921327cf7261f6a5f 100644 --- a/gcc/testsuite/gcc.dg/cpp/redef2.c +++ b/gcc/testsuite/gcc.dg/cpp/redef2.c @@ -1,7 +1,7 @@ /* Test for redefining macros with significant differences. */ /* { dg-do preprocess } - { dg-options "-ansi -Wall -fno-show-column" } */ + { dg-options "-ansi -Wall" } */ #define mac(a, b) (a) + (b) #define mac(a, b) (a) * (b) diff --git a/gcc/testsuite/gcc.dg/cpp/strify2.c b/gcc/testsuite/gcc.dg/cpp/strify2.c index 2c768dcd05ec8ab3df510e3bc0f2a35a4a7cfef5..c24220c70e012ec863af235f552427b5dea50440 100644 --- a/gcc/testsuite/gcc.dg/cpp/strify2.c +++ b/gcc/testsuite/gcc.dg/cpp/strify2.c @@ -1,7 +1,7 @@ /* Copyright (C) 2000 Free Software Foundation, Inc. */ /* { dg-do run } */ -/* { dg-options "-std=c99 -pedantic-errors -fno-show-column" } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ /* Tests a whole bunch of things are correctly stringified. */ diff --git a/gcc/testsuite/gcc.dg/cpp/syshdr.c b/gcc/testsuite/gcc.dg/cpp/syshdr.c index 75137739327274e8e4eb5121cf6512a3d5cd8bac..310d5d0d28826d20598920419cfebb189ac6bfc7 100644 --- a/gcc/testsuite/gcc.dg/cpp/syshdr.c +++ b/gcc/testsuite/gcc.dg/cpp/syshdr.c @@ -8,5 +8,6 @@ /* { dg-do preprocess } */ /* { dg-error "include_next" "good error" { target *-*-* } 4 } */ -#include "syshdr1.h" /* { dg-message "" "In file included from:" } */ +#include "syshdr1.h" +/* { dg-message "" "In file included from:" { target *-*-* } 0 } */ #include "syshdr2.h" diff --git a/gcc/testsuite/gcc.dg/cpp/sysmac2.c b/gcc/testsuite/gcc.dg/cpp/sysmac2.c index 0d1efabdc07368d2ce762bb20c9cceafdd1e34af..6d493a9ed1b1d1b2f605e6ba9c5e8f1d0d9e2bee 100644 --- a/gcc/testsuite/gcc.dg/cpp/sysmac2.c +++ b/gcc/testsuite/gcc.dg/cpp/sysmac2.c @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Free Software Foundation, Inc. */ /* { dg-do compile } */ -/* { dg-options "-std=gnu99 -pedantic -Wtraditional -fno-show-column" } */ +/* { dg-options "-std=gnu99 -pedantic -Wtraditional" } */ /* Tests diagnostics are suppressed for some macros defined in system headers. */ diff --git a/gcc/testsuite/gcc.dg/cpp/tr-warn1.c b/gcc/testsuite/gcc.dg/cpp/tr-warn1.c index 259f928825359615c7e5072606f349502b1a4ae7..37b5efe5df1c5da94709278b8b79f1609baab0cc 100644 --- a/gcc/testsuite/gcc.dg/cpp/tr-warn1.c +++ b/gcc/testsuite/gcc.dg/cpp/tr-warn1.c @@ -1,6 +1,6 @@ /* Test for warnings about nontraditional directives. */ /* { dg-do preprocess } */ -/* { dg-options "-pedantic -Wtraditional -fno-show-column" } */ +/* { dg-options "-pedantic -Wtraditional" } */ /* Block 1: K+R directives should have the # indented. */ diff --git a/gcc/testsuite/gcc.dg/cpp/tr-warn3.c b/gcc/testsuite/gcc.dg/cpp/tr-warn3.c index e802b4dd0f754b12636674dff488d48e398aee60..33517188cd8cf0acced4f3a8affd4c2ba61dba24 100644 --- a/gcc/testsuite/gcc.dg/cpp/tr-warn3.c +++ b/gcc/testsuite/gcc.dg/cpp/tr-warn3.c @@ -3,7 +3,7 @@ warnings inside unused clauses because they are often hidden this way on purpose. However they do still require indentation for K&R. */ /* { dg-do preprocess } */ -/* { dg-options "-pedantic -Wtraditional -fno-show-column" } */ +/* { dg-options "-pedantic -Wtraditional" } */ #if 1 diff --git a/gcc/testsuite/gcc.dg/cpp/tr-warn4.c b/gcc/testsuite/gcc.dg/cpp/tr-warn4.c index 14dd8a3163e7f28a0325f02572ba6592626df286..f5b5779bfd7f6f29a218ed93076b39c05e1db7aa 100644 --- a/gcc/testsuite/gcc.dg/cpp/tr-warn4.c +++ b/gcc/testsuite/gcc.dg/cpp/tr-warn4.c @@ -2,7 +2,7 @@ Note, gcc should omit these warnings in system header files. By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000. */ /* { dg-do preprocess } */ -/* { dg-options "-Wtraditional -fno-show-column" } */ +/* { dg-options "-Wtraditional" } */ #if 1U /* { dg-warning "traditional C rejects" "numeric constant suffix" } */ #endif diff --git a/gcc/testsuite/gcc.dg/cpp/tr-warn5.c b/gcc/testsuite/gcc.dg/cpp/tr-warn5.c index 16dcf4c0866fbd35dab5907ae2cbc8cdecb3bb9e..6867b88c219c98c98c47387f69af3ce8063f229f 100644 --- a/gcc/testsuite/gcc.dg/cpp/tr-warn5.c +++ b/gcc/testsuite/gcc.dg/cpp/tr-warn5.c @@ -2,7 +2,7 @@ Note, gcc should omit these warnings in system header files. By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000. */ /* { dg-do preprocess } */ -/* { dg-options "-Wtraditional -fno-show-column" } */ +/* { dg-options "-Wtraditional" } */ #if +1 /* { dg-warning "unary plus operator" "unary plus operator" } */ #endif diff --git a/gcc/testsuite/gcc.dg/cpp/tr-warn6.c b/gcc/testsuite/gcc.dg/cpp/tr-warn6.c index e9aa851d0419b40ab9a1504106cf469bbe6caff8..d95409ef8f9012d1f224788a2f49aab0ac6da7f2 100644 --- a/gcc/testsuite/gcc.dg/cpp/tr-warn6.c +++ b/gcc/testsuite/gcc.dg/cpp/tr-warn6.c @@ -2,7 +2,7 @@ Note, gcc should omit these warnings in system header files. By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 9/8/2000. */ /* { dg-do preprocess } */ -/* { dg-options "-Wtraditional -fno-show-column" } */ +/* { dg-options "-Wtraditional" } */ #define foo1(h) sdf "h3" fds "h" /* { dg-warning "macro argument \"h\" would be stringified" "traditional stringification" } */ #define foo2(h2) sdf "h2" fds "h3" /* { dg-warning "macro argument \"h2\" would be stringified" "traditional stringification" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/trad/trad.exp b/gcc/testsuite/gcc.dg/cpp/trad/trad.exp index 22225e51915056ba69aa16b9efd7baf4a7ffd954..190cfcfdee65f418903dfa56e6b69c5785e7f7df 100644 --- a/gcc/testsuite/gcc.dg/cpp/trad/trad.exp +++ b/gcc/testsuite/gcc.dg/cpp/trad/trad.exp @@ -37,7 +37,7 @@ dg-init # Main loop. dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ - "-fno-show-column" $DEFAULT_TRADCPPFLAGS + "" $DEFAULT_TRADCPPFLAGS # All done. dg-finish diff --git a/gcc/testsuite/gcc.dg/cpp/unc4.c b/gcc/testsuite/gcc.dg/cpp/unc4.c index 758e5bbc6d959b254cafdbcaa0cb495d3d23bde5..10c49e9d4db57cf5bba3d70ee76ec45328ad5497 100644 --- a/gcc/testsuite/gcc.dg/cpp/unc4.c +++ b/gcc/testsuite/gcc.dg/cpp/unc4.c @@ -1,5 +1,4 @@ /* { dg-do preprocess } */ -/* { dg-options "-fno-show-column" } */ /* Tests for un-terminated conditional diagnostics. Copyright (c) 1999 Free Software Foundation. diff --git a/gcc/testsuite/gcc.dg/cpp/undef2.c b/gcc/testsuite/gcc.dg/cpp/undef2.c index 4e6a690dcc9c63562d8d66286261a87f093a820c..5614e039b22b2fea9daab2b97510748cf93c3bdc 100644 --- a/gcc/testsuite/gcc.dg/cpp/undef2.c +++ b/gcc/testsuite/gcc.dg/cpp/undef2.c @@ -1,9 +1,7 @@ /* C99 6.10.8 para 4: None of [the predefined macro names] shall be - the subject of a #define or an #undef preprocessing directive. We - pass -fno-show-column as otherwise dejagnu gets confused. */ + the subject of a #define or an #undef preprocessing directive. */ /* { dg-do preprocess } */ -/* { dg-options "-fno-show-column" } */ #undef __DATE__ /* { dg-warning "undefining" "__DATE__" } */ #undef __TIME__ /* { dg-warning "undefining" "__TIME__" } */ diff --git a/gcc/testsuite/gcc.dg/pch/counter-2.c b/gcc/testsuite/gcc.dg/pch/counter-2.c index 6dd2245d7d84adc6bc0ab71cadc1e887f8aa048d..14ce24909c8fa42e3e93ac4c8da2a2fed6150e3c 100644 --- a/gcc/testsuite/gcc.dg/pch/counter-2.c +++ b/gcc/testsuite/gcc.dg/pch/counter-2.c @@ -8,7 +8,7 @@ #endif #include "counter-2.h" /* { dg-warning "not used because `__COUNTER__' is invalid" } */ -/* { dg-error "counter-2.h: No such file or directory" "no such file" { target *-*-* } 10 } */ +/* { dg-error "counter-2.h: No such file or directory" "no such file" { target *-*-* } 0 } */ /* { dg-error "one or more PCH files were found, but they were invalid" "invalid files" { target *-*-* } 10 } */ /* { dg-message "terminated" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/pch/valid-1.c b/gcc/testsuite/gcc.dg/pch/valid-1.c index 3ee909165914bc377b39c7a1e54d1f487b093638..b7f22d0dc17a12cd32a69cafc046809b7a487394 100644 --- a/gcc/testsuite/gcc.dg/pch/valid-1.c +++ b/gcc/testsuite/gcc.dg/pch/valid-1.c @@ -1,8 +1,8 @@ /* { dg-options "-I. -Winvalid-pch -g" } */ #include "valid-1.h"/* { dg-warning "created with -gnone, but used with -g" } */ -/* { dg-error "No such file" "no such file" { target *-*-* } 3 } */ -/* { dg-error "they were invalid" "invalid files" { target *-*-* } 3 } */ +/* { dg-error "No such file" "no such file" { target *-*-* } 0 } */ +/* { dg-error "they were invalid" "invalid files" { target *-*-* } 0 } */ /* { dg-message "terminated" "" { target *-*-* } 0 } */ int x; diff --git a/gcc/testsuite/gcc.dg/pch/valid-2.c b/gcc/testsuite/gcc.dg/pch/valid-2.c index 34269a87960e5521dae7339a85284d44d747f48f..3d8cb1427f3627125181b3836b6c496ade943712 100644 --- a/gcc/testsuite/gcc.dg/pch/valid-2.c +++ b/gcc/testsuite/gcc.dg/pch/valid-2.c @@ -1,7 +1,7 @@ /* { dg-options "-I. -Winvalid-pch -fexceptions" } */ #include "valid-2.h" /* { dg-warning "settings for -fexceptions do not match" } */ -/* { dg-error "No such file" "no such file" { target *-*-* } 3 } */ -/* { dg-error "they were invalid" "invalid files" { target *-*-* } 3 } */ +/* { dg-error "No such file" "no such file" { target *-*-* } 0 } */ +/* { dg-error "they were invalid" "invalid files" { target *-*-* } 0 } */ /* { dg-message "terminated" "" { target *-*-* } 0 } */ int x; diff --git a/gcc/testsuite/gcc.dg/pch/warn-1.c b/gcc/testsuite/gcc.dg/pch/warn-1.c index 64944c776d874a4a08507352d3005449e9cd577c..1d31cef0544228a92112a2891872199926aad7b6 100644 --- a/gcc/testsuite/gcc.dg/pch/warn-1.c +++ b/gcc/testsuite/gcc.dg/pch/warn-1.c @@ -3,8 +3,8 @@ #define DEFINED_VALUE 3 #include "warn-1.h"/* { dg-warning "not used because .DEFINED_VALUE. is defined" } */ -/* { dg-error "No such file" "no such file" { target *-*-* } 5 } */ -/* { dg-error "they were invalid" "invalid files" { target *-*-* } 5 } */ +/* { dg-error "No such file" "no such file" { target *-*-* } 0 } */ +/* { dg-error "they were invalid" "invalid files" { target *-*-* } 0 } */ /* { dg-message "terminated" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/va-arg-2.c b/gcc/testsuite/gcc.dg/va-arg-2.c index 2fd0ed97e3f5715598b251f0697971a804affaa8..e1c915ffc925ab81de8570f54d546b07efb09dbf 100644 --- a/gcc/testsuite/gcc.dg/va-arg-2.c +++ b/gcc/testsuite/gcc.dg/va-arg-2.c @@ -5,7 +5,7 @@ #include <varargs.h> /* { dg-bogus "varargs.h" "missing file" } */ -/* { dg-message "" "In file included from" { target *-*-* } 6 } */ +/* { dg-message "file included from" "file included from" { target *-*-* } 0 } */ /* { dg-error "no longer implements" "#error 1" { target *-*-* } 4 } */ /* { dg-error "Revise your code" "#error 2" { target *-*-* } 5 } */ diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 7d00acf6d1a8144bd8d382ef7da12c6357fb5de8..e906265e40cc883bcf5274d1d5d9b031a36168fa 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -620,6 +620,17 @@ if { [info procs saved-dg-error] == [list] \ process-message saved-dg-error "$gcc_error_prefix" "$args" } + + # Override dg-bogus at the same time. It doesn't handle a prefix + # but its expression should include a column number. Otherwise the + # line number can match the column number for other messages, leading + # to insanity. + rename dg-bogus saved-dg-bogus + + proc dg-bogus { args } { + upvar dg-messages dg-messages + process-message saved-dg-bogus "" $args + } } # Modify the regular expression saved by a DejaGnu message directive to @@ -641,20 +652,26 @@ proc process-message { msgproc msgprefix dgargs } { return; } - # Prepend the message prefix to the regular expression and make - # it match a single line. + # Get the entry for the new message. Prepend the message prefix to + # the regular expression and make it match a single line. set newentry [lindex ${dg-messages} end] set expmsg [lindex $newentry 2] - # If we have a column... + # Handle column numbers from the specified expression (if there is + # one) and set up the search expression that will be used by DejaGnu. if [regexp "^(\[0-9\]+):" $expmsg "" column] { - # Remove "COLUMN:" + # The expression in the directive included a column number. + # Remove "COLUMN:" from the original expression and move it + # to the proper place in the search expression. regsub "^\[0-9\]+:" $expmsg "" expmsg - - # Include the column in the search expression. - set expmsg "$column: $msgprefix\[^\n]*$expmsg" + set expmsg "$column: $msgprefix\[^\n\]*$expmsg" + } elseif [string match "" [lindex $newentry 0]] { + # The specified line number is 0; don't expect a column number. + set expmsg "$msgprefix\[^\n\]*$expmsg" } else { - set expmsg "$msgprefix\[^\n]*$expmsg" + # There is no column number in the search expression, but we + # should expect one in the message itself. + set expmsg "\[0-9\]+: $msgprefix\[^\n\]*$expmsg" } set newentry [lreplace $newentry 2 2 $expmsg] diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index f8645283e0f7d5ad237f022321a6d94891f3da4a..7023582784a975edffbac34ee90bcab3c8cc06bb 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2009-06-01 Aldy Hernandez <aldyh@redhat.com> + + * include/line-map.h (LAST_SOURCE_COLUMN): New. + 2009-06-01 Ian Lance Taylor <iant@google.com> * include/cpp-id-data.h: Add extern "C". diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 962525f156b651b3969abf531d206f674c6ecc20..09e72f14d4b8454a98127aa5a291497861755fb1 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -158,6 +158,8 @@ extern const struct line_map *linemap_lookup of the #include, or other directive, that caused a map change. */ #define LAST_SOURCE_LINE(MAP) \ SOURCE_LINE (MAP, LAST_SOURCE_LINE_LOCATION (MAP)) +#define LAST_SOURCE_COLUMN(MAP) \ + SOURCE_COLUMN (MAP, LAST_SOURCE_LINE_LOCATION (MAP)) #define LAST_SOURCE_LINE_LOCATION(MAP) \ ((((MAP)[1].start_location - 1 - (MAP)->start_location) \ & ~((1 << (MAP)->column_bits) - 1)) \