diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-01-20 17:18:09 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-01-20 17:18:09 +0200 |
commit | b0524a0b18eec9d5e5c3f6ce30b6cecdd02a6306 (patch) | |
tree | 4b1efc586782507e0647e884d6a13c6605298508 /build/trace | |
parent | 47751abc43dab40e0ac4a1523994fd533e6a3b22 (diff) |
Diagnostic infrastructure revamp
Diffstat (limited to 'build/trace')
-rw-r--r-- | build/trace | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/build/trace b/build/trace deleted file mode 100644 index 1764a69..0000000 --- a/build/trace +++ /dev/null @@ -1,80 +0,0 @@ -// file : build/trace -*- C++ -*- -// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC -// license : MIT; see accompanying LICENSE file - -#ifndef BUILD_TRACE -#define BUILD_TRACE - -#include <cstdint> -#include <iostream> - -namespace build -{ - // 1 - command lines to update explicit targets (e.g., .o) - // 2 - command lines to update implicit targets (e.g., .d) - // 3 - things didn't work out (e.g., rule did not match) - // 4 - additional information - // 5 - more additional information - // - extern std::uint8_t verb; - - struct tracer - { - explicit - tracer (const char* name): name_ (name) {} - - struct record - { - ~record () {if (!empty_) std::cerr << std::endl;} - - template <typename T> - std::ostream& - operator<< (const T& x) const - { - return std::cerr << x; - } - - explicit record (tracer& t): empty_ (false) {t.begin ();} - explicit record (bool e = true): empty_ (e) {} - - // Movable-only type. - // - record (record&& r) {empty_ = r.empty_; r.empty_ = true;} - record& operator= (record&& r) {empty_ = r.empty_; r.empty_ = true;} - - record (const record&) = delete; - record& operator= (const record&) = delete; - - private: - mutable bool empty_; - }; - - template <typename T> - record - operator<< (const T& x) const - { - begin (); - std::cerr << x; - return record (false); - } - - void - begin () const - { - std::cerr << "trace: " << name_ << ": "; - } - - private: - const char* name_; - }; - - template <typename F> - inline void - trace (std::uint8_t level, const F& f) - { - if (verb >= level) - f (); - } -} - -#endif // BUILD_TRACE |