/*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <glog/logging.h>
-#include "folly/Portability.h"
-#include "folly/experimental/exception_tracer/StackTrace.h"
-#include "folly/experimental/exception_tracer/ExceptionAbi.h"
-#include "folly/experimental/exception_tracer/ExceptionTracer.h"
-#include "folly/experimental/symbolizer/Symbolizer.h"
+#include <folly/Portability.h>
+#include <folly/experimental/exception_tracer/StackTrace.h>
+#include <folly/experimental/exception_tracer/ExceptionAbi.h>
+#include <folly/experimental/exception_tracer/ExceptionTracer.h>
+#include <folly/experimental/symbolizer/Symbolizer.h>
namespace __cxxabiv1 {
extern "C" {
-void __cxa_throw(void* thrownException, std::type_info* type,
- void (*destructor)(void)) FOLLY_NORETURN;
+FOLLY_NORETURN void __cxa_throw(void* thrownException,
+ std::type_info* type, void (*destructor)(void));
void* __cxa_begin_catch(void* excObj);
-void __cxa_rethrow(void) FOLLY_NORETURN;
+FOLLY_NORETURN void __cxa_rethrow(void);
void __cxa_end_catch(void);
}
namespace {
-__thread bool invalid;
-__thread StackTraceStack activeExceptions;
-__thread StackTraceStack caughtExceptions;
+FOLLY_TLS bool invalid;
+FOLLY_TLS StackTraceStack activeExceptions;
+FOLLY_TLS StackTraceStack caughtExceptions;
pthread_once_t initialized = PTHREAD_ONCE_INIT;
extern "C" {
-typedef void (*CxaThrowType)(void*, std::type_info*, void (*)(void))
- FOLLY_NORETURN;
+FOLLY_NORETURN typedef void (*CxaThrowType)(void*, std::type_info*,
+ void (*)(void));
typedef void* (*CxaBeginCatchType)(void*);
-typedef void (*CxaRethrowType)(void)
- FOLLY_NORETURN;
+FOLLY_NORETURN typedef void (*CxaRethrowType)(void);
typedef void (*CxaEndCatchType)(void);
CxaThrowType orig_cxa_throw;
CxaEndCatchType orig_cxa_end_catch;
} // extern "C"
-typedef void (*RethrowExceptionType)(std::exception_ptr)
- FOLLY_NORETURN;
+FOLLY_NORETURN typedef void (*RethrowExceptionType)(std::exception_ptr);
RethrowExceptionType orig_rethrow_exception;
void initialize() {
namespace {
// Make sure we're counting stack frames correctly, don't inline.
-void addActiveException() __attribute__((noinline));
+FOLLY_NOINLINE void addActiveException();
void addActiveException() {
pthread_once(&initialized, initialize);