diff options
author | 2013-12-08 23:15:21 -0800 | |
---|---|---|
committer | 2013-12-15 23:08:50 -0800 | |
commit | 21163e764db5aa8bfcb21d2222421a19ded246a0 (patch) | |
tree | 0b508bfe227a0e1cad7e4020bccc0644b7058a14 | |
parent | e2e7c995c0ae9615707c45e7b3012a4cd6ea0d1b (diff) | |
download | paludis-21163e764db5aa8bfcb21d2222421a19ded246a0.tar.gz paludis-21163e764db5aa8bfcb21d2222421a19ded246a0.tar.xz |
build: assume full C++11 support
paludis requires C++11 support. Remove checks and compatibility code to permit
building with partial C++11 support. This mostly removes the configure checks
for support for C++11 features. noexcept and std::next (part of the C++11
standard library) had compatibility code which is no longer exercised and should
be safe to excise.
Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
-rw-r--r-- | configure.ac | 271 | ||||
-rw-r--r-- | paludis/util/attributes.hh | 6 | ||||
-rw-r--r-- | paludis/util/iterator_funcs.hh | 27 | ||||
-rw-r--r-- | paludis/util/process.cc | 2 | ||||
-rw-r--r-- | paludis/util/process.hh | 2 | ||||
-rw-r--r-- | paludis/util/safe_ofstream.cc | 2 | ||||
-rw-r--r-- | paludis/util/safe_ofstream.hh | 2 |
7 files changed, 4 insertions, 308 deletions
diff --git a/configure.ac b/configure.ac index e285164f5..ebbc5f6cf 100644 --- a/configure.ac +++ b/configure.ac @@ -640,22 +640,6 @@ int main(int, char **) AC_MSG_ERROR([Your compiler is b0rked (GCC bug 39242? Try -O2 or -fno-inline-functions)])]) dnl }}} -dnl {{{ check for namespace aliasing -AC_MSG_CHECKING([whether your compiler has referencing issues]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -namespace n -{ - int x = 0; - int & r_x = x; -} - -using n::r_x; -])], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([yes]) - AC_MSG_ERROR([Your compiler is b0rked (GCC bug 31899?)])]) -dnl }}} - dnl {{{ check whether we do explicit instantiation of fully specialised templates AC_MSG_CHECKING([whether we should explicitly instantiate fully specialised templates]) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ @@ -670,261 +654,6 @@ template class S<int>; ]) dnl }}} -dnl {{{ check for static_assert -AC_MSG_CHECKING([for compiler support for static_assert]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -int main(int, char **) -{ - static_assert(true, "works"); -} -])], - [AC_MSG_RESULT([yes]) - AC_MSG_CHECKING([whether static_assert works]) - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -int main(int, char **) -{ - static_assert(false, "works"); -} - ])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([your compiler static_assert implementation is broken (try GCC 4.4+)]) - ], - [AC_MSG_RESULT([yes])])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([your compiler does not do static_assert (try GCC 4.4+)]) - ]) -dnl }}} - -dnl {{{ check for hashes -AC_MSG_CHECKING([for hashed associative containers]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include <unordered_map> -int main(int, char **) -{ - std::unordered_map<int, int> m; - m.insert(std::make_pair(1, 2)); -} -])], - [AC_MSG_RESULT([std::unordered_map])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Your compiler does not support unordered containers])]) -dnl }}} - -dnl {{{ check for threads -AC_MSG_CHECKING([for threads]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include <thread> -int main(int, char **) -{ - std::thread t; -} -])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Your compiler does not support threads])]) -dnl }}} - -dnl {{{ shared pointers -AC_MSG_CHECKING([for std::shared_ptr<>]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include <memory> -int main(int, char **) -{ - std::shared_ptr<int> x(new int(10)); - x = std::make_shared<int>(20); - return *x; -} -])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Your compiler does not support shared pointers])]) -dnl }}} - -dnl {{{ type traits -AC_MSG_CHECKING([for std::remove_pointer<>]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include <type_traits> -int main(int, char **) -{ - std::remove_pointer<int *>::type x(10); - return x; -} -])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Your compiler does not support type traits])]) -dnl }}} - -dnl {{{ binders -AC_MSG_CHECKING([for std::bind<>]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include <functional> -#include <functional> -#include <algorithm> -#include <list> -struct S -{ - void x(const int) const - { - } -}; -int main(int, char **) -{ - using namespace std::placeholders; - std::list<int> l; - S s; - std::for_each(l.begin(), l.end(), - std::bind(std::mem_fn(&S::x), &s, _1)); -} -])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Your compiler does not support functional])]) -dnl }}} - -dnl {{{ std::next -AC_MSG_CHECKING([for std::next]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include <algorithm> -#include <iterator> -#include <list> -int main(int, char **) -{ - std::list<int> x; - next(x.begin()); -} -])], - [AC_MSG_RESULT([yes]) - PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -DPALUDIS_HAVE_STD_NEXT=1" - PALUDIS_PC_CFLAGS="${PALUDIS_PC_CFLAGS} -DPALUDIS_HAVE_STD_NEXT=1" - ], - [AC_MSG_RESULT([no]) - ]) -dnl }}} - -dnl {{{ std::random -random_is_tr1= -AC_MSG_CHECKING([for c++0x-compliant <random>]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include <random> -#include <ctime> -int main(int, char **) -{ - std::mt19937 rand(std::time(0)); - std::uniform_int_distribution<int> dist(0, 9); - return dist(rand); -} -])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_CHECKING([for tr1-compliant <random>]) - AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include <random> -#include <ctime> -int main(int, char **) -{ - std::mt19937 rand(std::time(0)); - std::uniform_int<int> dist(0, 9); - return dist(rand); -} - ])], - [AC_MSG_RESULT([yes]) - random_is_tr1=yes], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Your compiler does not support <random>])]) - ]) - -if test x$random_is_tr1 = xyes ; then - PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -DPALUDIS_RANDOM_IS_TR1=1" -fi -dnl }}} - -dnl {{{ c++0x default and deleted functions -AC_MSG_CHECKING([for c++0x default and deleted functions]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -struct S -{ - S() = default; - S & operator= (const S &) = delete; -}; -])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([your compiler does not support c++0x default and deleted functions]) - ]) -dnl }}} - -dnl {{{ c++0x variadic templates -AC_MSG_CHECKING([for c++0x variadic templates]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -template <typename... T_> -void f(const T_ & ... a) -{ -} -])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([your compiler does not support c++0x variadic templates]) - ]) -dnl }}} - -dnl {{{ c++0x auto -AC_MSG_CHECKING([for c++0x auto]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -#include <string> -std::string f(int); -int main(int, char **) -{ - auto x = f(1); -} -])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([your compiler does not support c++0x auto]) - ]) -dnl }}} - -dnl {{{ c++0x rvalue references -AC_MSG_CHECKING([for c++0x rvalue references]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -int f(int && a) -{ - return a; -} -])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([your compiler does not support c++0x rvalue references]) - ]) -dnl }}} - -dnl {{{ c++0x enum classes -AC_MSG_CHECKING([for c++0x enum class support]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -enum class C : long { c }; -])], - [AC_MSG_RESULT([yes]) - PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -DPALUDIS_HAVE_ENUM_CLASS=1" - PALUDIS_PC_CFLAGS="${PALUDIS_PC_CFLAGS} -DPALUDIS_HAVE_ENUM_CLASS=1" - ], - [AC_MSG_RESULT([no]) - ]) -dnl }}} - -dnl {{{ c++0x noexcept -AC_MSG_CHECKING([for c++0x noexcept]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([ -struct C { ~C() noexcept(false); }; -C::~C() noexcept(false) {} -])], - [AC_MSG_RESULT([yes]) - PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -DPALUDIS_HAVE_NOEXCEPT=1" - PALUDIS_PC_CFLAGS="${PALUDIS_PC_CFLAGS} -DPALUDIS_HAVE_NOEXCEPT=1" - ], - [AC_MSG_RESULT([no]) - ]) -dnl }}} - CXXFLAGS="$save_CXXFLAGS" dnl {{{ visibility support diff --git a/paludis/util/attributes.hh b/paludis/util/attributes.hh index 4fe4cef82..fa0f0302d 100644 --- a/paludis/util/attributes.hh +++ b/paludis/util/attributes.hh @@ -72,12 +72,6 @@ # define PALUDIS_HIDDEN #endif -#if defined(PALUDIS_HAVE_NOEXCEPT) -# define PALUDIS_NOEXCEPT(x) noexcept(x) -#else -# define PALUDIS_NOEXCEPT(x) -#endif - #define PALUDIS_TLS static __thread #endif diff --git a/paludis/util/iterator_funcs.hh b/paludis/util/iterator_funcs.hh index e72628478..7709549f5 100644 --- a/paludis/util/iterator_funcs.hh +++ b/paludis/util/iterator_funcs.hh @@ -25,34 +25,7 @@ namespace paludis { -#ifdef PALUDIS_HAVE_STD_NEXT using std::next; -#else - /** - * Return a new iterator pointing to the item after i. - * - * \ingroup g_iterator - */ - template <typename T_> - T_ next(const T_ & i) - { - T_ result(i); - return ++result; - } - - /** - * Return a new iterator advanced by a distance of n. - * - * \ingroup g_iterator - */ - template <typename T_> - T_ next(const T_ & i, const int & n) - { - T_ result(i); - std::advance(result, n); - return result; - } -#endif /** * Return a new iterator pointing to the item before i. diff --git a/paludis/util/process.cc b/paludis/util/process.cc index 0a5a31274..7b4356f97 100644 --- a/paludis/util/process.cc +++ b/paludis/util/process.cc @@ -1018,7 +1018,7 @@ RunningProcessHandle::RunningProcessHandle(pid_t p, std::unique_ptr<RunningProce { } -RunningProcessHandle::~RunningProcessHandle() PALUDIS_NOEXCEPT(false) +RunningProcessHandle::~RunningProcessHandle() noexcept(false) { if (-1 != _imp->pid) { diff --git a/paludis/util/process.hh b/paludis/util/process.hh index 5cebe8c97..108a239b7 100644 --- a/paludis/util/process.hh +++ b/paludis/util/process.hh @@ -125,7 +125,7 @@ namespace paludis const pid_t, std::unique_ptr<RunningProcessThread> &&); - ~RunningProcessHandle() PALUDIS_NOEXCEPT(false); + ~RunningProcessHandle() noexcept(false); RunningProcessHandle(RunningProcessHandle &&); RunningProcessHandle(const RunningProcessHandle &) = delete; diff --git a/paludis/util/safe_ofstream.cc b/paludis/util/safe_ofstream.cc index 7861572df..9f23390b3 100644 --- a/paludis/util/safe_ofstream.cc +++ b/paludis/util/safe_ofstream.cc @@ -138,7 +138,7 @@ SafeOFStream::SafeOFStream(const FSPath & p, const int open_flags, const bool b) { } -SafeOFStream::~SafeOFStream() PALUDIS_NOEXCEPT(false) +SafeOFStream::~SafeOFStream() noexcept(false) { buf.write_buffered(); diff --git a/paludis/util/safe_ofstream.hh b/paludis/util/safe_ofstream.hh index 221ff1e40..83b7eca38 100644 --- a/paludis/util/safe_ofstream.hh +++ b/paludis/util/safe_ofstream.hh @@ -118,7 +118,7 @@ namespace paludis SafeOFStream(const int fd, const bool buffer); SafeOFStream(const FSPath &, const int open_flags, const bool buffer); - ~SafeOFStream() PALUDIS_NOEXCEPT(false); + ~SafeOFStream() noexcept(false); ///\} }; |