From 8bd89cfca333e58f6990d7d168649dfc79878f31 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 19 Feb 2015 16:10:03 +0200 Subject: Add support for sourcing/including buildfiles, print, dir{} alias --- build/diagnostics | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'build/diagnostics') diff --git a/build/diagnostics b/build/diagnostics index f85d118..7e56fa3 100644 --- a/build/diagnostics +++ b/build/diagnostics @@ -238,15 +238,17 @@ namespace build private: const char* type_; const char* name_; - const location& loc_; + const location loc_; }; typedef diag_prologue location_prologue; struct basic_mark_base { explicit - basic_mark_base (const char* type, const char* name = nullptr) - : type_ (type), name_ (name) {} + basic_mark_base (const char* type, + const char* name = nullptr, + const void* data = nullptr) + : type_ (type), name_ (name), data_ (data) {} simple_prologue operator() () const @@ -264,12 +266,13 @@ namespace build location_prologue operator() (const L& l) const { - return location_prologue (type_, name_, get_location (l)); + return location_prologue (type_, name_, get_location (l, data_)); } private: const char* type_; const char* name_; + const void* data_; }; typedef diag_mark basic_mark; @@ -281,7 +284,8 @@ namespace build struct trace_mark_base: basic_mark_base { explicit - trace_mark_base (const char* name): basic_mark_base ("trace", name) {} + trace_mark_base (const char* name, const void* data = nullptr) + : basic_mark_base ("trace", name, data) {} }; typedef diag_mark trace_mark; @@ -290,6 +294,9 @@ namespace build template struct fail_mark_base { + explicit + fail_mark_base (const void* data = nullptr): data_ (data) {} + simple_prologue operator() () const { @@ -306,11 +313,15 @@ namespace build location_prologue operator() (const L& l) const { - return location_prologue (&epilogue, "error", nullptr, get_location (l)); + return location_prologue ( + &epilogue, "error", nullptr, get_location (l, data_)); } static void epilogue (const diag_record&) {throw E ();} + + private: + const void* data_; }; template -- cgit v1.1