aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/developer-notes.md17
-rw-r--r--src/base58.cpp2
-rw-r--r--src/bench/checkblock.cpp2
-rw-r--r--src/compat/glibc_sanity.cpp2
-rw-r--r--src/compat/glibcxx_sanity.cpp2
-rw-r--r--src/dbwrapper.cpp2
-rw-r--r--src/init.cpp2
-rw-r--r--src/net_processing.cpp4
-rw-r--r--src/protocol.cpp2
-rw-r--r--src/pubkey.cpp2
-rw-r--r--src/script/bitcoinconsensus.cpp2
-rw-r--r--src/script/interpreter.cpp4
-rw-r--r--src/script/sigcache.cpp2
-rw-r--r--src/script/sign.cpp2
-rw-r--r--src/script/standard.cpp2
-rw-r--r--src/test/coins_tests.cpp2
-rw-r--r--src/test/script_tests.cpp2
-rw-r--r--src/txmempool.cpp2
-rw-r--r--src/validation.cpp2
-rw-r--r--src/versionbits.cpp2
20 files changed, 37 insertions, 22 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index 797507cd3e..7d3427a3b3 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 36b3523692..efa1beb1e4 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 c6c932454a..30900d854a 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 d62d74d462..b4d1c90992 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 cee8a98c7f..569fb1bbe8 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 3d2098c059..79ec428ff2 100644
--- a/src/dbwrapper.cpp
+++ b/src/dbwrapper.cpp
@@ -209,4 +209,4 @@ const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w)
return w.obfuscate_key;
}
-};
+} // namespace dbwrapper_private
diff --git a/src/init.cpp b/src/init.cpp
index f06c9e1100..45f0ea8243 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 718a7de031..d884ce092b 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<std::pair<int64_t, MapRelay::iterator>> vRelayExpiration;
-} // anon namespace
+} // namespace
//////////////////////////////////////////////////////////////////////////////
//
@@ -555,7 +555,7 @@ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<con
}
}
-} // anon namespace
+} // namespace
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) {
LOCK(cs_main);
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 28d1d0eeb4..ebe63a1879 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -39,7 +39,7 @@ const char *SENDCMPCT="sendcmpct";
const char *CMPCTBLOCK="cmpctblock";
const char *GETBLOCKTXN="getblocktxn";
const char *BLOCKTXN="blocktxn";
-};
+} // namespace NetMsgType
/** All known message types. Keep this in the same order as the list of
* messages above and in protocol.h.
diff --git a/src/pubkey.cpp b/src/pubkey.cpp
index e57fa238cb..a16457ea4e 100644
--- a/src/pubkey.cpp
+++ b/src/pubkey.cpp
@@ -11,7 +11,7 @@ namespace
{
/* Global secp256k1_context object used for verification. */
secp256k1_context* secp256k1_context_verify = NULL;
-}
+} // namespace
/** This function is taken from the libsecp256k1 distribution and implements
* DER parsing for ECDSA signatures, while supporting an arbitrary subset of
diff --git a/src/script/bitcoinconsensus.cpp b/src/script/bitcoinconsensus.cpp
index c4ab441e2c..4b71a42cdf 100644
--- a/src/script/bitcoinconsensus.cpp
+++ b/src/script/bitcoinconsensus.cpp
@@ -68,7 +68,7 @@ struct ECCryptoClosure
};
ECCryptoClosure instance_of_eccryptoclosure;
-}
+} // namespace
/** Check that all specified flags are part of the libconsensus interface. */
static bool verify_flags(unsigned int flags)
diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
index f4e5313a78..171f28eef1 100644
--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -31,7 +31,7 @@ inline bool set_error(ScriptError* ret, const ScriptError serror)
return false;
}
-} // anon namespace
+} // namespace
bool CastToBool(const valtype& vch)
{
@@ -1164,7 +1164,7 @@ uint256 GetOutputsHash(const CTransaction& txTo) {
return ss.GetHash();
}
-} // anon namespace
+} // namespace
PrecomputedTransactionData::PrecomputedTransactionData(const CTransaction& txTo)
{
diff --git a/src/script/sigcache.cpp b/src/script/sigcache.cpp
index 7bb8d9941b..befc5f5233 100644
--- a/src/script/sigcache.cpp
+++ b/src/script/sigcache.cpp
@@ -66,7 +66,7 @@ public:
* signatureCache could be made local to VerifySignature.
*/
static CSignatureCache signatureCache;
-}
+} // namespace
// To be called once in AppInitMain/BasicTestingSetup to initialize the
// signatureCache.
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index 5682418546..59af4e4905 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -400,7 +400,7 @@ public:
}
};
const DummySignatureChecker dummyChecker;
-}
+} // namespace
const BaseSignatureChecker& DummySignatureCreator::Checker() const
{
diff --git a/src/script/standard.cpp b/src/script/standard.cpp
index 63f20b0993..d08c8821d4 100644
--- a/src/script/standard.cpp
+++ b/src/script/standard.cpp
@@ -273,7 +273,7 @@ public:
return true;
}
};
-}
+} // namespace
CScript GetScriptForDestination(const CTxDestination& dest)
{
diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp
index 31ed1a50b9..850b983c45 100644
--- a/src/test/coins_tests.cpp
+++ b/src/test/coins_tests.cpp
@@ -88,7 +88,7 @@ public:
size_t& usage() { return cachedCoinsUsage; }
};
-}
+} // namespace
BOOST_FIXTURE_TEST_SUITE(coins_tests, BasicTestingSetup)
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp
index 343c645cb1..7601034791 100644
--- a/src/test/script_tests.cpp
+++ b/src/test/script_tests.cpp
@@ -468,7 +468,7 @@ std::string JSONPrettyPrint(const UniValue& univalue)
}
return ret;
}
-}
+} // namespace
BOOST_AUTO_TEST_CASE(script_build)
{
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index ac842da6bf..ac5bfd0075 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -776,7 +776,7 @@ public:
return counta < countb;
}
};
-}
+} // namespace
std::vector<CTxMemPool::indexed_transaction_set::const_iterator> CTxMemPool::GetSortedDepthAndScore() const
{
diff --git a/src/validation.cpp b/src/validation.cpp
index 6c60be45a1..3198a75297 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 8a7cce7485..6e74a1657c 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)
{