From 5a9b508279b3a221d36149aa2e811a9702b28e60 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 31 May 2017 22:21:25 +0200 Subject: [PATCH] [trivial] Add end of namespace comments --- doc/developer-notes.md | 17 ++++++++++++++++- src/base58.cpp | 2 +- src/bench/checkblock.cpp | 2 +- src/compat/glibc_sanity.cpp | 2 +- src/compat/glibcxx_sanity.cpp | 2 +- src/dbwrapper.cpp | 2 +- src/init.cpp | 2 +- src/net_processing.cpp | 4 ++-- src/protocol.cpp | 2 +- src/pubkey.cpp | 2 +- src/script/bitcoinconsensus.cpp | 2 +- src/script/interpreter.cpp | 4 ++-- src/script/sigcache.cpp | 2 +- src/script/sign.cpp | 2 +- src/script/standard.cpp | 2 +- src/test/coins_tests.cpp | 2 +- src/test/script_tests.cpp | 2 +- src/txmempool.cpp | 2 +- src/validation.cpp | 2 +- src/versionbits.cpp | 2 +- 20 files changed, 37 insertions(+), 22 deletions(-) diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 797507cd3..7d3427a3b 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -45,7 +45,7 @@ class Class return true; } } -} +} // namespace foo ``` Doxygen comments @@ -408,6 +408,21 @@ Source code organization - *Rationale*: Avoids symbol conflicts +- Terminate namespaces with a comment (`// namespace mynamespace`). The comment + should be placed on the same line as the brace closing the namespace, e.g. + +```c++ +namespace mynamespace { + ... +} // namespace mynamespace + +namespace { + ... +} // namespace +``` + + - *Rationale*: Avoids confusion about the namespace context + GUI ----- diff --git a/src/base58.cpp b/src/base58.cpp index 36b352369..efa1beb1e 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -225,7 +225,7 @@ public: bool operator()(const CNoDestination& no) const { return false; } }; -} // anon namespace +} // namespace bool CBitcoinAddress::Set(const CKeyID& id) { diff --git a/src/bench/checkblock.cpp b/src/bench/checkblock.cpp index c6c932454..30900d854 100644 --- a/src/bench/checkblock.cpp +++ b/src/bench/checkblock.cpp @@ -11,7 +11,7 @@ namespace block_bench { #include "bench/data/block413567.raw.h" -} +} // namespace block_bench // These are the two major time-sinks which happen after we have fully received // a block off the wire, but before we can relay the block on to peers using diff --git a/src/compat/glibc_sanity.cpp b/src/compat/glibc_sanity.cpp index d62d74d46..b4d1c9099 100644 --- a/src/compat/glibc_sanity.cpp +++ b/src/compat/glibc_sanity.cpp @@ -56,7 +56,7 @@ bool sanity_test_fdelt() } #endif -} // anon namespace +} // namespace bool glibc_sanity_test() { diff --git a/src/compat/glibcxx_sanity.cpp b/src/compat/glibcxx_sanity.cpp index cee8a98c7..569fb1bbe 100644 --- a/src/compat/glibcxx_sanity.cpp +++ b/src/compat/glibcxx_sanity.cpp @@ -38,7 +38,7 @@ bool sanity_test_list(unsigned int size) return true; } -} // anon namespace +} // namespace // trigger: string::at(x) on an empty string to trigger __throw_out_of_range_fmt. // test: force std::string to throw an out_of_range exception. Verify that diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 3d2098c05..79ec428ff 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -209,4 +209,4 @@ const std::vector& GetObfuscateKey(const CDBWrapper &w) return w.obfuscate_key; } -}; +} // namespace dbwrapper_private diff --git a/src/init.cpp b/src/init.cpp index f06c9e110..45f0ea824 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -809,7 +809,7 @@ int nUserMaxConnections; int nFD; ServiceFlags nLocalServices = NODE_NETWORK; -} +} // namespace [[noreturn]] static void new_handler_terminate() { diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 718a7de03..d884ce092 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -122,7 +122,7 @@ namespace { MapRelay mapRelay; /** Expiration-time ordered list of (expire time, relay map entry) pairs, protected by cs_main). */ std::deque> vRelayExpiration; -} // anon namespace +} // namespace ////////////////////////////////////////////////////////////////////////////// // @@ -555,7 +555,7 @@ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector CTxMemPool::GetSortedDepthAndScore() const { diff --git a/src/validation.cpp b/src/validation.cpp index 6c60be45a..3198a7529 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1491,7 +1491,7 @@ bool AbortNode(CValidationState& state, const std::string& strMessage, const std return state.Error(strMessage); } -} // anon namespace +} // namespace /** * Apply the undo operation of a CTxInUndo to the given chain state. diff --git a/src/versionbits.cpp b/src/versionbits.cpp index 8a7cce748..6e74a1657 100644 --- a/src/versionbits.cpp +++ b/src/versionbits.cpp @@ -160,7 +160,7 @@ public: uint32_t Mask(const Consensus::Params& params) const { return ((uint32_t)1) << params.vDeployments[id].bit; } }; -} +} // namespace ThresholdState VersionBitsState(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos pos, VersionBitsCache& cache) {