switch to C++14 compilation
* configure.ac: Compile in C++14 by default and rename --enable-c++14 as c++17. * doc/org/compile.org, doc/org/concepts.org, doc/org/index.org, doc/org/install.org, doc/org/tut.org, doc/org/upgrade2.org, HACKING, NEWS, README: Adjust all mentions of C++11. * spot/twaalgos/stats.hh: Use std::make_unique.
This commit is contained in:
parent
7f42782701
commit
f5dce597c6
11 changed files with 71 additions and 105 deletions
85
configure.ac
85
configure.ac
|
|
@ -47,18 +47,14 @@ adl_CHECK_BISON
|
|||
# Decrease verbosity when passing argument V=0
|
||||
AM_SILENT_RULES([no])
|
||||
|
||||
# Option to activate C/C++14
|
||||
AC_ARG_ENABLE([c++14],
|
||||
[AC_HELP_STRING([--enable-c++14],
|
||||
[Use C++14.])],
|
||||
[enable_14=yes], [enable_14=no])
|
||||
# Option to activate C++17
|
||||
AC_ARG_ENABLE([c++17],
|
||||
[AC_HELP_STRING([--enable-c++17],
|
||||
[Compile in C++17 mode.])],
|
||||
[enable_17=yes], [enable_17=no])
|
||||
|
||||
# Activate at C11 for gnulib tests
|
||||
if test x"${enable_14}" = xyes; then
|
||||
AX_CHECK_COMPILE_FLAG([-std=c14], [CFLAGS="$CFLAGS -std=c14"])
|
||||
else
|
||||
AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS="$CFLAGS -std=c11"])
|
||||
fi
|
||||
# Activate C11 for gnulib tests
|
||||
AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS="$CFLAGS -std=c11"])
|
||||
|
||||
gl_INIT
|
||||
|
||||
|
|
@ -73,46 +69,11 @@ AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden],
|
|||
[CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"])])
|
||||
CXXFLAGS="$CXXFLAGS -DSPOT_BUILD"
|
||||
|
||||
# Turn on C++11 support
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody],
|
||||
[AC_LANG_SOURCE([#include <memory>
|
||||
#include <string>
|
||||
#include <chrono> // fails with some installation of clang
|
||||
#include <map>
|
||||
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
auto f = std::make_shared<std::string>("shared_ptr");
|
||||
|
||||
int a;
|
||||
decltype(a) b;
|
||||
|
||||
typedef check<int> check_type;
|
||||
check_type c;
|
||||
check_type&& cr = static_cast<check_type&&>(c);
|
||||
|
||||
auto d = a;
|
||||
|
||||
void test_emplace()
|
||||
{
|
||||
std::map<int, int> m;
|
||||
m.emplace(1, 2); // fails with g++ 4.6
|
||||
}
|
||||
])])
|
||||
|
||||
# Turn on C++14 support
|
||||
# This is currently a copy of the above code for C++11, feel free to add
|
||||
# further tests here when necessary.
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody],
|
||||
[AC_LANG_SOURCE([#include <memory>
|
||||
#include <string>
|
||||
#include <chrono> // fails with some installation of clang
|
||||
#include <chrono> // used to fail in C++11 with some installation of clang
|
||||
#include <map>
|
||||
|
||||
template <typename T>
|
||||
|
|
@ -123,7 +84,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody],
|
|||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
auto f = std::make_shared<std::string>("shared_ptr");
|
||||
auto f = std::make_unique<std::string>("uniq_ptr");
|
||||
|
||||
int a;
|
||||
decltype(a) b;
|
||||
|
|
@ -133,15 +94,19 @@ m4_define([_AX_CXX_COMPILE_STDCXX_14_testbody],
|
|||
check_type&& cr = static_cast<check_type&&>(c);
|
||||
|
||||
auto d = a;
|
||||
|
||||
void test_emplace()
|
||||
{
|
||||
std::map<int, int> m;
|
||||
m.emplace(1, 2); // fails with g++ 4.6
|
||||
}
|
||||
])])
|
||||
|
||||
if test x"${enable_14}" = xyes; then
|
||||
if test x"${enable_17}" = xyes; then
|
||||
for f in -std=c++17 '-std=c++17 -stdlib=libc++' -std=c++1z
|
||||
do
|
||||
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
|
||||
[_AX_CXX_COMPILE_STDCXX_14_testbody])
|
||||
${stdpass-false} && break
|
||||
done
|
||||
if ! "${stdpass-false}"; then
|
||||
AC_ERROR([unable to turn on C++17 mode with this compiler])
|
||||
fi
|
||||
else
|
||||
for f in -std=c++14 '-std=c++14 -stdlib=libc++' -std=c++1y
|
||||
do
|
||||
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
|
||||
|
|
@ -151,16 +116,6 @@ if test x"${enable_14}" = xyes; then
|
|||
if ! "${stdpass-false}"; then
|
||||
AC_ERROR([unable to turn on C++14 mode with this compiler])
|
||||
fi
|
||||
else
|
||||
for f in -std=c++11 '-std=c++11 -stdlib=libc++' -std=c++0x
|
||||
do
|
||||
AX_CHECK_COMPILE_FLAG([$f], [CXXFLAGS="$CXXFLAGS $f" stdpass=true], [], [],
|
||||
[_AX_CXX_COMPILE_STDCXX_11_testbody])
|
||||
${stdpass-false} && break
|
||||
done
|
||||
if ! "${stdpass-false}"; then
|
||||
AC_ERROR([unable to turn on C++11 mode with this compiler])
|
||||
fi
|
||||
fi
|
||||
|
||||
AX_CHECK_BUDDY
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue