Skip to content
Snippets Groups Projects
Commit 299b8cc3 authored by Norihiro Watanabe's avatar Norihiro Watanabe
Browse files

abort() in OGS_FATAL if OGS_FATAL_ABORT is defined

parent 0cfb3d81
No related branches found
No related tags found
No related merge requests found
...@@ -10,15 +10,30 @@ ...@@ -10,15 +10,30 @@
#ifndef BASELIB_ERROR_H #ifndef BASELIB_ERROR_H
#define BASELIB_ERROR_H #define BASELIB_ERROR_H
#ifdef OGS_FATAL_ABORT
#include <cstdlib>
#endif
#include <stdexcept> #include <stdexcept>
#ifdef OGS_FATAL_ABORT
#include <logog/include/logog.hpp>
#endif
#include "StringTools.h" #include "StringTools.h"
#include "FileTools.h" #include "FileTools.h"
#define OGS_STR(x) #x #define OGS_STR(x) #x
#define OGS_STRINGIFY(x) OGS_STR(x) #define OGS_STRINGIFY(x) OGS_STR(x)
#define OGS_LOCATION " at " + BaseLib::extractBaseName(__FILE__) + ", line " OGS_STRINGIFY(__LINE__) #define OGS_LOCATION " at " + BaseLib::extractBaseName(__FILE__) + ", line " OGS_STRINGIFY(__LINE__)
#ifdef OGS_FATAL_ABORT
#define OGS_FATAL(fmt, ...)\
{\
ERR("%s", BaseLib::format(fmt, ##__VA_ARGS__).data());\
std::abort();\
}
#else
#define OGS_FATAL(fmt, ...)\ #define OGS_FATAL(fmt, ...)\
throw std::runtime_error(BaseLib::format(fmt, ##__VA_ARGS__) + OGS_LOCATION); throw std::runtime_error(BaseLib::format(fmt, ##__VA_ARGS__) + OGS_LOCATION);
#endif
#endif //BASELIB_ERROR_H #endif //BASELIB_ERROR_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment