Files
rocm-systems/rocclr/runtime/utils/debug.hpp
T
foreman 7f24b9ffbb P4 to Git Change 1184767 by lmoriche@lmoriche_opencl_dev on 2015/08/26 13:54:18
ECR #304775 - Remove the complib oclutils

Affected files ...

... //depot/stg/opencl/drivers/opencl/Makefile#52 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/Makefile#36 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/build/Makefile.complib#92 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/complibdefs#43 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/Makefile#2 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/build/Makefile#2 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/build/Makefile.oclutils#3 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/os/alloc.cpp#3 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/os/alloc.hpp#2 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/os/os.cpp#6 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/os/os.hpp#7 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/os/os_posix.cpp#11 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/os/os_win32.cpp#6 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/os/setjmp.S#2 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/os/setjmp.asm#2 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/thread/atomic.hpp#5 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/thread/monitor.cpp#3 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/thread/monitor.hpp#3 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/thread/semaphore.cpp#3 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/thread/semaphore.hpp#4 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/thread/thread.cpp#4 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/thread/thread.hpp#4 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/top.hpp#6 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/utils/debug.cpp#2 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/utils/debug.hpp#3 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/utils/macros.hpp#4 delete
... //depot/stg/opencl/drivers/opencl/compiler/lib/promotions/oclutils/utils/util.hpp#3 delete
... //depot/stg/opencl/drivers/opencl/runtime/Makefile#19 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/debug.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/debug.hpp#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#238 edit
2015-08-26 14:07:03 -04:00

168 lines
4.9 KiB
C++

//
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
//
#ifndef DEBUG_HPP_
#define DEBUG_HPP_
#include <cassert>
//! \addtogroup Utils
namespace amd {/*@{*/
enum LogLevel {
LOG_NONE = 0,
LOG_ERROR = 1,
LOG_WARNING = 2,
LOG_INFO = 3,
LOG_DEBUG = 4
};
//! \cond ignore
extern "C" void
breakpoint();
//! \endcond
//! \brief Report a Fatal exception message and abort.
extern void
report_fatal(const char* file, int line, const char* message);
//! \brief Display a warning message.
extern void
report_warning(const char* message);
//! \brief Insert a log entry.
extern void
log_entry(LogLevel level, const char* file, int line, const char* messsage);
//! \brief Insert a timestamped log entry.
extern void
log_timestamped(LogLevel level, const char* file, int line, const char* messsage);
//! \brief Insert a printf-style log entry.
extern void
log_printf(
LogLevel level,
const char* file,
int line,
const char* format,
...);
/*@}*/} // namespace amd
#if __INTEL_COMPILER
// Disable ICC's warning #279: controlling expression is constant
// (0!=1 && "msg")
// ^
#pragma warning ( disable : 279 )
#endif // __INTEL_COMPILER
//! \brief Abort the program if the invariant \a cond is false.
#define guarantee(cond) \
if (!(cond)) \
{ \
amd::report_fatal(__FILE__, __LINE__, \
"guarantee(" XSTR(cond) ")"); \
amd::breakpoint(); \
}
#define fixme_guarantee(cond) guarantee(cond)
//! \brief Abort the program with a fatal error message.
#define fatal(msg) do { assert(false && msg); } while (0)
//! \brief Display a warning message.
inline void
warning(const char* msg)
{
amd::report_warning(msg);
}
/*! \brief Abort the program with a "ShouldNotReachHere" message.
* \hideinitializer
*/
#define ShouldNotReachHere() fatal("ShouldNotReachHere()")
/*! \brief Abort the program with a "ShouldNotCallThis" message.
* \hideinitializer
*/
#define ShouldNotCallThis() fatal("ShouldNotCallThis()")
/*! \brief Abort the program with an "Unimplemented" message.
* \hideinitializer
*/
#define Unimplemented() fatal("Unimplemented()")
/*! \brief Display an "Untested" warning message.
* \hideinitializer
*/
#ifndef NDEBUG
# define Untested(msg) \
warning("Untested(\"" msg "\")")
#else /*NDEBUG*/
# define Untested(msg) (void)(0)
#endif /*NDEBUG*/
#ifdef DEBUG
# define Log(level,msg) \
do \
{ \
if (LOG_LEVEL >= level) { \
amd::log_entry(level, __FILE__, __LINE__, msg); \
} \
} while (false)
#else // !DEBUG
# define Log(level,msg) (void)(0)
#endif // !DEBUG
#ifdef DEBUG
# define LogTS(level,msg) \
do \
{ \
if (LOG_LEVEL >= level) { \
amd::log_timestamped(level, __FILE__, __LINE__, msg); \
} \
} while (false)
#else // !DEBUG
# define Log(level,msg) (void)(0)
#endif // !DEBUG
#ifdef DEBUG
# define Logf(level, format, ...) \
do \
{ \
if (LOG_LEVEL >= level) { \
amd::log_printf(level, __FILE__, __LINE__, format, __VA_ARGS__); \
} \
} while (false)
#else // !DEBUG
# define Logf(level, format, ...) (void)(0)
#endif // !DEBUG
#define CondLog(cond,msg) \
do { \
if (false DEBUG_ONLY(|| (cond))) { \
Log(amd::LOG_INFO,msg); \
} \
} while (false)
#define LogInfo(msg) Log(amd::LOG_INFO,msg)
#define LogError(msg) Log(amd::LOG_ERROR,msg)
#define LogWarning(msg) Log(amd::LOG_WARNING,msg)
#define LogTSInfo(msg) LogTS(amd::LOG_INFO,msg)
#define LogTSError(msg) LogTS(amd::LOG_ERROR,msg)
#define LogTSWarning(msg) LogTS(amd::LOG_WARNING,msg)
#define LogPrintfDebug(format, ...) Logf(amd::LOG_DEBUG, format, __VA_ARGS__)
#define LogPrintfError(format, ...) Logf(amd::LOG_ERROR, format, __VA_ARGS__)
#define LogPrintfWarning(format, ...) Logf(amd::LOG_WARNING, format, __VA_ARGS__)
#define LogPrintfInfo(format, ...) Logf(amd::LOG_INFO, format, __VA_ARGS__)
#endif /*DEBUG_HPP_*/