Skip to content

Commit

Permalink
add ifdef guards
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate committed Aug 2, 2021
1 parent 77d1be8 commit 3ce44b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions zeno/utils/Exception.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <zeno/utils/Exception.h>
#include <zeno/utils/zlog.h>

namespace zeno {

Expand All @@ -7,6 +8,7 @@ void trigger_gdb();

ZENO_API Exception::Exception(std::string const &msg) noexcept
: msg(msg) {
zlog::error("exception occurred: {}", msg);
print_traceback();
trigger_gdb();
}
Expand Down
2 changes: 2 additions & 0 deletions zeno/utils/SignalHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#ifdef __linux__
#include <unistd.h>
#endif

namespace zeno {

Expand Down
7 changes: 7 additions & 0 deletions zeno/utils/StackTraceback.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef ZENO_FAULTHANDLER
// https://github.com/taichi-dev/taichi/blob/eb769ebfc0cb6b48649a3aed8ccd293cbd4eb5ed/taichi/system/traceback.cpp
/*******************************************************************************
Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
Expand Down Expand Up @@ -366,3 +367,9 @@ void print_traceback() {
fmt::print(fg(fmt::color::orange), "\nInternal error occurred.\n");
}
}
#else
namespace zeno {
void print_traceback() {
}
}
#endif

0 comments on commit 3ce44b9

Please sign in to comment.