scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL#10483
Conversation
|
Concept ACK |
|
Concept ACK. I think we can all agree that this needs to be done at some point, though we'll have to discuss when to do this with the least impact. This change probably means every single PR needs to be rebased. |
|
Rebased! |
10aba39 to
66c6427
Compare
|
@sipa Great idea! Now re-implemented as a scripted-diff. Looks good? :-) |
|
@practicalswift You can use |
|
@sipa Good point! Now using |
0fc5ae8 to
2a2726a
Compare
|
Merge conflicts resolved! |
|
What is the correct protocol to follow w.r.t. rebasing a large scripted-diff PR such as this one? Should I rebase periodically myself to keep it mergeable, or should I wait until I'm asked to rebase prior to the suggested time for merge (@sipa suggested: "possibly immediately after the feature freeze"). |
|
@practicalswift It is sufficient to rebase only once. Please refer to #9961 (comment) for the preliminary date of feature freeze. |
|
@MarcoFalke Great! Thanks for clarifying! |
|
Concept ACK. It'd be helpful to compare before/after binaries. |
… the pointer literal instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT- Signed-off-by: Pasta <[email protected]>
…ull pointer constant 36d326e Use nullptr instead of zero (0) as the null pointer constant (practicalswift) Pull request description: Use `nullptr` instead of zero (0) as the null pointer constant. The road towards `nullptr` (C++11) is split into two PRs: * `NULL` → `nullptr` is handled in PR bitcoin#10483 (scripted) * `0` → `nullptr` is handled in PR bitcoin#10645 (manual, this PR) By using the C++11 keyword `nullptr` we are guaranteed a prvalue of type `std::nullptr_t`. For a more thorough discussion, see "A name for the null pointer: nullptr" (Sutter & Stroustrup), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf Tree-SHA512: 5412404b40a94ea2d9fc8f81573559c4ffe559749301d486b09d41a7a736345ad602d08ac590930bb00a49692b6075520cf3d543e4da6ccd5b29fa9bcc3f15ea
…(void*)0 bea8e9e Document the preference of nullptr over NULL or (void*)0 (practicalswift) Pull request description: Document the preference of `nullptr` over `NULL` or `(void*)0`. After this commit: ``` $ git grep "[^A-Za-z_]NULL[^A-Za-z_]" | grep -vE '(leveldb|univalue|secp256k1|torcontrol|NULL certificates|ctaes|release-notes|patches|configure.ac|developer-notes)' $ ``` Some context: * `NULL → nullptr` was handled in the recently merged PR bitcoin#10483 * `0 → nullptr` was handled in the recently merged PR bitcoin#10645 Tree-SHA512: f863096aa4eb21705910f89713ca9cc0d83c6df2147e3d3530c3e1589b96f6c68de8755dcf37d8ce99ebda3cfb69805e00eab13bf65424aaf16170e9dda3958a
…(void*)0 bea8e9e Document the preference of nullptr over NULL or (void*)0 (practicalswift) Pull request description: Document the preference of `nullptr` over `NULL` or `(void*)0`. After this commit: ``` $ git grep "[^A-Za-z_]NULL[^A-Za-z_]" | grep -vE '(leveldb|univalue|secp256k1|torcontrol|NULL certificates|ctaes|release-notes|patches|configure.ac|developer-notes)' $ ``` Some context: * `NULL → nullptr` was handled in the recently merged PR bitcoin#10483 * `0 → nullptr` was handled in the recently merged PR bitcoin#10645 Tree-SHA512: f863096aa4eb21705910f89713ca9cc0d83c6df2147e3d3530c3e1589b96f6c68de8755dcf37d8ce99ebda3cfb69805e00eab13bf65424aaf16170e9dda3958a
…ull pointer constant 36d326e Use nullptr instead of zero (0) as the null pointer constant (practicalswift) Pull request description: Use `nullptr` instead of zero (0) as the null pointer constant. The road towards `nullptr` (C++11) is split into two PRs: * `NULL` → `nullptr` is handled in PR bitcoin#10483 (scripted) * `0` → `nullptr` is handled in PR bitcoin#10645 (manual, this PR) By using the C++11 keyword `nullptr` we are guaranteed a prvalue of type `std::nullptr_t`. For a more thorough discussion, see "A name for the null pointer: nullptr" (Sutter & Stroustrup), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf Tree-SHA512: 5412404b40a94ea2d9fc8f81573559c4ffe559749301d486b09d41a7a736345ad602d08ac590930bb00a49692b6075520cf3d543e4da6ccd5b29fa9bcc3f15ea
Cherry-picked from: - bitcoin/bitcoin#9233 - bitcoin/bitcoin#10483 - bitcoin/bitcoin#10645 - bitcoin/bitcoin#10969 - bitcoin/bitcoin#11351 Co-authored-by: fsb4000 <[email protected]> Co-authored-by: practicalswift <[email protected]> Co-authored-by: Dan Raviv <[email protected]>
Locked memory manager Add a pool for locked memory chunks, replacing `LockedPageManager`. Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#8321 - bitcoin/bitcoin#8753 - bitcoin/bitcoin#9063 - bitcoin/bitcoin#9070 - bitcoin/bitcoin#11385 - bitcoin/bitcoin#12048 - Excludes change to benchmark. - bitcoin/bitcoin#15117 - bitcoin/bitcoin#16161 - Excludes Travis CI changes. - Includes change from bitcoin/bitcoin#13163 - bitcoin/bitcoin#15600 - bitcoin/bitcoin#18443 - Assorted small changes from: - bitcoin/bitcoin#9233 - bitcoin/bitcoin#10483 - bitcoin/bitcoin#10645 - bitcoin/bitcoin#10969 - bitcoin/bitcoin#11351 - bitcoin/bitcoin#19111 - Excludes change to `src/rpc/server.cpp` - bitcoin/bitcoin#9804 - Only the commit for `src/key.cpp` - bitcoin/bitcoin#9598
Since C++11 the macro
NULLmay be:std::nullptr_tBy using the C++11 keyword
nullptrwe are guaranteed a prvalue of typestd::nullptr_t.For a more thorough discussion, see "A name for the null pointer: nullptr" (Sutter &
Stroustrup), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
With this patch applied there are no
NULLmacro usages left in the repo:The road towards
nullptr(C++11) is split into two PRs:NULL→nullptris handled in PR scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL #10483 (scripted, this PR)0→nullptris handled in PR Use nullptr (C++11) instead of zero (0) as the null pointer constant #10645 (manual)