Summary: Seems like a good idea.
Test Plan: compiled all of folly
Reviewed By: delong.j@fb.com
FB internal diff:
D783104
#include "folly/Conv.h"
#include "folly/Likely.h"
#include "folly/Conv.h"
#include "folly/Likely.h"
+#include "folly/Portability.h"
namespace folly {
// Helper to throw std::system_error
namespace folly {
// Helper to throw std::system_error
-void throwSystemError(int err, const char* msg) __attribute__((noreturn));
+void throwSystemError(int err, const char* msg) FOLLY_NORETURN;
inline void throwSystemError(int err, const char* msg) {
throw std::system_error(err, std::system_category(), msg);
}
// Helper to throw std::system_error from errno
inline void throwSystemError(int err, const char* msg) {
throw std::system_error(err, std::system_category(), msg);
}
// Helper to throw std::system_error from errno
-void throwSystemError(const char* msg) __attribute__((noreturn));
+void throwSystemError(const char* msg) FOLLY_NORETURN;
inline void throwSystemError(const char* msg) {
throwSystemError(errno, msg);
}
// Helper to throw std::system_error from errno and components of a string
template <class... Args>
inline void throwSystemError(const char* msg) {
throwSystemError(errno, msg);
}
// Helper to throw std::system_error from errno and components of a string
template <class... Args>
-void throwSystemError(Args... args) __attribute__((noreturn));
+void throwSystemError(Args... args) FOLLY_NORETURN;
template <class... Args>
inline void throwSystemError(Args... args) {
throwSystemError(errno, folly::to<std::string>(args...));
template <class... Args>
inline void throwSystemError(Args... args) {
throwSystemError(errno, folly::to<std::string>(args...));
#define FOLLY_FORMATARG_H_
#include <stdexcept>
#define FOLLY_FORMATARG_H_
#include <stdexcept>
-#include "folly/Range.h"
-#include "folly/Likely.h"
+#include "folly/Likely.h"
+#include "folly/Portability.h"
+#include "folly/Range.h"
}
template <typename... Args>
}
template <typename... Args>
- void error(Args&&... args) const __attribute__((noreturn));
+ void error(Args&&... args) const FOLLY_NORETURN;
/**
* Full argument string, as passed in to the constructor.
*/
/**
* Full argument string, as passed in to the constructor.
*/
# error Cannot define MaxAlign on this platform
#endif
# error Cannot define MaxAlign on this platform
#endif
+#if defined(__clang__) || defined(__GNUC__)
+# define FOLLY_NORETURN __attribute__((noreturn))
+#else
+# define FOLLY_NORETURN
+#endif
+
#endif // FOLLY_PORTABILITY_H_
#endif // FOLLY_PORTABILITY_H_
#include <glog/logging.h>
#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/exception_tracer/StackTrace.h"
#include "folly/experimental/exception_tracer/ExceptionAbi.h"
#include "folly/experimental/exception_tracer/ExceptionTracer.h"
extern "C" {
void __cxa_throw(void* thrownException, std::type_info* type,
extern "C" {
void __cxa_throw(void* thrownException, std::type_info* type,
- void (*destructor)(void)) __attribute__((noreturn));
+ void (*destructor)(void)) FOLLY_NORETURN;
void* __cxa_begin_catch(void* excObj);
void* __cxa_begin_catch(void* excObj);
-void __cxa_rethrow(void) __attribute__((noreturn));
+void __cxa_rethrow(void) FOLLY_NORETURN;
void __cxa_end_catch(void);
}
void __cxa_end_catch(void);
}
extern "C" {
typedef void (*CxaThrowType)(void*, std::type_info*, void (*)(void))
extern "C" {
typedef void (*CxaThrowType)(void*, std::type_info*, void (*)(void))
- __attribute__((noreturn));
typedef void* (*CxaBeginCatchType)(void*);
typedef void (*CxaRethrowType)(void)
typedef void* (*CxaBeginCatchType)(void*);
typedef void (*CxaRethrowType)(void)
- __attribute__((noreturn));
typedef void (*CxaEndCatchType)(void);
CxaThrowType orig_cxa_throw;
typedef void (*CxaEndCatchType)(void);
CxaThrowType orig_cxa_throw;
} // extern "C"
typedef void (*RethrowExceptionType)(std::exception_ptr)
} // extern "C"
typedef void (*RethrowExceptionType)(std::exception_ptr)
- __attribute__((noreturn));
RethrowExceptionType orig_rethrow_exception;
void initialize() {
RethrowExceptionType orig_rethrow_exception;
void initialize() {
#include <gflags/gflags.h>
#include <gflags/gflags.h>
-#include "folly/experimental/io/HugePages.h"
#include "folly/Format.h"
#include "folly/Format.h"
+#include "folly/Portability.h"
#include "folly/Range.h"
#include "folly/ScopeGuard.h"
#include "folly/Range.h"
#include "folly/ScopeGuard.h"
+#include "folly/experimental/io/HugePages.h"
DEFINE_bool(cp, false, "Copy file");
DEFINE_bool(cp, false, "Copy file");
-void usage(const char* name) __attribute__((noreturn));
+void usage(const char* name) FOLLY_NORETURN;
void usage(const char* name) {
std::cerr << folly::format(
void usage(const char* name) {
std::cerr << folly::format(