Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yuhao Liu
ogs
Commits
f1fea438
Commit
f1fea438
authored
8 years ago
by
Norihiro Watanabe
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1432 from norihiro-w/fatal-abort
Abort in OGS_FATAL()
parents
08195711
d3cdf22c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
BaseLib/Error.h
+17
-1
17 additions, 1 deletion
BaseLib/Error.h
CMakeLists.txt
+7
-0
7 additions, 0 deletions
CMakeLists.txt
with
24 additions
and
1 deletion
BaseLib/Error.h
+
17
−
1
View file @
f1fea438
...
...
@@ -10,15 +10,31 @@
#ifndef BASELIB_ERROR_H
#define BASELIB_ERROR_H
#i
nclude
<stdexcept>
#i
fdef OGS_FATAL_ABORT
#include
<cstdlib>
#include
<logog/include/logog.hpp>
#include
"StringTools.h"
#define OGS_FATAL(fmt, ...)\
{\
ERR("%s", BaseLib::format(fmt, ##__VA_ARGS__).data());\
std::abort();\
}
#else // OGS_FATAL_ABORT
#include
<stdexcept>
#include
"FileTools.h"
#include
"StringTools.h"
#define OGS_STR(x) #x
#define OGS_STRINGIFY(x) OGS_STR(x)
#define OGS_LOCATION " at " + BaseLib::extractBaseName(__FILE__) + ", line " OGS_STRINGIFY(__LINE__)
#define OGS_FATAL(fmt, ...)\
throw std::runtime_error(BaseLib::format(fmt, ##__VA_ARGS__) + OGS_LOCATION);
#endif // OGS_FATAL_ABORT
#endif //BASELIB_ERROR_H
This diff is collapsed.
Click to expand it.
CMakeLists.txt
+
7
−
0
View file @
f1fea438
...
...
@@ -87,6 +87,9 @@ option(EIGEN_NO_DEBUG "Disables Eigen's assertions" OFF)
# Logging
option
(
OGS_DISABLE_LOGGING
"Disables all logog messages."
OFF
)
# Debug
option
(
OGS_FATAL_ABORT
"Abort in OGS_FATAL"
OFF
)
# Compiler flags
set
(
OGS_CXX_FLAGS
""
CACHE STRING
"Additional C++ compiler flags."
)
option
(
STL_NO_DEBUG
"Disable STL debug in debug build"
OFF
)
...
...
@@ -154,6 +157,10 @@ if(OGS_USE_EIGEN)
add_definitions
(
-DOGS_USE_EIGEN
)
endif
()
if
(
OGS_FATAL_ABORT
)
add_definitions
(
-DOGS_FATAL_ABORT
)
endif
()
if
(
OGS_BUILD_TESTS
)
set
(
Data_SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/Tests/Data CACHE INTERNAL
""
)
set
(
Data_BINARY_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
/Tests/Data CACHE INTERNAL
""
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment