From 43d56a22929bd4d591d3d6a5fb5a9bc0894facea Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Tue, 26 Apr 2016 00:56:27 -0700 Subject: [PATCH] Retire BOOST_STATIC_ASSERT in favor of static_assert Summary: Retire `BOOST_STATIC_ASSERT` in favor of `static_assert`. `static_assert` is part of C++ now, so we don't need workarounds like `BOOST_STATIC_ASSERT` anymore. Partially automated: hg grep -lw BOOST_STATIC_ASSERT | xargs perl -pi -e 's~\bBOOST_STATIC_ASSERT\(([^;]*)\);~static_assert(\1, "");~g' hg grep -lw 'boost/static_assert.hpp' | xargs perl -pi -e 's,^#include \n,,gm' Caught most instances. Formatting and remaining instances addressed manually. Reviewed By: meyering Differential Revision: D3215944 fb-gh-sync-id: f4552d5d9bfc416ce283923abe880437a4d0cba5 fbshipit-source-id: f4552d5d9bfc416ce283923abe880437a4d0cba5 --- folly/SocketAddress.cpp | 1 - folly/docs/FBVector.md | 8 +++++--- folly/docs/Traits.md | 4 +--- folly/io/async/EventBase.cpp | 1 - folly/stats/TimeseriesHistogram.h | 3 +-- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/folly/SocketAddress.cpp b/folly/SocketAddress.cpp index e9a9043b..5f63d8e0 100644 --- a/folly/SocketAddress.cpp +++ b/folly/SocketAddress.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/folly/docs/FBVector.md b/folly/docs/FBVector.md index 21edbe8f..3d1d4c10 100644 --- a/folly/docs/FBVector.md +++ b/folly/docs/FBVector.md @@ -202,7 +202,7 @@ after `Widget`'s definition and write this: } If you don't do this, `fbvector` will fail to compile -with a `BOOST_STATIC_ASSERT`. +with a `static_assert`. #### Additional Constraints @@ -215,9 +215,11 @@ already present in the C++ standard (well, currently in Boost). To summarize, in order to work with `fbvector`, a type `Widget` must pass: - BOOST_STATIC_ASSERT( + static_assert( IsRelocatable::value && - (boost::has_trivial_assign::value || boost::has_nothrow_constructor::value)); + (boost::has_trivial_assign::value || + boost::has_nothrow_constructor::value), + ""); These traits go hand in hand; for example, it would be very difficult to design a class that satisfies one branch of the diff --git a/folly/docs/Traits.md b/folly/docs/Traits.md index 8d1a0b29..18359b17 100644 --- a/folly/docs/Traits.md +++ b/folly/docs/Traits.md @@ -127,9 +127,7 @@ explicitly, `fbvector` or `fbvector` will fail to compile due to assertion below: ```Cpp -BOOST_STATIC_ASSERT( - IsRelocatable::value -); +static_assert(IsRelocatable::value, ""); ``` FOLLY_ASSUME_FBVECTOR_COMPATIBLE*(type) macros can be used to state that type diff --git a/folly/io/async/EventBase.cpp b/folly/io/async/EventBase.cpp index 4c11511d..7f2d9239 100644 --- a/folly/io/async/EventBase.cpp +++ b/folly/io/async/EventBase.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/folly/stats/TimeseriesHistogram.h b/folly/stats/TimeseriesHistogram.h index 2f3cc75f..4e7056a5 100644 --- a/folly/stats/TimeseriesHistogram.h +++ b/folly/stats/TimeseriesHistogram.h @@ -17,7 +17,6 @@ #pragma once #include -#include #include #include @@ -53,7 +52,7 @@ template ::is_signed); + static_assert(std::numeric_limits::is_signed, ""); public: // values to be inserted into container -- 2.34.1