Skip to content

Commit 1a59e0c

Browse files
committed
Update compile definitions settings
1 parent 1703821 commit 1a59e0c

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "panic",
33
"repo": "daddinuz/panic",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"license": "MIT",
66
"description": "A panic library to abort execution on non-recoverable errors with a detailed message.",
77
"keywords": [

sources/build.cmake

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ option(PANIC_UNWIND_SUPPORT "Stack unwinding support" OFF)
2828
# LIBUNWIND_INCLUDE_DIRS - The libunwind include directories
2929
# LIBUNWIND_LIBRARIES - The libraries needed to use libunwind
3030
# LIBUNWIND_VERSION - The version string for libunwind
31+
3132
include(FindPackageHandleStandardArgs)
3233

3334
if (NOT DEFINED LIBUNWIND_FOUND)
@@ -75,9 +76,11 @@ endif ()
7576

7677
if (PANIC_UNWIND_SUPPORT)
7778
if (LIBUNWIND_FOUND)
79+
target_compile_definitions(${ARCHIVE_NAME} PUBLIC PANIC_UNWIND_SUPPORT=1)
7880
target_link_libraries(${ARCHIVE_NAME} PRIVATE unwind)
79-
add_definitions(-DPANIC_UNWIND_SUPPORT=1)
8081
else ()
8182
message(FATAL_ERROR "libunwind required for PANIC_UNWIND_SUPPORT feature but not found")
82-
endif ()
83+
endif (LIBUNWIND_FOUND)
84+
else ()
85+
target_compile_definitions(${ARCHIVE_NAME} PUBLIC PANIC_UNWIND_SUPPORT=0)
8386
endif (PANIC_UNWIND_SUPPORT)

sources/panic.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,7 @@ void doTerminate(const char *file, int line, const char *format, va_list args) {
120120
abort();
121121
}
122122

123-
#if !defined(PANIC_UNWIND_SUPPORT) && PANIC_UNWIND_SUPPORT == 0
124-
125-
void backtrace(FILE *const stream) {
126-
assert(NULL != stream);
127-
(void) stream;
128-
}
129-
130-
#else
123+
#if PANIC_UNWIND_SUPPORT
131124

132125
#define UNW_LOCAL_ONLY
133126

@@ -187,4 +180,11 @@ void backtrace(FILE *const stream) {
187180
errno = previousError; // restore errno
188181
}
189182

183+
#else
184+
185+
void backtrace(FILE *const stream) {
186+
assert(NULL != stream);
187+
(void) stream;
188+
}
189+
190190
#endif

sources/panic.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ extern "C" {
4040

4141
#define PANIC_VERSION_MAJOR 1
4242
#define PANIC_VERSION_MINOR 0
43-
#define PANIC_VERSION_PATCH 0
43+
#define PANIC_VERSION_PATCH 1
4444
#define PANIC_VERSION_SUFFIX ""
4545
#define PANIC_VERSION_IS_RELEASE 0
46-
#define PANIC_VERSION_HEX 0x010000
46+
#define PANIC_VERSION_HEX 0x010001
4747

4848
/**
4949
* Type signature of the callback to be executed before terminating.

0 commit comments

Comments
 (0)