From 8e13f6e0579b52f250f065e3ad1185db94d47de4 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Fri, 19 Aug 2016 13:45:00 -0700 Subject: [PATCH] Move detail/FunctionalExcept to portability/BitsFunctexcept Summary: Because it is a portability header, but was created before portability headers were cool. Reviewed By: mzlee Differential Revision: D3743475 fbshipit-source-id: 5d2fe23ce08f0425ce48b4871fa660e69f57cc39 --- folly/Makefile.am | 3 ++- folly/Malloc.h | 3 ++- folly/Portability.h | 7 ------- .../BitsFunctexcept.cpp} | 11 +---------- .../BitsFunctexcept.h} | 14 +++++--------- 5 files changed, 10 insertions(+), 28 deletions(-) rename folly/{detail/FunctionalExcept.cpp => portability/BitsFunctexcept.cpp} (84%) rename folly/{detail/FunctionalExcept.h => portability/BitsFunctexcept.h} (86%) diff --git a/folly/Makefile.am b/folly/Makefile.am index 0691344b..5df00b82 100644 --- a/folly/Makefile.am +++ b/folly/Makefile.am @@ -59,7 +59,6 @@ nobase_follyinclude_HEADERS = \ detail/ExceptionWrapper.h \ detail/FileUtilDetail.h \ detail/FingerprintPolynomial.h \ - detail/FunctionalExcept.h \ detail/Futex.h \ detail/GroupVarintDetail.h \ detail/IPAddress.h \ @@ -267,6 +266,7 @@ nobase_follyinclude_HEADERS = \ Portability.h \ portability/Asm.h \ portability/Atomic.h \ + portability/BitsFunctexcept.h \ portability/Builtins.h \ portability/Config.h \ portability/Constexpr.h \ @@ -437,6 +437,7 @@ libfolly_la_SOURCES = \ detail/SocketFastOpen.cpp \ MacAddress.cpp \ MemoryMapping.cpp \ + portability/BitsFunctexcept.cpp \ portability/Dirent.cpp \ portability/Environment.cpp \ portability/Fcntl.cpp \ diff --git a/folly/Malloc.h b/folly/Malloc.h index e7616da5..64fd393d 100644 --- a/folly/Malloc.h +++ b/folly/Malloc.h @@ -20,6 +20,8 @@ #pragma once #define FOLLY_MALLOC_H_ +#include + /** * Define various MALLOCX_* macros normally provided by jemalloc. We define * them so that we don't have to include jemalloc.h, in case the program is @@ -85,7 +87,6 @@ extern "C" int mallctlbymib(const size_t*, size_t, void*, size_t*, void*, size_t) __attribute__((__weak__)); -#include #define FOLLY_HAVE_MALLOC_H 1 #else #include /* nolint */ diff --git a/folly/Portability.h b/folly/Portability.h index a780eedc..12cff605 100644 --- a/folly/Portability.h +++ b/folly/Portability.h @@ -238,13 +238,6 @@ namespace std { typedef ::max_align_t max_align_t; } # define FOLLY_GLIBCXX_NAMESPACE_CXX11_END #endif -// Provide our own std::__throw_* wrappers for platforms that don't have them -#if FOLLY_HAVE_BITS_FUNCTEXCEPT_H -#include -#else -#include -#endif - // MSVC specific defines // mainly for posix compat #ifdef _MSC_VER diff --git a/folly/detail/FunctionalExcept.cpp b/folly/portability/BitsFunctexcept.cpp similarity index 84% rename from folly/detail/FunctionalExcept.cpp rename to folly/portability/BitsFunctexcept.cpp index 13a7b7d7..55b95616 100644 --- a/folly/detail/FunctionalExcept.cpp +++ b/folly/portability/BitsFunctexcept.cpp @@ -14,15 +14,9 @@ * limitations under the License. */ -#include - -// If FOLLY_HAVE_BITS_FUNCTEXCEPT_H is set, this file compiles to -// nothing. +#include #if !FOLLY_HAVE_BITS_FUNCTEXCEPT_H - -#include - #include FOLLY_NAMESPACE_STD_BEGIN @@ -39,12 +33,9 @@ void __throw_out_of_range(const char* msg) { throw std::out_of_range(msg); } -#if defined(_MSC_VER) void __throw_bad_alloc() { throw std::bad_alloc(); } -#endif FOLLY_NAMESPACE_STD_END - #endif diff --git a/folly/detail/FunctionalExcept.h b/folly/portability/BitsFunctexcept.h similarity index 86% rename from folly/detail/FunctionalExcept.h rename to folly/portability/BitsFunctexcept.h index 643c8eb2..80b2cb2a 100644 --- a/folly/detail/FunctionalExcept.h +++ b/folly/portability/BitsFunctexcept.h @@ -16,22 +16,18 @@ #pragma once -#include - -#if !FOLLY_HAVE_BITS_FUNCTEXCEPT_H +#include +#if FOLLY_HAVE_BITS_FUNCTEXCEPT_H +#include +#else +#include FOLLY_NAMESPACE_STD_BEGIN [[noreturn]] void __throw_length_error(const char* msg); [[noreturn]] void __throw_logic_error(const char* msg); [[noreturn]] void __throw_out_of_range(const char* msg); - -#ifdef _MSC_VER [[noreturn]] void __throw_bad_alloc(); -#endif FOLLY_NAMESPACE_STD_END - -#else -#error This file should never be included if FOLLY_HAVE_BITS_FUNCTEXCEPT_H is set #endif -- 2.34.1