There are some inconsistencies in the middle-end about how to dump a
location. The following patch makes all places (that I found) use
dump_location, and makes that function print also the column number.
While searching for possible callers, I noticed two cases where we use
expanded_location for no good reason.
Bootstrapped and regression tested on x86_64-linux-gnu.
OK?
gcc/ChangeLog:
2014-10-03 Manuel López-Ibáñez m...@gcc.gnu.org
* tree-pretty-print.c (dump_location): Make it extern. Dump also
the column.
* tree-pretty-print.h (dump_location): Declare.
* gimple-pretty-print.c (dump_gimple_phi): Use dump_location.
(pp_gimple_stmt_1): Likewise.
(dump_implicit_edges): Likewise.
* gimplify.c (gimplify_call_expr): Use LOCATION_FILE and
LOCATION_LINE.
gcc/testsuite/ChangeLog:
2014-10-03 Manuel López-Ibáñez m...@gcc.gnu.org
* gcc.dg/tm/debug-1.c: Update regex.
* c-c++-common/raw-string-18.c: Update regex.
* c-c++-common/raw-string-19.c: Update regex.
Index: gcc/tree-pretty-print.c
===
--- gcc/tree-pretty-print.c (revision 215841)
+++ gcc/tree-pretty-print.c (working copy)
@@ -675,22 +675,24 @@ dump_omp_clauses (pretty_printer *buffer
}
/* Dump location LOC to BUFFER. */
-static void
+void
dump_location (pretty_printer *buffer, location_t loc)
{
expanded_location xloc = expand_location (loc);
pp_left_bracket (buffer);
if (xloc.file)
{
pp_string (buffer, xloc.file);
- pp_string (buffer, : );
+ pp_string (buffer, :);
}
pp_decimal_int (buffer, xloc.line);
+ pp_colon (buffer);
+ pp_decimal_int (buffer, xloc.column);
pp_string (buffer, ] );
}
/* Dump lexical block BLOCK. BUFFER, SPC and FLAGS are as in
Index: gcc/tree-pretty-print.h
===
--- gcc/tree-pretty-print.h (revision 215841)
+++ gcc/tree-pretty-print.h (working copy)
@@ -48,7 +48,8 @@ extern const char *op_symbol_code (enum
extern void print_call_name (pretty_printer *, tree, int);
extern void percent_K_format (text_info *);
extern void pp_tree_identifier (pretty_printer *, tree);
extern void dump_function_header (FILE *, tree, int);
extern void pp_double_int (pretty_printer *pp, double_int d, bool uns);
+extern void dump_location (pretty_printer *buffer, location_t loc);
#endif /* ! GCC_TREE_PRETTY_PRINT_H */
Index: gcc/testsuite/gcc.dg/tm/debug-1.c
===
--- gcc/testsuite/gcc.dg/tm/debug-1.c (revision 215841)
+++ gcc/testsuite/gcc.dg/tm/debug-1.c (working copy)
@@ -17,10 +17,10 @@ int main() {
testing();
}
return 0;
}
-/* { dg-final { scan-tree-dump-times : 13:.*b = 9898 1 tmmark } } */
-/* { dg-final { scan-tree-dump-times : 14:.*_ITM_beginTransaction 1 tmmark
} } */
-/* { dg-final { scan-tree-dump-times : 15:.*ITM_WU. \\(z 1 tmmark } } */
-/* { dg-final { scan-tree-dump-times : 16:.*ITM_WU. \\(a 1 tmmark } } */
+/* { dg-final { scan-tree-dump-times :13:.*b = 9898 1 tmmark } } */
+/* { dg-final { scan-tree-dump-times :14:.*_ITM_beginTransaction 1 tmmark
} } */
+/* { dg-final { scan-tree-dump-times :15:.*ITM_WU. \\(z 1 tmmark } } */
+/* { dg-final { scan-tree-dump-times :16:.*ITM_WU. \\(a 1 tmmark } } */
/* { dg-final { cleanup-tree-dump tmmark } } */
Index: gcc/testsuite/c-c++-common/raw-string-18.c
===
--- gcc/testsuite/c-c++-common/raw-string-18.c (revision 215841)
+++ gcc/testsuite/c-c++-common/raw-string-18.c (working copy)
@@ -15,7 +15,7 @@ main ()
extern void foo (); foo ();
return 0;
}
/* Verify call to foo is on line 15. */
-/* { dg-final { scan-tree-dump : 15\[]:]\[^\n\r]*foo optimized } } */
+/* { dg-final { scan-tree-dump c:15:\[^\n\r\]*foo optimized } } */
/* { dg-final { cleanup-tree-dump optimized } } */
Index: gcc/testsuite/c-c++-common/raw-string-19.c
===
--- gcc/testsuite/c-c++-common/raw-string-19.c (revision 215841)
+++ gcc/testsuite/c-c++-common/raw-string-19.c (working copy)
@@ -15,8 +15,8 @@ main ()
extern void foo (); foo ();
return 0;
}
/* Verify call to foo is on line 15. */
-/* { dg-final { scan-tree-dump : 15\[]:]\[^\n\r]*foo optimized } } */
+/* { dg-final { scan-tree-dump c:15:\[^\n\r\]*foo optimized } } */
/* { dg-final { cleanup-tree-dump optimized } } */
/* { dg-final { cleanup-saved-temps } } */
Index: gcc/gimple-pretty-print.c
===
--- gcc/gimple-pretty-print.c (revision 215841)
+++ gcc/gimple-pretty-print.c (working copy)
@@ -1832,25 +1832,11 @@ dump_gimple_phi (pretty_printer *buffer,
pp_string (buffer, = PHI );
}
for (i = 0; i gimple_phi_num_args (phi); i++)
{
if ((flags TDF_LINENO)