From: Kefu Chai Date: Wed, 13 Jul 2016 09:23:07 +0000 (+0800) Subject: cmake: do not check for availability of static_cast<> anymore X-Git-Tag: ses5-milestone5~416^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2e7c72d8e8ae94fd5e16960f45fb7e2e8aa21f0b;p=ceph.git cmake: do not check for availability of static_cast<> anymore it's implied by C++11 compliance. Signed-off-by: Kefu Chai --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b3bacc44c5..a4c5cb826b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,9 +141,6 @@ CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h HAVE_STAT_ST_MTIM_TV_NSEC LANGUAGE C) CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h HAVE_STAT_ST_MTIMESPEC_TV_NSEC LANGUAGE C) -CHECK_CXX_SOURCE_COMPILES(" - int main() { float f = 12.3; int n = static_cast(f); return 0; } - " HAVE_STATIC_CAST) set(CEPH_MAN_DIR "share/man" CACHE STRING "Install location for man pages (relative to prefix).") diff --git a/src/include/assert.h b/src/include/assert.h index 481f8bacfb3..bd39187a7a7 100644 --- a/src/include/assert.h +++ b/src/include/assert.h @@ -30,13 +30,6 @@ namespace ceph { struct BackTrace; #endif - -#ifdef HAVE_STATIC_CAST -# define __CEPH_ASSERT_VOID_CAST static_cast -#else -# define __CEPH_ASSERT_VOID_CAST (void) -#endif - /* * For GNU, test specific version features. Otherwise (e.g. LLVM) we'll use * the defaults selected below. @@ -79,7 +72,7 @@ extern void __ceph_assert_warn(const char *assertion, const char *file, int line #define assert_warn(expr) \ ((expr) \ - ? __CEPH_ASSERT_VOID_CAST (0) \ + ? static_cast (0) \ : __ceph_assert_warn (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION)) #ifdef __cplusplus @@ -122,34 +115,34 @@ using namespace ceph; #define assert(expr) \ ((expr) \ - ? __CEPH_ASSERT_VOID_CAST (0) \ + ? static_cast (0) \ : __ceph_assert_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION)) #define ceph_assert(expr) \ ((expr) \ - ? __CEPH_ASSERT_VOID_CAST (0) \ + ? static_cast (0) \ : __ceph_assert_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION)) // this variant will *never* get compiled out to NDEBUG in the future. // (ceph_assert currently doesn't either, but in the future it might.) #define ceph_assert_always(expr) \ ((expr) \ - ? __CEPH_ASSERT_VOID_CAST (0) \ + ? static_cast (0) \ : __ceph_assert_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION)) // Named by analogy with printf. Along with an expression, takes a format // string and parameters which are printed if the assertion fails. #define assertf(expr, ...) \ ((expr) \ - ? __CEPH_ASSERT_VOID_CAST (0) \ + ? static_cast (0) \ : __ceph_assertf_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION, __VA_ARGS__)) #define ceph_assertf(expr, ...) \ ((expr) \ - ? __CEPH_ASSERT_VOID_CAST (0) \ + ? static_cast (0) \ : __ceph_assertf_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION, __VA_ARGS__)) // this variant will *never* get compiled out to NDEBUG in the future. // (ceph_assertf currently doesn't either, but in the future it might.) #define ceph_assertf_always(expr, ...) \ ((expr) \ - ? __CEPH_ASSERT_VOID_CAST (0) \ + ? static_cast (0) \ : __ceph_assertf_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION, __VA_ARGS__))