1 //===----------------------------- config.h -------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
9 // Defines macros used within libuwind project.
11 //===----------------------------------------------------------------------===//
14 #ifndef LIBUNWIND_CONFIG_H
15 #define LIBUNWIND_CONFIG_H
19 // Define static_assert() unless already defined by compiler.
21 #define __has_feature(__x) 0
23 #if !(__has_feature(cxx_static_assert))
24 #define static_assert(__b, __m) \
25 extern int compile_time_assert_failed[ ( __b ) ? 1 : -1 ] \
26 __attribute__( ( unused ) );
29 // Platform specific configuration defines.
31 #include <Availability.h>
35 void __assert_rtn(const char *, const char *, int, const char *)
36 __attribute__((noreturn));
41 #define _LIBUNWIND_BUILD_ZERO_COST_APIS (__i386__ || __x86_64__ || __arm64__)
42 #define _LIBUNWIND_BUILD_SJLJ_APIS (__arm__)
43 #define _LIBUNWIND_SUPPORT_FRAME_APIS (__i386__ || __x86_64__)
44 #define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
45 #define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
46 #define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__)
47 #define _LIBUNWIND_ABORT(msg) __assert_rtn(__func__, __FILE__, __LINE__, msg)
50 #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
51 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 0
52 #define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
54 #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
55 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
56 #define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
60 // #define _LIBUNWIND_BUILD_ZERO_COST_APIS
61 // #define _LIBUNWIND_BUILD_SJLJ_APIS
62 // #define _LIBUNWIND_SUPPORT_FRAME_APIS
63 // #define _LIBUNWIND_EXPORT
64 // #define _LIBUNWIND_HIDDEN
65 // #define _LIBUNWIND_LOG()
66 // #define _LIBUNWIND_ABORT()
67 // #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND
68 // #define _LIBUNWIND_SUPPORT_DWARF_UNWIND
69 // #define _LIBUNWIND_SUPPORT_DWARF_INDEX
73 // Macros that define away in non-Debug builds
75 #define _LIBUNWIND_DEBUG_LOG(msg, ...)
76 #define _LIBUNWIND_TRACE_API(msg, ...)
77 #define _LIBUNWIND_TRACING_UNWINDING 0
78 #define _LIBUNWIND_TRACE_UNWINDING(msg, ...)
79 #define _LIBUNWIND_LOG_NON_ZERO(x) x
84 extern bool logAPIs();
85 extern bool logUnwinding();
89 #define _LIBUNWIND_DEBUG_LOG(msg, ...) _LIBUNWIND_LOG(msg, __VA_ARGS__)
90 #define _LIBUNWIND_LOG_NON_ZERO(x) \
94 _LIBUNWIND_LOG("" #x "=%d in %s", _err, __FUNCTION__); \
96 #define _LIBUNWIND_TRACE_API(msg, ...) \
98 if ( logAPIs() ) _LIBUNWIND_LOG(msg, __VA_ARGS__); \
100 #define _LIBUNWIND_TRACE_UNWINDING(msg, ...) \
102 if ( logUnwinding() ) _LIBUNWIND_LOG(msg, __VA_ARGS__); \
104 #define _LIBUNWIND_TRACING_UNWINDING logUnwinding()
108 #endif // LIBUNWIND_CONFIG_H