HomePhabricator

Fix UniValue .write() changes for C++98

Description

Fix UniValue .write() changes for C++98

Summary:
While C++14 is enforced throughout our CMake build, it is not enforced
for every subproject in the Autotools build. As a result, D5982 breaks the build
when UniValue is built with C++98 (thereby affecting Autotools builds on Xenial).
Normally, we wouldn't care because the Autotools build is no longer supported and
we enforce C++14. However, the UniValue library does not yet officially support
C++11 or later, so keeping our changes consistent with our upstream PRs will help
reduce maintenance costs in the long run.

This patch is the same I applied to my current upstream PR for the .write() perf improvements:
https://github.com/jgarzik/univalue/compare/d3a09e5e4a48417d5478a66dc343d7bf00146d5a..bb1c002bf540851551b33e76ad208baaf7ea5b11

While removing the std::move() call is not ideal, it does not appear to impact performance
in an easily measurable way.

Test Plan:
Make sure there are no errors or warnings in the CMake build:

mkdir build && cd build
cmake -GNinja ..
ninja check check-univalue

Make sure the Autotools build works as expected (I ran this on both Debian 10 and Ubuntu 16.04):

./autogen.sh
mkdir build && cd build
../configure
make check

Make sure UniValue builds with C++98:

cd src/univalue
./autogen.sh
mkdir build && cd build
CXXFLAGS="-std=c++98" ../configure
make check

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: Fabien, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6359

Details

Provenance
jasonbcoxAuthored on Jun 3 2020, 17:45
jasonbcoxPushed on Jun 4 2020, 23:32
Reviewer
Restricted Project
Differential Revision
D6359: Fix UniValue .write() changes for C++98
Parents
rABC3aa12ec3b525: [devtools] Use a trap to cleanup bitcoind instead of a background process
Branches
Unknown
Tags
Unknown