Enable C++14 in build, require C++14 compiler.
Implements #13356.
Enable C++14 in build, require C++14 compiler.
Implements #13356.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
79@@ -80,7 +80,7 @@ int main(int argc, char** argv)
80 return EXIT_FAILURE;
81 }
82
83- std::unique_ptr<benchmark::Printer> printer = MakeUnique<benchmark::ConsolePrinter>();
84+ std::unique_ptr<benchmark::Printer> printer = std::make_unique<benchmark::ConsolePrinter>();
std::make_unique
to prove that we’re using C++14 :-)
8@@ -9,11 +9,11 @@
9 #include <memory>
10 #include <utility>
11
12-//! Substitute for C++14 std::make_unique.
13+//! No longer needed substitute for C++14 std::make_unique. Needed when we were using C++11.
14 template <typename T, typename... Args>
15 std::unique_ptr<T> MakeUnique(Args&&... args)
deprecated
attribute and remove them in the following few PRs.MakeUnique
in a scripted-diff follow-up PR as soon as this PR is merged as discussed in #15262 (review). Makes sense?
@ken2812221 My suggestion is that we simply remove MakeUnique in a scripted-diff follow-up PR as soon as this PR is merged as discussed in #15262 (comment). Makes sense?
To be honest, if it’s a scripted diff we could just as well do it in one go (in a sep commit) here. No need to drag this out, it’s not controversial in any way once we’ve decided to go to C++14.
The rationale behind this was that any pull requests that are expected to be open for “longer” should minimize any (silent) merge conflicts.
Mostly I’d agree. But OTOH if the merge conflict is in the scripted-diff part then rebasing should be trivial.
I don’t like the prospect of follow-up PR after follow-up PR. Better IMO to do it at once. But okay.
I agree with that @MarcoFalke. Especially since it looks like this PR will be open for quite a while?
Let’s merge it after the 0.18 split.
6@@ -7,12 +7,12 @@ These are the dependencies currently used by Bitcoin Core. You can find instruct
7 | --- | --- | --- | --- | --- | --- |
8 | Berkeley DB | [4.8.30](https://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html) | 4.8.x | No | | |
9 | Boost | [1.64.0](https://www.boost.org/users/download/) | [1.47.0](https://github.com/bitcoin/bitcoin/pull/8920) | No | | |
10-| Clang | | [3.3+](https://llvm.org/releases/download.html) (C++11 support) | | | |
11+| Clang | | [3.5+](https://llvm.org/releases/download.html) (C++14 support) | | | |
Shouldn’t this be 3.4+? Looking at C++ Support in Clang:
Clang 3.4 and later implement all of the ISO C++ 2014 standard. You can use Clang in C++14 mode with the -std=c++14 option (use -std=c++1y in Clang 3.4 and earlier).
-std=c++11
and handled std::make_unique
(as a sanity check). Do we want to go with the -std=c++1y
route instead of -std=c++11
?
-std=c++1y
route makes sense to me, may as well enforce that which we require.
12 | D-Bus | [1.10.18](https://cgit.freedesktop.org/dbus/dbus/tree/NEWS?h=dbus-1.10) | | No | Yes | |
13 | Expat | [2.2.6](https://libexpat.github.io/) | | No | Yes | |
14 | fontconfig | [2.12.1](https://www.freedesktop.org/software/fontconfig/release/) | | No | Yes | |
15 | FreeType | [2.7.1](https://download.savannah.gnu.org/releases/freetype) | | No | | |
16-| GCC | | [4.8+](https://gcc.gnu.org/) (C++11 support) | | | |
17+| GCC | | [4.9+](https://gcc.gnu.org/) (C++14 support) | | | |
-std=c++11
. Changing. Thanks!
boost::shared_mutex
with std::shared_timed_mutex
becuase they are the same thing.
https://github.com/bitcoin/bitcoin/blob/2945492424934fa360f86b116184ee8e34f19d0a/src/script/sigcache.cpp#L30
NAK. As far as I know, C++14 is not very interesting (C++17 OTOH…) and it is still incompatible with the latest releases of widely used supported GNU/Linux distros as pointed out on #13356.
Moving the minimum required language requires balancing the negative trade-offs of incompatibility with the positive benefits of the new language features. I’m not aware of any C++14 features that would obviously improve the codebase. If there weren’t a compatibility issue then sure why not, or if there were some really important language features that would make the software safer then it might be worth the cost (as C++11 was worth some incompatibility, though it was worse than we anticipated).
Agree w.r.t. skipping directly to 17, when possible/appropriate.
On Thu, Oct 3, 2019, 16:36 Elichai Turkel notifications@github.com wrote:
I would argue for skipping C++14 directly to 17 (assuming all stable distros ship with GCC7+ already) CC #16684 https://github.com/bitcoin/bitcoin/issues/16684
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/pull/15262?email_source=notifications&email_token=AAA65NSE5HB36KSTUFLZI2LQMX7PNA5CNFSM4GSM4URKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAING3Y#issuecomment-537973615, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA65NQA7HCKM4BFCPM5CPLQMX7PNANCNFSM4GSM4URA .