diff --git a/backward.hpp b/backward.hpp index b469185..55d03be 100644 --- a/backward.hpp +++ b/backward.hpp @@ -65,6 +65,8 @@ #endif #endif +#define NOINLINE __attribute__((noinline)) + #include #include #include @@ -710,9 +712,8 @@ template size_t unwind(F f, size_t depth) { template <> class StackTraceImpl : public StackTraceImplHolder { public: - __attribute__((noinline)) // TODO use some macro - size_t - load_here(size_t depth = 32) { + NOINLINE + size_t load_here(size_t depth = 32) { load_thread_info(); if (depth == 0) { return 0; @@ -751,9 +752,8 @@ private: template <> class StackTraceImpl : public StackTraceImplHolder { public: - __attribute__((noinline)) // TODO use some macro - size_t - load_here(size_t depth = 32) { + NOINLINE + size_t load_here(size_t depth = 32) { load_thread_info(); if (depth == 0) { return 0; diff --git a/test/rectrace.cpp b/test/rectrace.cpp index f701bde..bdb8072 100644 --- a/test/rectrace.cpp +++ b/test/rectrace.cpp @@ -50,8 +50,7 @@ namespace titi { struct foo { union bar { - __attribute__((noinline)) static int trampoline(stacktrace_t &st, - int level) { + NOINLINE static int trampoline(stacktrace_t &st, int level) { return rec(st, level); } }; diff --git a/test/stacktrace.cpp b/test/stacktrace.cpp index 4088d38..812ae0d 100644 --- a/test/stacktrace.cpp +++ b/test/stacktrace.cpp @@ -43,7 +43,7 @@ void c(StackTrace &st) { return d(st); } void b(StackTrace &st) { return c(st); } -__attribute__((noinline)) void a(StackTrace &st) { return b(st); } +NOINLINE void a(StackTrace &st) { return b(st); } TEST(smalltrace) { StackTrace st;