From e803eb0106aec6a4ae21f7252b5e10bf7310f3d0 Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Tue, 21 Mar 2006 15:31:42 +0000 Subject: [PATCH] Fixed the macro tracing information to contain the column numbers of the macro definitions as well (the format used is the same as for error messages).. [SVN r33420] --- doc/tracing_facility.html | 14 +++++++------- include/boost/wave/util/file_position.hpp | 2 +- tool/cpp.cpp | 11 +++-------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/doc/tracing_facility.html b/doc/tracing_facility.html index 29c939c..fcff5a2 100644 --- a/doc/tracing_facility.html +++ b/doc/tracing_facility.html @@ -60,15 +60,15 @@

When preprocessed with 'wave -t test.trace test.cpp' the Wave driver generates a file test.trace, which contains (without the line numbers in front of the lines):

-
  1: test.cpp(8): CONCAT(X(1), Y())
-  2:   test.cpp(5): see macro definition: CONCAT(x, y)
+
  1: test.cpp:8:1: CONCAT(X(1), Y())
+  2:   test.cpp:5:9: see macro definition: CONCAT(x, y)
   3:   invoked with
   4:   [
   5:     x = X(1)
   6:     y = Y()
   7:   ]
   8:   [
-  9:     test.cpp(2): see macro definition: X(x)
+  9:     test.cpp:2:9: see macro definition: X(x)
  10:     invoked with
  11:     [
  12:       x = 1
@@ -80,7 +80,7 @@
  18:         1
  19:       ]
  20:     ]
- 21:     test.cpp(3): see macro definition: Y()
+ 21:     test.cpp:3:9: see macro definition: Y()
  22:     [
  23:       2
  24:       rescanning
@@ -91,7 +91,7 @@
  29:     CONCAT_(1, 2)
  30:     rescanning
  31:     [
- 32:       test.cpp(4): see macro definition: CONCAT_(x, y)
+ 32:       test.cpp:4:9: see macro definition: CONCAT_(x, y)
  33:       invoked with
  34:       [
  35:         x = 1
@@ -113,7 +113,7 @@
   contains the reference to the position, from where the macro expansion was initiated. 
   Additionally the following information is contained for every single macro expansion:

    -
  • The reference to the position, where the macro to expand was defined first +
  • The reference to the position (line and column numbers), where the macro to expand was defined first (see lines 2, 9, 21 and 32).
  • The real parameters supplied for this macro expansion (see lines 3, 10 and 33), this information is traced inside the invoked with block, where @@ -153,7 +153,7 @@
    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    diff --git a/include/boost/wave/util/file_position.hpp b/include/boost/wave/util/file_position.hpp index 430c981..a2439ff 100644 --- a/include/boost/wave/util/file_position.hpp +++ b/include/boost/wave/util/file_position.hpp @@ -131,7 +131,7 @@ template inline std::ostream & operator<< (std::ostream &o, file_position const &pos) { - o << pos.get_file() << "(" << pos.get_line() << ")"; + o << pos.get_file() << ":" << pos.get_line() << ":" << pos.get_column(); return o; } diff --git a/tool/cpp.cpp b/tool/cpp.cpp index 0243f21..b6d1d73 100644 --- a/tool/cpp.cpp +++ b/tool/cpp.cpp @@ -367,8 +367,7 @@ namespace { typename Context::position_type pos; if (get_macro_position(ctx, e.get_related_name(), pos)) { cerr - << pos.get_file() << ":" << pos.get_line() << ":" - << pos.get_column() << ": " + << pos << ": " << preprocess_exception::severity_text(e.get_severity()) << ": this is the location of the previous definition." << endl; @@ -899,9 +898,7 @@ auto_stop_watch elapsed_time(cerr); catch (std::exception const &e) { // use last recognized token to retrieve the error position cerr - << current_position.get_file() - << ":" << current_position.get_line() - << ":" << current_position.get_column() << ": " + << current_position << ": " << "exception caught: " << e.what() << endl; return 3; @@ -909,9 +906,7 @@ auto_stop_watch elapsed_time(cerr); catch (...) { // use last recognized token to retrieve the error position cerr - << current_position.get_file() - << ":" << current_position.get_line() - << ":" << current_position.get_column() << ": " + << current_position << ": " << "unexpected exception caught." << endl; return 4; }