|
We find the following hits in the community repo:
find src/mongo -name "*.h" | xargs grep 'namespace {$' | sort
|
src/mongo/db/catalog/private/record_store_validate_adaptor.h:namespace {
|
src/mongo/db/storage/record_store_test_docwriter.h:namespace {
|
src/mongo/platform/decimal128_bson_test.h:namespace {
|
src/mongo/util/dns_query_android-impl.h:namespace {
|
src/mongo/util/dns_query_posix-impl.h:namespace {
|
src/mongo/util/dns_query_windows-impl.h:namespace {
|
src/mongo/util/log.h:namespace {
|
We find no hits in the enterprise repo for that search. However, none of the community hits are real issues. Going file by file:
- The record_store_validate_adaptor.h header is included in more than one place, but only has a `using` within the unnamed namespace, which is meaningless and can be de-wrapped.
- The record_store_test_docwriter.h header is only included from .cpp files.
- The decimal128_bson_test.h file is only used in tests and only included from .cpp files.
- All three dns_query... header files are only included from .cpp files and have whitelisting to ensure they are not misused.
- The util/log.h header is similarly only permitted to be included from .cpp files and has an appropriate whitelist.
In the interest of avoiding cargo-culting of this dangerous pattern into more places, we should fix up the first three.
|