]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: do not check for availability of static_cast<> anymore
authorKefu Chai <kchai@redhat.com>
Wed, 13 Jul 2016 09:23:07 +0000 (17:23 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 13 Jul 2016 09:23:11 +0000 (17:23 +0800)
it's implied by C++11 compliance.

Signed-off-by: Kefu Chai <kchai@redhat.com>
CMakeLists.txt
src/include/assert.h

index 4b3bacc44c5dd676045da7f45201486e1e9472af..a4c5cb826b433b58e79b8c8368da5929a91d21bc 100644 (file)
@@ -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<int>(f); return 0; }
-  " HAVE_STATIC_CAST)
 
 set(CEPH_MAN_DIR "share/man" CACHE STRING "Install location for man pages (relative to prefix).")
 
index 481f8bacfb3eeddae8661949096f6b96099ee021..bd39187a7a7e1fde17ca3f3cee2f21ddafb0d0f5 100644 (file)
@@ -30,13 +30,6 @@ namespace ceph {
 struct BackTrace;
 #endif
 
-
-#ifdef HAVE_STATIC_CAST
-# define __CEPH_ASSERT_VOID_CAST static_cast<void>
-#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<void> (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<void> (0)                             \
    : __ceph_assert_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION))
 #define ceph_assert(expr)                                                      \
   ((expr)                                                              \
-   ? __CEPH_ASSERT_VOID_CAST (0)                                       \
+   ? static_cast<void> (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<void> (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<void> (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<void> (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<void> (0)                             \
    : __ceph_assertf_fail (__STRING(expr), __FILE__, __LINE__, __CEPH_ASSERT_FUNCTION, __VA_ARGS__))