Skip to content

Commit

Permalink
Merge bitcoin#9544: [trivial] Add end of namespace comments. Improve …
Browse files Browse the repository at this point in the history
…consistency.

5a9b508 [trivial] Add end of namespace comments (practicalswift)

Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
  • Loading branch information
laanwj committed Jun 26, 2017
2 parents d609fd8 + 5a9b508 commit f3f1e2e
Show file tree
Hide file tree
Showing 20 changed files with 37 additions and 22 deletions.
17 changes: 16 additions & 1 deletion doc/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public:
return true;
}
}
}
} // namespace foo
```
Doxygen comments
Expand Down Expand Up @@ -438,6 +438,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
-----

Expand Down
2 changes: 1 addition & 1 deletion src/base58.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class CBitcoinAddressVisitor : public boost::static_visitor<bool>
bool operator()(const CNoDestination& no) const { return false; }
};

} // anon namespace
} // namespace

bool CBitcoinAddress::Set(const CKeyID& id)
{
Expand Down
2 changes: 1 addition & 1 deletion src/bench/checkblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/compat/glibc_sanity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ bool sanity_test_fdelt()
}
#endif

} // anon namespace
} // namespace

bool glibc_sanity_test()
{
Expand Down
2 changes: 1 addition & 1 deletion src/compat/glibcxx_sanity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dbwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,4 @@ const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w)
return w.obfuscate_key;
}

};
} // namespace dbwrapper_private
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ int nUserMaxConnections;
int nFD;
ServiceFlags nLocalServices = NODE_NETWORK;

}
} // namespace

[[noreturn]] static void new_handler_terminate()
{
Expand Down
4 changes: 2 additions & 2 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,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

//////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -559,7 +559,7 @@ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<con
}
}

} // anon namespace
} // namespace

bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) {
LOCK(cs_main);
Expand Down
2 changes: 1 addition & 1 deletion src/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/pubkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/script/bitcoinconsensus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/script/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ inline bool set_error(ScriptError* ret, const ScriptError serror)
return false;
}

} // anon namespace
} // namespace

bool CastToBool(const valtype& vch)
{
Expand Down Expand Up @@ -1164,7 +1164,7 @@ uint256 GetOutputsHash(const CTransaction& txTo) {
return ss.GetHash();
}

} // anon namespace
} // namespace

PrecomputedTransactionData::PrecomputedTransactionData(const CTransaction& txTo)
{
Expand Down
2 changes: 1 addition & 1 deletion src/script/sigcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class CSignatureCache
* signatureCache could be made local to VerifySignature.
*/
static CSignatureCache signatureCache;
}
} // namespace

// To be called once in AppInitMain/BasicTestingSetup to initialize the
// signatureCache.
Expand Down
2 changes: 1 addition & 1 deletion src/script/sign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class DummySignatureChecker : public BaseSignatureChecker
}
};
const DummySignatureChecker dummyChecker;
}
} // namespace

const BaseSignatureChecker& DummySignatureCreator::Checker() const
{
Expand Down
2 changes: 1 addition & 1 deletion src/script/standard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class CScriptVisitor : public boost::static_visitor<bool>
return true;
}
};
}
} // namespace

CScript GetScriptForDestination(const CTxDestination& dest)
{
Expand Down
2 changes: 1 addition & 1 deletion src/test/coins_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class CCoinsViewCacheTest : public CCoinsViewCache
size_t& usage() { return cachedCoinsUsage; }
};

}
} // namespace

BOOST_FIXTURE_TEST_SUITE(coins_tests, BasicTestingSetup)

Expand Down
2 changes: 1 addition & 1 deletion src/test/script_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ std::string JSONPrettyPrint(const UniValue& univalue)
}
return ret;
}
}
} // namespace

BOOST_AUTO_TEST_CASE(script_build)
{
Expand Down
2 changes: 1 addition & 1 deletion src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ class DepthAndScoreComparator
return counta < countb;
}
};
}
} // namespace

std::vector<CTxMemPool::indexed_transaction_set::const_iterator> CTxMemPool::GetSortedDepthAndScore() const
{
Expand Down
2 changes: 1 addition & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ bool AbortNode(CValidationState& state, const std::string& strMessage, const std
return state.Error(strMessage);
}

} // anon namespace
} // namespace

enum DisconnectResult
{
Expand Down
2 changes: 1 addition & 1 deletion src/versionbits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class VersionBitsConditionChecker : public AbstractThresholdConditionChecker {
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)
{
Expand Down

0 comments on commit f3f1e2e

Please sign in to comment.