mirror of
https://github.com/QuasarApp/backward-cpp.git
synced 2025-05-02 04:49:34 +00:00
Use a macro instead of direct noinline attributes.
This is a prerequisite of MSVC support, as it uses a different syntax.
This commit is contained in:
parent
7cf5ece17d
commit
4dfd5e6e24
12
backward.hpp
12
backward.hpp
@ -65,6 +65,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define NOINLINE __attribute__((noinline))
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -710,9 +712,8 @@ template <typename F> size_t unwind(F f, size_t depth) {
|
|||||||
template <>
|
template <>
|
||||||
class StackTraceImpl<system_tag::current_tag> : public StackTraceImplHolder {
|
class StackTraceImpl<system_tag::current_tag> : public StackTraceImplHolder {
|
||||||
public:
|
public:
|
||||||
__attribute__((noinline)) // TODO use some macro
|
NOINLINE
|
||||||
size_t
|
size_t load_here(size_t depth = 32) {
|
||||||
load_here(size_t depth = 32) {
|
|
||||||
load_thread_info();
|
load_thread_info();
|
||||||
if (depth == 0) {
|
if (depth == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -751,9 +752,8 @@ private:
|
|||||||
template <>
|
template <>
|
||||||
class StackTraceImpl<system_tag::current_tag> : public StackTraceImplHolder {
|
class StackTraceImpl<system_tag::current_tag> : public StackTraceImplHolder {
|
||||||
public:
|
public:
|
||||||
__attribute__((noinline)) // TODO use some macro
|
NOINLINE
|
||||||
size_t
|
size_t load_here(size_t depth = 32) {
|
||||||
load_here(size_t depth = 32) {
|
|
||||||
load_thread_info();
|
load_thread_info();
|
||||||
if (depth == 0) {
|
if (depth == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -50,8 +50,7 @@ namespace titi {
|
|||||||
struct foo {
|
struct foo {
|
||||||
|
|
||||||
union bar {
|
union bar {
|
||||||
__attribute__((noinline)) static int trampoline(stacktrace_t &st,
|
NOINLINE static int trampoline(stacktrace_t &st, int level) {
|
||||||
int level) {
|
|
||||||
return rec(st, level);
|
return rec(st, level);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -43,7 +43,7 @@ void c(StackTrace &st) { return d(st); }
|
|||||||
|
|
||||||
void b(StackTrace &st) { return c(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) {
|
TEST(smalltrace) {
|
||||||
StackTrace st;
|
StackTrace st;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user