Skip to content

Commit f3f1e2e

Browse files
committed
Merge #9544: [trivial] Add end of namespace comments. Improve consistency.
5a9b508 [trivial] Add end of namespace comments (practicalswift) Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
2 parents d609fd8 + 5a9b508 commit f3f1e2e

20 files changed

+37
-22
lines changed

doc/developer-notes.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public:
6868
return true;
6969
}
7070
}
71-
}
71+
} // namespace foo
7272
```
7373
7474
Doxygen comments
@@ -438,6 +438,21 @@ Source code organization
438438
439439
- *Rationale*: Avoids symbol conflicts
440440
441+
- Terminate namespaces with a comment (`// namespace mynamespace`). The comment
442+
should be placed on the same line as the brace closing the namespace, e.g.
443+
444+
```c++
445+
namespace mynamespace {
446+
...
447+
} // namespace mynamespace
448+
449+
namespace {
450+
...
451+
} // namespace
452+
```
453+
454+
- *Rationale*: Avoids confusion about the namespace context
455+
441456
GUI
442457
-----
443458

src/base58.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class CBitcoinAddressVisitor : public boost::static_visitor<bool>
225225
bool operator()(const CNoDestination& no) const { return false; }
226226
};
227227

228-
} // anon namespace
228+
} // namespace
229229

230230
bool CBitcoinAddress::Set(const CKeyID& id)
231231
{

src/bench/checkblock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace block_bench {
1313
#include "bench/data/block413567.raw.h"
14-
}
14+
} // namespace block_bench
1515

1616
// These are the two major time-sinks which happen after we have fully received
1717
// a block off the wire, but before we can relay the block on to peers using

src/compat/glibc_sanity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool sanity_test_fdelt()
5656
}
5757
#endif
5858

59-
} // anon namespace
59+
} // namespace
6060

6161
bool glibc_sanity_test()
6262
{

src/compat/glibcxx_sanity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bool sanity_test_list(unsigned int size)
3838
return true;
3939
}
4040

41-
} // anon namespace
41+
} // namespace
4242

4343
// trigger: string::at(x) on an empty string to trigger __throw_out_of_range_fmt.
4444
// test: force std::string to throw an out_of_range exception. Verify that

src/dbwrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,4 @@ const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w)
209209
return w.obfuscate_key;
210210
}
211211

212-
};
212+
} // namespace dbwrapper_private

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ int nUserMaxConnections;
822822
int nFD;
823823
ServiceFlags nLocalServices = NODE_NETWORK;
824824

825-
}
825+
} // namespace
826826

827827
[[noreturn]] static void new_handler_terminate()
828828
{

src/net_processing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ namespace {
120120
MapRelay mapRelay;
121121
/** Expiration-time ordered list of (expire time, relay map entry) pairs, protected by cs_main). */
122122
std::deque<std::pair<int64_t, MapRelay::iterator>> vRelayExpiration;
123-
} // anon namespace
123+
} // namespace
124124

125125
//////////////////////////////////////////////////////////////////////////////
126126
//
@@ -559,7 +559,7 @@ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<con
559559
}
560560
}
561561

562-
} // anon namespace
562+
} // namespace
563563

564564
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) {
565565
LOCK(cs_main);

src/protocol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const char *SENDCMPCT="sendcmpct";
3939
const char *CMPCTBLOCK="cmpctblock";
4040
const char *GETBLOCKTXN="getblocktxn";
4141
const char *BLOCKTXN="blocktxn";
42-
};
42+
} // namespace NetMsgType
4343

4444
/** All known message types. Keep this in the same order as the list of
4545
* messages above and in protocol.h.

src/pubkey.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace
1111
{
1212
/* Global secp256k1_context object used for verification. */
1313
secp256k1_context* secp256k1_context_verify = NULL;
14-
}
14+
} // namespace
1515

1616
/** This function is taken from the libsecp256k1 distribution and implements
1717
* DER parsing for ECDSA signatures, while supporting an arbitrary subset of

0 commit comments

Comments
 (0)