aboutsummaryrefslogtreecommitdiff
path: root/build/diagnostics
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-02-19 16:10:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-02-19 16:10:03 +0200
commit8bd89cfca333e58f6990d7d168649dfc79878f31 (patch)
tree730bb9eec4fc5ddd086ed8465c4d7c0030db0d6b /build/diagnostics
parentb0524a0b18eec9d5e5c3f6ce30b6cecdd02a6306 (diff)
Add support for sourcing/including buildfiles, print, dir{} alias
Diffstat (limited to 'build/diagnostics')
-rw-r--r--build/diagnostics23
1 files changed, 17 insertions, 6 deletions
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_base> 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_base> 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_base> trace_mark;
@@ -290,6 +294,9 @@ namespace build
template <typename E>
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 <typename E>