mirror of
https://github.com/QuasarApp/backward-cpp.git
synced 2025-04-30 12:14:31 +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
|
||||
|
||||
#define NOINLINE __attribute__((noinline))
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
@ -710,9 +712,8 @@ template <typename F> size_t unwind(F f, size_t depth) {
|
||||
template <>
|
||||
class StackTraceImpl<system_tag::current_tag> : 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<system_tag::current_tag> : 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;
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user