Browse Source

Fix logging on GCC, release variant added

cl-refactor
Paweł Bylica 10 years ago
parent
commit
29ba066971
  1. 16
      evmjit/libevmjit/Utils.cpp
  2. 21
      evmjit/libevmjit/Utils.h

16
evmjit/libevmjit/Utils.cpp

@ -1,13 +1,21 @@
#include "Utils.h"
#include <llvm/Support/Debug.h>
#if !defined(NDEBUG) // Debug
namespace dev
{
namespace eth
namespace evmjit
{
namespace jit
{
std::ostream& getLogStream(char const* _channel)
{
static std::ostream nullStream{nullptr};
return (llvm::DebugFlag && llvm::isCurrentDebugType(_channel)) ? std::cerr : nullStream;
}
}
}
#endif

21
evmjit/libevmjit/Utils.h

@ -2,10 +2,23 @@
#include <iostream>
#include <llvm/Support/Debug.h>
// The same as assert, but expression is always evaluated and result returned
#define CHECK(expr) (assert(expr), expr)
// FIXME: Disable for NDEBUG mode
#define DLOG(CHANNEL) !(llvm::DebugFlag && llvm::isCurrentDebugType(#CHANNEL)) ? (void)0 : std::cerr
#if !defined(NDEBUG) // Debug
namespace dev
{
namespace evmjit
{
std::ostream& getLogStream(char const* _channel);
}
}
#define DLOG(CHANNEL) ::dev::evmjit::getLogStream(#CHANNEL)
#else // Release
#define DLOG(CHANNEL) true ? std::cerr : std::cerr
#endif

Loading…
Cancel
Save