diff options
73 files changed, 413 insertions, 208 deletions
diff --git a/.clang-tidy.in b/.clang-tidy.in index a6f0c3627e6..ee55c2c3420 100644 --- a/.clang-tidy.in +++ b/.clang-tidy.in @@ -33,7 +33,7 @@ Checks: '-*, modernize-replace-random-shuffle, modernize-shrink-to-fit, modernize-unary-static-assert, - mongo-uninterruptible-lock-guard-check, + mongo-header-bracket-check, performance-faster-string-find, performance-implicit-conversion-in-loop, performance-inefficient-algorithm, @@ -116,6 +116,8 @@ HeaderFilterRegex: '(mongo/.*|@MONGO_BUILD_DIR@/.*)' CheckOptions: - key: bugprone-assert-side-effect.AssertMacros value: assert + - key: mongo-header-bracket-check.mongoSourceDirs + value: 'src/mongo;@MONGO_BUILD_DIR@' - key: bugprone-assert-side-effect.CheckFunctionCalls value: '0' - key: bugprone-dangling-handle.HandleClasses diff --git a/buildscripts/clang_tidy.py b/buildscripts/clang_tidy.py index b62c1be7fe0..4f099248a3b 100755 --- a/buildscripts/clang_tidy.py +++ b/buildscripts/clang_tidy.py @@ -182,10 +182,10 @@ def main(): files_to_parse = list() for file_doc in compile_commands: # A few special cases of files to ignore - if not "src/mongo" in file_doc["file"]: + if not file_doc["file"].startswith("src/mongo/"): continue # TODO SERVER-49884 Remove this when we no longer check in generated Bison. - if "parser_gen.cpp" in file_doc["file"]: + if file_doc["file"].endswith("/parser_gen.cpp"): continue files_to_tidy.append(Path(file_doc["file"])) diff --git a/buildscripts/linter/simplecpplint.py b/buildscripts/linter/simplecpplint.py index feff202a3d9..8c7d775573c 100644 --- a/buildscripts/linter/simplecpplint.py +++ b/buildscripts/linter/simplecpplint.py @@ -388,8 +388,9 @@ class Linter: return norm_file_name = self.file_name.replace('\\', '/') + # Custom clang-tidy check tests purposefully produce errors for - # tests to find, they should be ignored. + # tests to find. They should be ignored. if "mongo_tidy_checks/tests/" in norm_file_name: return diff --git a/src/mongo/bson/util/simple8b_bm.cpp b/src/mongo/bson/util/simple8b_bm.cpp index 89849e2acfc..892d542f559 100644 --- a/src/mongo/bson/util/simple8b_bm.cpp +++ b/src/mongo/bson/util/simple8b_bm.cpp @@ -27,7 +27,6 @@ * it in the license file. */ -#include "third_party/benchmark/dist/include/benchmark/benchmark.h" #include <benchmark/benchmark.h> #include "mongo/bson/util/simple8b.h" diff --git a/src/mongo/client/sdam/topology_description.h b/src/mongo/client/sdam/topology_description.h index 88da2d8b388..41a39f88492 100644 --- a/src/mongo/client/sdam/topology_description.h +++ b/src/mongo/client/sdam/topology_description.h @@ -28,12 +28,12 @@ */ #pragma once + +#include <boost/optional/optional.hpp> #include <memory> #include <string> #include <unordered_set> -#include "boost/optional/optional.hpp" - #include "mongo/bson/oid.h" #include "mongo/client/read_preference.h" #include "mongo/client/sdam/election_id_set_version_pair.h" diff --git a/src/mongo/crypto/symmetric_key.h b/src/mongo/crypto/symmetric_key.h index ababefddf2c..8bf9ae4e491 100644 --- a/src/mongo/crypto/symmetric_key.h +++ b/src/mongo/crypto/symmetric_key.h @@ -31,10 +31,10 @@ #include <cstdint> #include <memory> +#include <third_party/murmurhash3/MurmurHash3.h> #include "mongo/base/secure_allocator.h" #include "mongo/platform/atomic_word.h" -#include "third_party/murmurhash3/MurmurHash3.h" namespace mongo { class Status; diff --git a/src/mongo/db/auth/security_file.cpp b/src/mongo/db/auth/security_file.cpp index 8f2d103c7b5..9539eb958c0 100644 --- a/src/mongo/db/auth/security_file.cpp +++ b/src/mongo/db/auth/security_file.cpp @@ -27,20 +27,17 @@ * it in the license file. */ -#include "mongo/platform/basic.h" - -#include "mongo/db/auth/security_key.h" #include <algorithm> #include <string> #include <sys/stat.h> #include <vector> +#include <yaml-cpp/yaml.h> #include "mongo/base/status_with.h" +#include "mongo/db/auth/security_key.h" #include "mongo/util/str.h" -#include "yaml-cpp/yaml.h" - namespace mongo { namespace { std::string stripString(const std::string& filename, const std::string& str) { diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp index 03347fc9302..d8341637222 100644 --- a/src/mongo/db/exec/geo_near.cpp +++ b/src/mongo/db/exec/geo_near.cpp @@ -30,13 +30,11 @@ #include "mongo/db/exec/geo_near.h" -#include "mongo/logv2/log.h" +#include <algorithm> #include <memory> +#include <third_party/s2/s2regionintersection.h> // For s2 search #include <vector> -// For s2 search -#include "third_party/s2/s2regionintersection.h" - #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/exec/document_value/value.h" #include "mongo/db/exec/fetch.h" @@ -47,8 +45,8 @@ #include "mongo/db/matcher/expression.h" #include "mongo/db/query/expression_index.h" #include "mongo/db/query/expression_index_knobs_gen.h" +#include "mongo/logv2/log.h" -#include <algorithm> #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kQuery diff --git a/src/mongo/db/exec/geo_near.h b/src/mongo/db/exec/geo_near.h index d29d7536bea..eb1b9bbf859 100644 --- a/src/mongo/db/exec/geo_near.h +++ b/src/mongo/db/exec/geo_near.h @@ -29,6 +29,8 @@ #pragma once +#include <third_party/s2/s2cellunion.h> + #include "mongo/db/exec/index_scan.h" #include "mongo/db/exec/near.h" #include "mongo/db/exec/plan_stats.h" @@ -40,7 +42,7 @@ #include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression_geo.h" #include "mongo/db/query/index_bounds.h" -#include "third_party/s2/s2cellunion.h" + namespace mongo { diff --git a/src/mongo/db/exec/working_set.h b/src/mongo/db/exec/working_set.h index 31b7e82ab78..13688799b3b 100644 --- a/src/mongo/db/exec/working_set.h +++ b/src/mongo/db/exec/working_set.h @@ -29,7 +29,7 @@ #pragma once -#include "boost/optional.hpp" +#include <boost/optional.hpp> #include <vector> #include "mongo/db/exec/document_value/document.h" diff --git a/src/mongo/db/fle_crud.h b/src/mongo/db/fle_crud.h index 290bf4a7742..eb58ceadb7a 100644 --- a/src/mongo/db/fle_crud.h +++ b/src/mongo/db/fle_crud.h @@ -29,10 +29,9 @@ #pragma once +#include <boost/smart_ptr/intrusive_ptr.hpp> #include <cstdint> -#include "boost/smart_ptr/intrusive_ptr.hpp" - #include "mongo/bson/bsonobj.h" #include "mongo/bson/oid.h" #include "mongo/crypto/fle_crypto.h" diff --git a/src/mongo/db/fle_crud_test.cpp b/src/mongo/db/fle_crud_test.cpp index a24ef102902..3267433a989 100644 --- a/src/mongo/db/fle_crud_test.cpp +++ b/src/mongo/db/fle_crud_test.cpp @@ -27,17 +27,15 @@ * it in the license file. */ -#include "mongo/platform/basic.h" #include <algorithm> #include <array> +#include <boost/smart_ptr/intrusive_ptr.hpp> #include <string> #include <third_party/murmurhash3/MurmurHash3.h> #include <unordered_map> #include <vector> -#include "boost/smart_ptr/intrusive_ptr.hpp" - #include "mongo/base/data_range.h" #include "mongo/base/error_codes.h" #include "mongo/base/string_data.h" diff --git a/src/mongo/db/fts/stemmer.h b/src/mongo/db/fts/stemmer.h index e3608071010..3294e9e1d97 100644 --- a/src/mongo/db/fts/stemmer.h +++ b/src/mongo/db/fts/stemmer.h @@ -30,9 +30,11 @@ #pragma once +#include <third_party/libstemmer_c/include/libstemmer.h> + #include "mongo/base/string_data.h" #include "mongo/db/fts/fts_language.h" -#include "third_party/libstemmer_c/include/libstemmer.h" + namespace mongo { diff --git a/src/mongo/db/geo/big_polygon.h b/src/mongo/db/geo/big_polygon.h index e7a38ecaf0e..af64ef7c0f4 100644 --- a/src/mongo/db/geo/big_polygon.h +++ b/src/mongo/db/geo/big_polygon.h @@ -29,15 +29,15 @@ #pragma once +#include <third_party/s2/s2cap.h> +#include <third_party/s2/s2cell.h> +#include <third_party/s2/s2loop.h> +#include <third_party/s2/s2polygon.h> +#include <third_party/s2/s2polyline.h> +#include <third_party/s2/s2region.h> #include <vector> #include "mongo/db/geo/s2.h" -#include "third_party/s2/s2cap.h" -#include "third_party/s2/s2cell.h" -#include "third_party/s2/s2loop.h" -#include "third_party/s2/s2polygon.h" -#include "third_party/s2/s2polyline.h" -#include "third_party/s2/s2region.h" namespace mongo { diff --git a/src/mongo/db/geo/geometry_container.h b/src/mongo/db/geo/geometry_container.h index 849996e9244..aa9bd0c15de 100644 --- a/src/mongo/db/geo/geometry_container.h +++ b/src/mongo/db/geo/geometry_container.h @@ -30,11 +30,12 @@ #pragma once #include <string> +#include <third_party/s2/s2regionunion.h> #include "mongo/base/clonable_ptr.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/geo/shapes.h" -#include "third_party/s2/s2regionunion.h" + namespace mongo { diff --git a/src/mongo/db/geo/geoparser.cpp b/src/mongo/db/geo/geoparser.cpp index 893d7832b18..3d2694c4c5d 100644 --- a/src/mongo/db/geo/geoparser.cpp +++ b/src/mongo/db/geo/geoparser.cpp @@ -33,6 +33,7 @@ #include <cmath> #include <memory> #include <string> +#include <third_party/s2/s2polygonbuilder.h> #include <vector> #include "mongo/db/bson/dotted_path_support.h" @@ -40,7 +41,6 @@ #include "mongo/db/jsobj.h" #include "mongo/util/str.h" #include "mongo/util/transitional_tools_do_not_use/vector_spooling.h" -#include "third_party/s2/s2polygonbuilder.h" #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kGeo diff --git a/src/mongo/db/geo/s2.h b/src/mongo/db/geo/s2.h index d497eb7d67f..3f1b77158d5 100644 --- a/src/mongo/db/geo/s2.h +++ b/src/mongo/db/geo/s2.h @@ -38,7 +38,7 @@ #pragma GCC diagnostic ignored "-Wmismatched-tags" #endif -#include "third_party/s2/s2.h" +#include <third_party/s2/s2.h> #ifdef __clang__ #pragma GCC diagnostic pop diff --git a/src/mongo/db/geo/shapes.h b/src/mongo/db/geo/shapes.h index 9bfa711adb4..30a75a4e574 100644 --- a/src/mongo/db/geo/shapes.h +++ b/src/mongo/db/geo/shapes.h @@ -31,17 +31,17 @@ #include <cmath> #include <string> +#include <third_party/s2/s2cap.h> +#include <third_party/s2/s2cell.h> +#include <third_party/s2/s2latlng.h> +#include <third_party/s2/s2polygon.h> +#include <third_party/s2/s2polyline.h> #include <vector> #include "mongo/base/clonable_ptr.h" #include "mongo/db/geo/big_polygon.h" #include "mongo/db/geo/s2.h" #include "mongo/db/jsobj.h" -#include "third_party/s2/s2cap.h" -#include "third_party/s2/s2cell.h" -#include "third_party/s2/s2latlng.h" -#include "third_party/s2/s2polygon.h" -#include "third_party/s2/s2polyline.h" #ifndef M_PI #define M_PI 3.14159265358979323846 diff --git a/src/mongo/db/index/expression_keys_private.cpp b/src/mongo/db/index/expression_keys_private.cpp index 5463cc9de8d..8f8d857c9c3 100644 --- a/src/mongo/db/index/expression_keys_private.cpp +++ b/src/mongo/db/index/expression_keys_private.cpp @@ -30,6 +30,8 @@ #include "mongo/db/index/expression_keys_private.h" +#include <third_party/s2/s2cell.h> +#include <third_party/s2/s2regioncoverer.h> #include <utility> #include "mongo/bson/bsonelement_comparator_interface.h" @@ -53,9 +55,6 @@ #include "mongo/util/assert_util.h" #include "mongo/util/str.h" -#include "third_party/s2/s2cell.h" -#include "third_party/s2/s2regioncoverer.h" - #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kIndex diff --git a/src/mongo/db/index/expression_params.cpp b/src/mongo/db/index/expression_params.cpp index ddd7a500056..5464b628a4c 100644 --- a/src/mongo/db/index/expression_params.cpp +++ b/src/mongo/db/index/expression_params.cpp @@ -29,6 +29,8 @@ #include "mongo/db/index/expression_params.h" +#include <third_party/s2/s2.h> + #include "mongo/bson/util/bson_extract.h" #include "mongo/db/geo/geoconstants.h" #include "mongo/db/hasher.h" @@ -36,7 +38,6 @@ #include "mongo/db/index/s2_common.h" #include "mongo/db/index_names.h" #include "mongo/util/str.h" -#include "third_party/s2/s2.h" namespace mongo { diff --git a/src/mongo/db/index/s2_bucket_key_generator_test.cpp b/src/mongo/db/index/s2_bucket_key_generator_test.cpp index 11a3515a6a2..b73bf0fb010 100644 --- a/src/mongo/db/index/s2_bucket_key_generator_test.cpp +++ b/src/mongo/db/index/s2_bucket_key_generator_test.cpp @@ -28,17 +28,13 @@ */ -#include "mongo/platform/basic.h" - -#include "mongo/db/index/expression_keys_private.h" - #include <algorithm> - -#include "third_party/s2/s2cell.h" -#include "third_party/s2/s2latlng.h" +#include <third_party/s2/s2cell.h> +#include <third_party/s2/s2latlng.h> #include "mongo/bson/bsonobjbuilder.h" #include "mongo/bson/simple_bsonobj_comparator.h" +#include "mongo/db/index/expression_keys_private.h" #include "mongo/db/index/expression_params.h" #include "mongo/db/index/s2_common.h" #include "mongo/db/json.h" diff --git a/src/mongo/db/index/s2_common.cpp b/src/mongo/db/index/s2_common.cpp index 5b9ac7e005f..fe4ab60c1bd 100644 --- a/src/mongo/db/index/s2_common.cpp +++ b/src/mongo/db/index/s2_common.cpp @@ -30,12 +30,12 @@ #include "mongo/db/index/s2_common.h" #include <cstdlib> +#include <third_party/s2/s2cellid.h> +#include <third_party/s2/s2regioncoverer.h> #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/geo/geometry_container.h" #include "mongo/db/query/collation/collator_interface.h" -#include "third_party/s2/s2cellid.h" -#include "third_party/s2/s2regioncoverer.h" namespace mongo { diff --git a/src/mongo/db/matcher/expression_internal_bucket_geo_within.cpp b/src/mongo/db/matcher/expression_internal_bucket_geo_within.cpp index 860384bf102..b76c2f85c58 100644 --- a/src/mongo/db/matcher/expression_internal_bucket_geo_within.cpp +++ b/src/mongo/db/matcher/expression_internal_bucket_geo_within.cpp @@ -29,8 +29,9 @@ #include <boost/optional.hpp> - -#include "mongo/platform/basic.h" +#include <third_party/s2/s2cellid.h> +#include <third_party/s2/s2cellunion.h> +#include <third_party/s2/s2regioncoverer.h> #include "mongo/bson/bsonobj.h" #include "mongo/db/bson/dotted_path_support.h" @@ -39,9 +40,6 @@ #include "mongo/db/pipeline/field_path.h" #include "mongo/db/timeseries/timeseries_constants.h" -#include "third_party/s2/s2cellid.h" -#include "third_party/s2/s2cellunion.h" -#include "third_party/s2/s2regioncoverer.h" namespace mongo { constexpr StringData InternalBucketGeoWithinMatchExpression::kName; diff --git a/src/mongo/db/query/expression_index.cpp b/src/mongo/db/query/expression_index.cpp index 5ca2dfce2d1..450a3bdf561 100644 --- a/src/mongo/db/query/expression_index.cpp +++ b/src/mongo/db/query/expression_index.cpp @@ -31,6 +31,9 @@ #include "mongo/db/query/expression_index.h" #include <iostream> +#include <third_party/s2/s2cellid.h> +#include <third_party/s2/s2region.h> +#include <third_party/s2/s2regioncoverer.h> #include <unordered_set> #include "mongo/db/geo/geoconstants.h" @@ -39,9 +42,6 @@ #include "mongo/db/index/expression_params.h" #include "mongo/db/query/expression_index_knobs_gen.h" #include "mongo/logv2/log.h" -#include "third_party/s2/s2cellid.h" -#include "third_party/s2/s2region.h" -#include "third_party/s2/s2regioncoverer.h" #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kQuery diff --git a/src/mongo/db/query/index_bounds_builder.cpp b/src/mongo/db/query/index_bounds_builder.cpp index d87cd5f1667..8cc114cad35 100644 --- a/src/mongo/db/query/index_bounds_builder.cpp +++ b/src/mongo/db/query/index_bounds_builder.cpp @@ -32,6 +32,8 @@ #include <cmath> #include <limits> +#include <third_party/s2/s2cell.h> +#include <third_party/s2/s2regioncoverer.h> #include "mongo/base/string_data.h" #include "mongo/bson/bsontypes.h" @@ -52,8 +54,6 @@ #include "mongo/db/query/planner_wildcard_helpers.h" #include "mongo/db/query/query_knobs_gen.h" #include "mongo/logv2/log.h" -#include "third_party/s2/s2cell.h" -#include "third_party/s2/s2regioncoverer.h" #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kQuery diff --git a/src/mongo/db/query/optimizer/bool_expression.h b/src/mongo/db/query/optimizer/bool_expression.h index 502c161a565..b6dd517c203 100644 --- a/src/mongo/db/query/optimizer/bool_expression.h +++ b/src/mongo/db/query/optimizer/bool_expression.h @@ -30,7 +30,7 @@ #pragma once -#include "boost/optional.hpp" +#include <boost/optional.hpp> #include <vector> #include "mongo/db/query/optimizer/algebra/operator.h" diff --git a/src/mongo/db/query/serialization_options.h b/src/mongo/db/query/serialization_options.h index 301617a8768..9ab6fbc1c33 100644 --- a/src/mongo/db/query/serialization_options.h +++ b/src/mongo/db/query/serialization_options.h @@ -29,8 +29,9 @@ #pragma once +#include <boost/optional.hpp> + #include "mongo/base/string_data.h" -#include "third_party/boost/boost/optional.hpp" namespace mongo { diff --git a/src/mongo/db/repl/tenant_file_importer_service.h b/src/mongo/db/repl/tenant_file_importer_service.h index 95184f68618..6741aa11519 100644 --- a/src/mongo/db/repl/tenant_file_importer_service.h +++ b/src/mongo/db/repl/tenant_file_importer_service.h @@ -29,7 +29,7 @@ #pragma once -#include "boost/optional/optional.hpp" +#include <boost/optional/optional.hpp> #include "mongo/client/dbclient_connection.h" #include "mongo/db/operation_context.h" diff --git a/src/mongo/db/s/migration_batch_inserter.h b/src/mongo/db/s/migration_batch_inserter.h index 47f8a598e74..342a713d55b 100644 --- a/src/mongo/db/s/migration_batch_inserter.h +++ b/src/mongo/db/s/migration_batch_inserter.h @@ -27,7 +27,10 @@ * it in the license file. */ -#include "boost/optional/optional.hpp" +#pragma once + +#include <boost/optional/optional.hpp> + #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/cancelable_operation_context.h" #include "mongo/db/catalog/document_validation.h" @@ -47,8 +50,6 @@ #include "mongo/s/grid.h" #include "mongo/util/uuid.h" -#pragma once - namespace mongo { // The purpose of this type is to allow inserters to communicate diff --git a/src/mongo/db/s/sharding_runtime_d_params.h b/src/mongo/db/s/sharding_runtime_d_params.h index 49838a2ca6c..7dc3c253343 100644 --- a/src/mongo/db/s/sharding_runtime_d_params.h +++ b/src/mongo/db/s/sharding_runtime_d_params.h @@ -29,7 +29,8 @@ #pragma once -#include "fmt/core.h" +#include <fmt/core.h> + #include "mongo/base/status.h" #include "mongo/db/commands/test_commands_enabled.h" #include "mongo/s/sharding_feature_flags_gen.h" diff --git a/src/mongo/db/timeseries/timeseries_dotted_path_support.h b/src/mongo/db/timeseries/timeseries_dotted_path_support.h index fa2ebba941b..b9a35b8cb3e 100644 --- a/src/mongo/db/timeseries/timeseries_dotted_path_support.h +++ b/src/mongo/db/timeseries/timeseries_dotted_path_support.h @@ -29,7 +29,7 @@ #pragma once -#include "boost/any.hpp" +#include <boost/any.hpp> #include <cstddef> #include "mongo/bson/bsonelement_comparator_interface.h" diff --git a/src/mongo/db/update/document_diff_calculator.h b/src/mongo/db/update/document_diff_calculator.h index f1850a34e03..6eb5b603c49 100644 --- a/src/mongo/db/update/document_diff_calculator.h +++ b/src/mongo/db/update/document_diff_calculator.h @@ -29,7 +29,7 @@ #pragma once -#include "boost/dynamic_bitset.hpp" +#include <boost/dynamic_bitset.hpp> #include "mongo/bson/bsonobj.h" #include "mongo/db/update/document_diff_serialization.h" diff --git a/src/mongo/logv2/log_util.h b/src/mongo/logv2/log_util.h index 09505e02d94..ffa24897a1f 100644 --- a/src/mongo/logv2/log_util.h +++ b/src/mongo/logv2/log_util.h @@ -32,8 +32,9 @@ #include <functional> #include <boost/optional.hpp> -#include <mongo/base/status.h> -#include <mongo/base/string_data.h> + +#include "mongo/base/status.h" +#include "mongo/base/string_data.h" namespace mongo::logv2 { diff --git a/src/mongo/platform/mutex.h b/src/mongo/platform/mutex.h index ed9ddab42ad..94361dd938e 100644 --- a/src/mongo/platform/mutex.h +++ b/src/mongo/platform/mutex.h @@ -29,12 +29,11 @@ #pragma once +#include <boost/optional.hpp> #include <memory> #include <type_traits> #include <vector> -#include "boost/optional.hpp" - #include "mongo/base/error_codes.h" #include "mongo/base/string_data.h" #include "mongo/config.h" diff --git a/src/mongo/rpc/metadata/impersonated_user_metadata.h b/src/mongo/rpc/metadata/impersonated_user_metadata.h index 71c927e80b1..fb03cd740d6 100644 --- a/src/mongo/rpc/metadata/impersonated_user_metadata.h +++ b/src/mongo/rpc/metadata/impersonated_user_metadata.h @@ -29,7 +29,7 @@ #pragma once -#include "boost/optional.hpp" +#include <boost/optional.hpp> #include "mongo/db/operation_context.h" #include "mongo/rpc/metadata/impersonated_user_metadata_gen.h" diff --git a/src/mongo/rpc/op_msg_test.h b/src/mongo/rpc/op_msg_test.h index 38cb4979b14..ea556e3d4a8 100644 --- a/src/mongo/rpc/op_msg_test.h +++ b/src/mongo/rpc/op_msg_test.h @@ -27,14 +27,15 @@ * it in the license file. */ -#include "mongo/platform/basic.h" +#pragma once +#include <third_party/wiredtiger/wiredtiger.h> #include <type_traits> #include "mongo/bson/bsonobj.h" #include "mongo/bson/util/builder.h" #include "mongo/rpc/op_msg.h" -#include "third_party/wiredtiger/wiredtiger.h" + namespace mongo { namespace rpc { diff --git a/src/mongo/scripting/mozjs/exception.cpp b/src/mongo/scripting/mozjs/exception.cpp index d0b07c72f7b..d7f3f2f6e40 100644 --- a/src/mongo/scripting/mozjs/exception.cpp +++ b/src/mongo/scripting/mozjs/exception.cpp @@ -27,19 +27,16 @@ * it in the license file. */ -#include "mongo/platform/basic.h" - #include "mongo/scripting/mozjs/exception.h" #include <js/friend/ErrorMessages.h> #include <jsfriendapi.h> #include <limits> - +#include <mongo/scripting/mozjs/mongoErrorReportToString.h> #include "mongo/base/static_assert.h" #include "mongo/scripting/mozjs/implscope.h" #include "mongo/scripting/mozjs/jsstringwrapper.h" -#include "mongo/scripting/mozjs/mongoErrorReportToString.h" #include "mongo/scripting/mozjs/objectwrapper.h" #include "mongo/scripting/mozjs/valuewriter.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/scripting/mozjs/implscope.h b/src/mongo/scripting/mozjs/implscope.h index 0e0ce3e32cb..82830420cb4 100644 --- a/src/mongo/scripting/mozjs/implscope.h +++ b/src/mongo/scripting/mozjs/implscope.h @@ -31,6 +31,7 @@ #include <jsapi.h> #include <jsfriendapi.h> +#include <mongo/scripting/mozjs/freeOpToJSContext.h> #include <vm/PosixNSPR.h> #include "mongo/client/dbclient_cursor.h" @@ -47,7 +48,6 @@ #include "mongo/scripting/mozjs/dbref.h" #include "mongo/scripting/mozjs/engine.h" #include "mongo/scripting/mozjs/error.h" -#include "mongo/scripting/mozjs/freeOpToJSContext.h" #include "mongo/scripting/mozjs/global.h" #include "mongo/scripting/mozjs/internedstring.h" #include "mongo/scripting/mozjs/jsthread.h" diff --git a/src/mongo/scripting/mozjs/proxyscope.h b/src/mongo/scripting/mozjs/proxyscope.h index afa05a3f93b..bd0d3953b61 100644 --- a/src/mongo/scripting/mozjs/proxyscope.h +++ b/src/mongo/scripting/mozjs/proxyscope.h @@ -29,7 +29,7 @@ #pragma once -#include "vm/PosixNSPR.h" +#include <vm/PosixNSPR.h> #include "mongo/client/dbclient_cursor.h" #include "mongo/platform/mutex.h" diff --git a/src/mongo/shell/program_runner.cpp b/src/mongo/shell/program_runner.cpp index 73a9296b8fe..8bccfb13ae0 100644 --- a/src/mongo/shell/program_runner.cpp +++ b/src/mongo/shell/program_runner.cpp @@ -27,11 +27,9 @@ * it in the license file. */ -#include "mongo/platform/basic.h" - #include "mongo/shell/program_runner.h" -#include "boost/filesystem/operations.hpp" +#include <boost/filesystem/operations.hpp> #include <boost/iostreams/device/file_descriptor.hpp> #include <boost/iostreams/stream.hpp> #include <boost/iostreams/stream_buffer.hpp> diff --git a/src/mongo/shell/program_runner.h b/src/mongo/shell/program_runner.h index ccb5add8235..e6730a2df15 100644 --- a/src/mongo/shell/program_runner.h +++ b/src/mongo/shell/program_runner.h @@ -29,7 +29,7 @@ #pragma once -#include "boost/filesystem/path.hpp" +#include <boost/filesystem/path.hpp> #include "mongo/bson/bsonobj.h" #include "mongo/db/service_context.h" diff --git a/src/mongo/stdx/variant.h b/src/mongo/stdx/variant.h index 154cc4bc144..b009190fd3a 100644 --- a/src/mongo/stdx/variant.h +++ b/src/mongo/stdx/variant.h @@ -29,7 +29,7 @@ #pragma once -#include "mpark/variant.hpp" +#include <mpark/variant.hpp> namespace mongo::stdx { diff --git a/src/mongo/tools/mongo_tidy_checks/MongoHeaderBracketCheck.cpp b/src/mongo/tools/mongo_tidy_checks/MongoHeaderBracketCheck.cpp new file mode 100644 index 00000000000..823206b7aaa --- /dev/null +++ b/src/mongo/tools/mongo_tidy_checks/MongoHeaderBracketCheck.cpp @@ -0,0 +1,137 @@ +/** + * Copyright (C) 2023-present MongoDB, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the Server Side Public License, version 1, + * as published by MongoDB, Inc. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Server Side Public License for more details. + * + * You should have received a copy of the Server Side Public License + * along with this program. If not, see + * <http://www.mongodb.com/licensing/server-side-public-license>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the Server Side Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + + +#include "MongoHeaderBracketCheck.h" + +#include <clang-tidy/utils/OptionsUtils.h> +#include <clang/Frontend/CompilerInstance.h> +#include <clang/Lex/PPCallbacks.h> +#include <clang/Lex/Preprocessor.h> +#include <filesystem> +#include <llvm/ADT/StringMap.h> +#include <llvm/ADT/StringSet.h> + +namespace mongo::tidy { + +namespace { + +bool startsWithAny(llvm::StringRef fullString, std::vector<std::string> const& startings) { + return std::any_of(startings.cbegin(), startings.cend(), [&](llvm::StringRef starting) { + return fullString.startswith(starting); + }); +} + +class MongoIncludeBracketsPPCallbacks : public clang::PPCallbacks { +public: + explicit MongoIncludeBracketsPPCallbacks(MongoHeaderBracketCheck& Check, + clang::LangOptions LangOpts, + const clang::SourceManager& SM) + : Check(Check), LangOpts(LangOpts), SM(SM) {} + + + void InclusionDirective(clang::SourceLocation HashLoc, + const clang::Token& IncludeTok, + llvm::StringRef FileName, + bool IsAngled, + clang::CharSourceRange FilenameRange, + const clang::FileEntry* File, + llvm::StringRef SearchPath, + llvm::StringRef RelativePath, + const clang::Module* Imported, + clang::SrcMgr::CharacteristicKind FileType) override { + + // This represents the full path from the project root directory + // to the header file that is being included. + std::filesystem::path header_path = + (std::filesystem::path(SearchPath.str()) / std::filesystem::path(RelativePath.str())) + .lexically_normal(); + + // This represents the full path from the project root to the + // source file that is including the include that is currently being processed. + std::filesystem::path origin_source_path(HashLoc.printToString(SM)); + if (origin_source_path.is_absolute()) { + origin_source_path = + std::filesystem::relative(origin_source_path, std::filesystem::current_path()); + } + + // if this is a mongo source file including a real file + if (!llvm::StringRef(origin_source_path).startswith("<built-in>:") && + startsWithAny(llvm::StringRef(origin_source_path.lexically_normal()), + Check.mongoSourceDirs)) { + + // Check that the a third party header which is included from a mongo source file + // is used angle brackets. + if (!IsAngled && !startsWithAny(llvm::StringRef(header_path), Check.mongoSourceDirs)) { + + std::string Replacement = (llvm::Twine("<") + FileName + ">").str(); + Check.diag(FilenameRange.getBegin(), + "non-mongo include '%0' should use angle brackets") + << FileName + << clang::FixItHint::CreateReplacement(FilenameRange.getAsRange(), Replacement); + } + + // Check that the a mongo header which is included from a mongo source file + // is used double quotes. + else if (IsAngled && + startsWithAny(llvm::StringRef(header_path), Check.mongoSourceDirs)) { + std::string Replacement = (llvm::Twine("\"") + FileName + "\"").str(); + Check.diag(FilenameRange.getBegin(), "mongo include '%0' should use double quotes") + << FileName + << clang::FixItHint::CreateReplacement(FilenameRange.getAsRange(), Replacement); + } + } + } + +private: + MongoHeaderBracketCheck& Check; + clang::LangOptions LangOpts; + const clang::SourceManager& SM; +}; + +} // namespace + +MongoHeaderBracketCheck::MongoHeaderBracketCheck(llvm::StringRef Name, + clang::tidy::ClangTidyContext* Context) + : ClangTidyCheck(Name, Context), + mongoSourceDirs(clang::tidy::utils::options::parseStringList( + Options.get("mongoSourceDirs", "src/mongo"))) {} + +void MongoHeaderBracketCheck::storeOptions(clang::tidy::ClangTidyOptions::OptionMap& Opts) { + Options.store( + Opts, "mongoSourceDirs", clang::tidy::utils::options::serializeStringList(mongoSourceDirs)); +} +void MongoHeaderBracketCheck::registerPPCallbacks(const clang::SourceManager& SM, + clang::Preprocessor* PP, + clang::Preprocessor* ModuleExpanderPP) { + PP->addPPCallbacks( + ::std::make_unique<MongoIncludeBracketsPPCallbacks>(*this, getLangOpts(), SM)); +} + +} // namespace mongo::tidy diff --git a/src/mongo/tools/mongo_tidy_checks/MongoHeaderBracketCheck.h b/src/mongo/tools/mongo_tidy_checks/MongoHeaderBracketCheck.h new file mode 100644 index 00000000000..fa905a96741 --- /dev/null +++ b/src/mongo/tools/mongo_tidy_checks/MongoHeaderBracketCheck.h @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2023-present MongoDB, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the Server Side Public License, version 1, + * as published by MongoDB, Inc. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Server Side Public License for more details. + * + * You should have received a copy of the Server Side Public License + * along with this program. If not, see + * <http://www.mongodb.com/licensing/server-side-public-license>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the Server Side Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ +#pragma once + +#include <clang-tidy/ClangTidy.h> +#include <clang-tidy/ClangTidyCheck.h> + +namespace mongo::tidy { + +/** + Overrides the default PPCallback class to primarly override + the InclusionDirective call which is called for each include included. This + allows the chance to evaluate specifically the include and determine whether + it is considered a "mongo" include or not and if it is using the appropriate include style. +*/ +class MongoHeaderBracketCheck : public clang::tidy::ClangTidyCheck { +public: + MongoHeaderBracketCheck(clang::StringRef Name, clang::tidy::ClangTidyContext* Context); + void storeOptions(clang::tidy::ClangTidyOptions::OptionMap& Opts) override; + void registerPPCallbacks(const clang::SourceManager& SM, + clang::Preprocessor* PP, + clang::Preprocessor* ModuleExpanderPP) override; + std::vector<std::string> mongoSourceDirs; +}; + +} // namespace mongo::tidy diff --git a/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp b/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp index 72cbbc89872..0f3fa29cea4 100644 --- a/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp +++ b/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.cpp @@ -26,16 +26,14 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -#include "MongoTestCheck.h" -#include "clang-tidy/ClangTidy.h" -#include "clang-tidy/ClangTidyCheck.h" -#include "clang/AST/ASTContext.h" -#include "clang/ASTMatchers/ASTMatchFinder.h" -using namespace clang; -using namespace clang::tidy; -using namespace clang::ast_matchers; +#include "MongoTestCheck.h" + +#include <clang-tidy/ClangTidy.h> +#include <clang-tidy/ClangTidyCheck.h> +#include <clang/AST/ASTContext.h> +#include <clang/ASTMatchers/ASTMatchFinder.h> // TODO SERVER-72150 // This is a dummy reference check to give example for writing new checks. @@ -44,15 +42,15 @@ using namespace clang::ast_matchers; namespace mongo { namespace tidy { -MongoTestCheck::MongoTestCheck(StringRef Name, ClangTidyContext* Context) +MongoTestCheck::MongoTestCheck(clang::StringRef Name, clang::tidy::ClangTidyContext* Context) : ClangTidyCheck(Name, Context) {} -void MongoTestCheck::registerMatchers(ast_matchers::MatchFinder* Finder) { - Finder->addMatcher(translationUnitDecl().bind("tu"), this); +void MongoTestCheck::registerMatchers(clang::ast_matchers::MatchFinder* Finder) { + Finder->addMatcher(clang::ast_matchers::translationUnitDecl().bind("tu"), this); } -void MongoTestCheck::check(const ast_matchers::MatchFinder::MatchResult& Result) { - auto S = Result.Nodes.getNodeAs<TranslationUnitDecl>("tu"); +void MongoTestCheck::check(const clang::ast_matchers::MatchFinder::MatchResult& Result) { + auto S = Result.Nodes.getNodeAs<clang::TranslationUnitDecl>("tu"); if (S) diag("ran mongo-test-check!"); } diff --git a/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.h b/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.h index af1dbca4684..1a79b7519e0 100644 --- a/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.h +++ b/src/mongo/tools/mongo_tidy_checks/MongoTestCheck.h @@ -26,28 +26,24 @@ * exception statement from all source files in the program, then also delete * it in the license file. */ -#pragma once -#include "clang-tidy/ClangTidy.h" -#include "clang-tidy/ClangTidyCheck.h" -#include "clang/AST/ASTContext.h" -#include "clang/ASTMatchers/ASTMatchFinder.h" -using namespace clang; -using namespace clang::tidy; -using namespace clang::ast_matchers; +#pragma once + +#include <clang-tidy/ClangTidy.h> +#include <clang-tidy/ClangTidyCheck.h> +#include <clang/AST/ASTContext.h> +#include <clang/ASTMatchers/ASTMatchFinder.h> namespace mongo { namespace tidy { -class MongoTestCheck : public ClangTidyCheck { +class MongoTestCheck : public clang::tidy::ClangTidyCheck { public: - MongoTestCheck(StringRef Name, ClangTidyContext* Context); - - void registerMatchers(ast_matchers::MatchFinder* Finder) override; - - void check(const ast_matchers::MatchFinder::MatchResult& Result) override; + MongoTestCheck(clang::StringRef Name, clang::tidy::ClangTidyContext* Context); + void registerMatchers(clang::ast_matchers::MatchFinder* Finder) override; + void check(const clang::ast_matchers::MatchFinder::MatchResult& Result) override; private: }; diff --git a/src/mongo/tools/mongo_tidy_checks/MongoTidyModule.cpp b/src/mongo/tools/mongo_tidy_checks/MongoTidyModule.cpp index e0191037cb2..02f5c70b3d3 100644 --- a/src/mongo/tools/mongo_tidy_checks/MongoTidyModule.cpp +++ b/src/mongo/tools/mongo_tidy_checks/MongoTidyModule.cpp @@ -27,6 +27,8 @@ * it in the license file. */ + +#include "MongoHeaderBracketCheck.h" #include "MongoTestCheck.h" #include "MongoUninterruptibleLockGuardCheck.h" @@ -38,18 +40,19 @@ namespace mongo { namespace tidy { -class MongoTidyModule : public ClangTidyModule { +class MongoTidyModule : public clang::tidy::ClangTidyModule { public: - void addCheckFactories(ClangTidyCheckFactories& CheckFactories) override { + void addCheckFactories(clang::tidy::ClangTidyCheckFactories& CheckFactories) override { CheckFactories.registerCheck<MongoUninterruptibleLockGuardCheck>( "mongo-uninterruptible-lock-guard-check"); + CheckFactories.registerCheck<MongoHeaderBracketCheck>("mongo-header-bracket-check"); CheckFactories.registerCheck<MongoTestCheck>("mongo-test-check"); } }; // Register the MongoTidyModule using this statically initialized variable. -static ClangTidyModuleRegistry::Add<MongoTidyModule> X("mongo-tidy-module", - "MongoDB custom checks."); +static clang::tidy::ClangTidyModuleRegistry::Add<MongoTidyModule> X("mongo-tidy-module", + "MongoDB custom checks."); } // namespace tidy diff --git a/src/mongo/tools/mongo_tidy_checks/SConscript b/src/mongo/tools/mongo_tidy_checks/SConscript index 5947c018f3a..f0518a7cb56 100644 --- a/src/mongo/tools/mongo_tidy_checks/SConscript +++ b/src/mongo/tools/mongo_tidy_checks/SConscript @@ -122,6 +122,7 @@ mongo_custom_check = env.SharedLibrary( target="mongo_tidy_checks", source=[ "MongoTestCheck.cpp", + "MongoHeaderBracketCheck.cpp", "MongoUninterruptibleLockGuardCheck.cpp", "MongoTidyModule.cpp", ], diff --git a/src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheck_unittest.py b/src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheck_unittest.py index 36de82dbd71..47690dbe0fb 100644 --- a/src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheck_unittest.py +++ b/src/mongo/tools/mongo_tidy_checks/tests/MongoTidyCheck_unittest.py @@ -21,7 +21,12 @@ class MongoTidyTests(unittest.TestCase): def run_clang_tidy(self): p = subprocess.run(self.cmd, capture_output=True, text=True) - passed = self.expected_output is not None and self.expected_output in p.stdout + + if isinstance(self.expected_output, list): + passed = all([expected_output in p.stdout for expected_output in self.expected_output]) + else: + passed = self.expected_output is not None and self.expected_output in p.stdout + with open(self.config_file.name) as f: msg = '\n'.join([ '>' * 80, @@ -90,6 +95,21 @@ class MongoTidyTests(unittest.TestCase): self.run_clang_tidy() + def test_MongoHeaderBracketCheck(self): + + self.write_config( + textwrap.dedent("""\ + Checks: '-*,mongo-header-bracket-check' + WarningsAsErrors: '*' + """)) + + self.expected_output = [ + "non-mongo include 'cctype' should use angle brackets", + "mongo include 'test_MongoHeaderBracketCheck.h' should use double quotes", + ] + + self.run_clang_tidy() + def test_MongoUninterruptibleLockGuardCheck(self): self.write_config( diff --git a/src/mongo/tools/mongo_tidy_checks/tests/SConscript b/src/mongo/tools/mongo_tidy_checks/tests/SConscript index 7c39431e109..4c9abf27042 100644 --- a/src/mongo/tools/mongo_tidy_checks/tests/SConscript +++ b/src/mongo/tools/mongo_tidy_checks/tests/SConscript @@ -9,10 +9,15 @@ import SCons # multiple compilation databases is not supported by ninja if env.GetOption('ninja') == 'disabled': + mongo_tidy_test_env = env.Clone() + + mongo_tidy_test_env.Append(CPPPATH='.') + # This list represents the test source files, which should contain a single issue which will be flagged # by a clang tidy check. The issue should be isolated in as minimal way as possible. tests = [ 'test_MongoTestCheck.cpp', + 'test_MongoHeaderBracketCheck.cpp', 'test_MongoUninterruptibleLockGuardCheck.cpp', ] @@ -23,13 +28,13 @@ if env.GetOption('ninja') == 'disabled': test_objs = [] compilation_dbs = [] for test in tests: - test_env = env.Clone() + test_env = mongo_tidy_test_env.Clone() compilation_dbs += test_env.CompilationDatabase( os.path.splitext(os.path.basename(test))[0] + ".json") test_objs += test_env.Object(test) # Building a program binary may not be necessary but it does validate the code and tie it together. - test_prog = env.Program( + test_prog = mongo_tidy_test_env.Program( target='MongoTidyCheck_test', source=['MongoTidyCheckTestMain.cpp'] + test_objs, LIBDEPS_NO_INHERIT=[ @@ -39,7 +44,7 @@ if env.GetOption('ninja') == 'disabled': # Here we setup the test execution. The test will pythons built in unittest framework # to execute clang tidy for each test source file from the list above. - test = env.Command( + test = mongo_tidy_test_env.Command( target='run_MongoTidyCheck_test', source=[ 'MongoTidyCheck_unittest.py', @@ -52,11 +57,11 @@ if env.GetOption('ninja') == 'disabled': '--clang-tidy-path=${SOURCES[1]}', '--mongo-tidy-module=${SOURCES[2]}', '${["--test-compiledbs=%s" % src for src in SOURCES[3:]]}', - f"{'' if env.Verbose() else '2> /dev/null'}", + f"{'' if mongo_tidy_test_env.Verbose() else '2> /dev/null'}", ]), - "" if env.Verbose() else "Runnning mongo tidy checks unittests.", + "" if mongo_tidy_test_env.Verbose() else "Runnning mongo tidy checks unittests.", ), ) - env.Alias('+mongo-tidy-tests', test) - env.Depends(test, test_prog) + mongo_tidy_test_env.Alias('+mongo-tidy-tests', test) + mongo_tidy_test_env.Depends(test, test_prog) diff --git a/src/mongo/tools/mongo_tidy_checks/tests/test_MongoHeaderBracketCheck.cpp b/src/mongo/tools/mongo_tidy_checks/tests/test_MongoHeaderBracketCheck.cpp new file mode 100644 index 00000000000..0cf1e8b9388 --- /dev/null +++ b/src/mongo/tools/mongo_tidy_checks/tests/test_MongoHeaderBracketCheck.cpp @@ -0,0 +1,3 @@ +#include "cctype" + +#include <test_MongoHeaderBracketCheck.h> diff --git a/src/mongo/tools/mongo_tidy_checks/tests/test_MongoHeaderBracketCheck.h b/src/mongo/tools/mongo_tidy_checks/tests/test_MongoHeaderBracketCheck.h new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/src/mongo/tools/mongo_tidy_checks/tests/test_MongoHeaderBracketCheck.h diff --git a/src/mongo/transport/asio/asio_session.h b/src/mongo/transport/asio/asio_session.h index e1968274e53..34599638f90 100644 --- a/src/mongo/transport/asio/asio_session.h +++ b/src/mongo/transport/asio/asio_session.h @@ -41,13 +41,15 @@ #include "mongo/transport/ssl_connection_context.h" #include "mongo/util/fail_point.h" #include "mongo/util/net/socket_utils.h" + #ifdef MONGO_CONFIG_SSL #include "mongo/util/net/ssl_manager.h" #include "mongo/util/net/ssl_peer_info.h" #include "mongo/util/net/ssl_types.h" #endif -#include "asio.hpp" +#include <asio.hpp> + #ifdef MONGO_CONFIG_SSL #include "mongo/util/net/ssl.hpp" #endif diff --git a/src/mongo/transport/asio/asio_transport_layer_integration_test.cpp b/src/mongo/transport/asio/asio_transport_layer_integration_test.cpp index 05f2e3472c2..2aa274a8985 100644 --- a/src/mongo/transport/asio/asio_transport_layer_integration_test.cpp +++ b/src/mongo/transport/asio/asio_transport_layer_integration_test.cpp @@ -28,8 +28,6 @@ */ -#include "mongo/platform/basic.h" - #include <memory> #include "mongo/client/async_client.h" @@ -47,7 +45,7 @@ #include "mongo/unittest/unittest.h" #include "mongo/util/fail_point.h" -#include "asio.hpp" +#include <asio.hpp> #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kTest diff --git a/src/mongo/transport/service_executor_test.cpp b/src/mongo/transport/service_executor_test.cpp index 7ca7530b637..2adec7d9d90 100644 --- a/src/mongo/transport/service_executor_test.cpp +++ b/src/mongo/transport/service_executor_test.cpp @@ -28,11 +28,9 @@ */ -#include "mongo/platform/basic.h" - -#include "boost/optional.hpp" #include <algorithm> #include <asio.hpp> +#include <boost/optional.hpp> #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/service_context.h" diff --git a/src/mongo/util/net/ssl/context_base.hpp b/src/mongo/util/net/ssl/context_base.hpp index d2b48989eb5..86abd53fa31 100644 --- a/src/mongo/util/net/ssl/context_base.hpp +++ b/src/mongo/util/net/ssl/context_base.hpp @@ -15,13 +15,13 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> #if MONGO_CONFIG_SSL_PROVIDER == MONGO_CONFIG_SSL_PROVIDER_OPENSSL #include "mongo/util/net/ssl/detail/openssl_types.hpp" #endif -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -107,6 +107,6 @@ protected: } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_CONTEXT_BASE_HPP diff --git a/src/mongo/util/net/ssl/context_openssl.hpp b/src/mongo/util/net/ssl/context_openssl.hpp index b473d986c3a..ce0e4aa0867 100644 --- a/src/mongo/util/net/ssl/context_openssl.hpp +++ b/src/mongo/util/net/ssl/context_openssl.hpp @@ -15,15 +15,15 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> -#include "asio/buffer.hpp" -#include "asio/io_context.hpp" #include "mongo/util/net/ssl/context_base.hpp" #include "mongo/util/net/ssl/detail/openssl_types.hpp" +#include <asio/buffer.hpp> +#include <asio/io_context.hpp> #include <string> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -83,7 +83,7 @@ private: } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #if defined(ASIO_HEADER_ONLY) #include "mongo/util/net/ssl/impl/context_openssl.ipp" diff --git a/src/mongo/util/net/ssl/detail/buffered_handshake_op.hpp b/src/mongo/util/net/ssl/detail/buffered_handshake_op.hpp index 2dbfbb9f472..560b91f31e4 100644 --- a/src/mongo/util/net/ssl/detail/buffered_handshake_op.hpp +++ b/src/mongo/util/net/ssl/detail/buffered_handshake_op.hpp @@ -15,11 +15,11 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> #include "mongo/util/net/ssl/detail/engine.hpp" -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -99,6 +99,6 @@ private: } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_DETAIL_BUFFERED_HANDSHAKE_OP_HPP diff --git a/src/mongo/util/net/ssl/detail/engine_openssl.hpp b/src/mongo/util/net/ssl/detail/engine_openssl.hpp index b3bcc9eac47..268f8a62705 100644 --- a/src/mongo/util/net/ssl/detail/engine_openssl.hpp +++ b/src/mongo/util/net/ssl/detail/engine_openssl.hpp @@ -15,14 +15,14 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> -#include "asio/buffer.hpp" -#include "asio/detail/static_mutex.hpp" #include "mongo/util/net/ssl/detail/openssl_types.hpp" #include "mongo/util/net/ssl/stream_base.hpp" +#include <asio/buffer.hpp> +#include <asio/detail/static_mutex.hpp> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -141,7 +141,7 @@ private: } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #if defined(ASIO_HEADER_ONLY) #include "mongo/util/net/ssl/detail/impl/engine_openssl.ipp" diff --git a/src/mongo/util/net/ssl/detail/handshake_op.hpp b/src/mongo/util/net/ssl/detail/handshake_op.hpp index a6840f8bb01..53d5c53e0c4 100644 --- a/src/mongo/util/net/ssl/detail/handshake_op.hpp +++ b/src/mongo/util/net/ssl/detail/handshake_op.hpp @@ -15,11 +15,11 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> #include "mongo/util/net/ssl/detail/engine.hpp" -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -49,6 +49,6 @@ private: } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_DETAIL_HANDSHAKE_OP_HPP diff --git a/src/mongo/util/net/ssl/detail/impl/engine_openssl.ipp b/src/mongo/util/net/ssl/detail/impl/engine_openssl.ipp index 7c4d4ad92d9..090903dc578 100644 --- a/src/mongo/util/net/ssl/detail/impl/engine_openssl.ipp +++ b/src/mongo/util/net/ssl/detail/impl/engine_openssl.ipp @@ -15,15 +15,15 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" -#include "asio/ip/address.hpp" +#include <asio/detail/config.hpp> +#include <asio/ip/address.hpp> -#include "asio/detail/throw_error.hpp" -#include "asio/error.hpp" #include "mongo/util/net/ssl/detail/engine.hpp" #include "mongo/util/net/ssl/error.hpp" +#include <asio/detail/throw_error.hpp> +#include <asio/error.hpp> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -263,6 +263,6 @@ int engine::do_write(void* data, std::size_t length) { } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_DETAIL_IMPL_ENGINE_OPENSSL_IPP diff --git a/src/mongo/util/net/ssl/detail/io.hpp b/src/mongo/util/net/ssl/detail/io.hpp index b48f7dbc3ec..030255ecc48 100644 --- a/src/mongo/util/net/ssl/detail/io.hpp +++ b/src/mongo/util/net/ssl/detail/io.hpp @@ -15,14 +15,14 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> -#include "asio/write.hpp" #include "mongo/util/fail_point.h" #include "mongo/util/net/ssl/detail/engine.hpp" #include "mongo/util/net/ssl/detail/stream_core.hpp" +#include <asio/write.hpp> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -340,6 +340,6 @@ struct associated_executor<ssl::detail::io_op<Stream, Operation, Handler>, Execu } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_DETAIL_IO_HPP diff --git a/src/mongo/util/net/ssl/detail/openssl_types.hpp b/src/mongo/util/net/ssl/detail/openssl_types.hpp index 02dff7caac0..b2f87182391 100644 --- a/src/mongo/util/net/ssl/detail/openssl_types.hpp +++ b/src/mongo/util/net/ssl/detail/openssl_types.hpp @@ -15,8 +15,8 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" -#include "asio/detail/socket_types.hpp" +#include <asio/detail/config.hpp> +#include <asio/detail/socket_types.hpp> #include <openssl/conf.h> #include <openssl/ssl.h> #if !defined(OPENSSL_NO_ENGINE) diff --git a/src/mongo/util/net/ssl/detail/read_op.hpp b/src/mongo/util/net/ssl/detail/read_op.hpp index c2c0ee528e4..4cbd80c3513 100644 --- a/src/mongo/util/net/ssl/detail/read_op.hpp +++ b/src/mongo/util/net/ssl/detail/read_op.hpp @@ -15,12 +15,12 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> -#include "asio/detail/buffer_sequence_adapter.hpp" #include "mongo/util/net/ssl/detail/engine.hpp" +#include <asio/detail/buffer_sequence_adapter.hpp> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -56,6 +56,6 @@ private: } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_DETAIL_READ_OP_HPP diff --git a/src/mongo/util/net/ssl/detail/shutdown_op.hpp b/src/mongo/util/net/ssl/detail/shutdown_op.hpp index 7a289f74b34..de946e958eb 100644 --- a/src/mongo/util/net/ssl/detail/shutdown_op.hpp +++ b/src/mongo/util/net/ssl/detail/shutdown_op.hpp @@ -15,11 +15,11 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> #include "mongo/util/net/ssl/detail/engine.hpp" -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -44,6 +44,6 @@ public: } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP diff --git a/src/mongo/util/net/ssl/detail/stream_core.hpp b/src/mongo/util/net/ssl/detail/stream_core.hpp index bf92e5ca3f6..5e32736fe43 100644 --- a/src/mongo/util/net/ssl/detail/stream_core.hpp +++ b/src/mongo/util/net/ssl/detail/stream_core.hpp @@ -15,19 +15,19 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> #if defined(ASIO_HAS_BOOST_DATE_TIME) #include "asio/deadline_timer.hpp" #else // defined(ASIO_HAS_BOOST_DATE_TIME) -#include "asio/steady_timer.hpp" +#include <asio/steady_timer.hpp> #endif // defined(ASIO_HAS_BOOST_DATE_TIME) -#include "asio/buffer.hpp" #include "mongo/util/net/ssl/apple.hpp" #include "mongo/util/net/ssl/detail/engine.hpp" +#include <asio/buffer.hpp> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -134,6 +134,6 @@ struct stream_core { } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_DETAIL_STREAM_CORE_HPP diff --git a/src/mongo/util/net/ssl/detail/write_op.hpp b/src/mongo/util/net/ssl/detail/write_op.hpp index 21014137cc9..bd7c07cef46 100644 --- a/src/mongo/util/net/ssl/detail/write_op.hpp +++ b/src/mongo/util/net/ssl/detail/write_op.hpp @@ -15,12 +15,12 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> -#include "asio/detail/buffer_sequence_adapter.hpp" #include "mongo/util/net/ssl/detail/engine.hpp" +#include <asio/detail/buffer_sequence_adapter.hpp> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -56,6 +56,6 @@ private: } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_DETAIL_WRITE_OP_HPP diff --git a/src/mongo/util/net/ssl/error.hpp b/src/mongo/util/net/ssl/error.hpp index 3bf0ea02510..e738713401b 100644 --- a/src/mongo/util/net/ssl/error.hpp +++ b/src/mongo/util/net/ssl/error.hpp @@ -15,14 +15,14 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" -#include "asio/error_code.hpp" +#include <asio/detail/config.hpp> +#include <asio/error_code.hpp> #if MONGO_CONFIG_SSL_PROVIDER == MONGO_CONFIG_SSL_PROVIDER_OPENSSL #include "mongo/util/net/ssl/detail/openssl_types.hpp" #endif -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace error { @@ -98,7 +98,7 @@ inline asio::error_code make_error_code(stream_errors e) { } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #if defined(ASIO_HEADER_ONLY) #include "mongo/util/net/ssl/impl/error.ipp" diff --git a/src/mongo/util/net/ssl/impl/context_openssl.ipp b/src/mongo/util/net/ssl/impl/context_openssl.ipp index ef3ba9cb992..84942d2225d 100644 --- a/src/mongo/util/net/ssl/impl/context_openssl.ipp +++ b/src/mongo/util/net/ssl/impl/context_openssl.ipp @@ -16,15 +16,15 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> -#include "asio/detail/throw_error.hpp" -#include "asio/error.hpp" #include "mongo/util/net/ssl/context.hpp" #include "mongo/util/net/ssl/error.hpp" +#include <asio/detail/throw_error.hpp> +#include <asio/error.hpp> #include <cstring> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -298,6 +298,6 @@ context::native_handle_type context::native_handle() { } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_IMPL_CONTEXT_OPENSSL_IPP diff --git a/src/mongo/util/net/ssl/impl/error.ipp b/src/mongo/util/net/ssl/impl/error.ipp index fd2c5f5c2c2..0952a01a6f3 100644 --- a/src/mongo/util/net/ssl/impl/error.ipp +++ b/src/mongo/util/net/ssl/impl/error.ipp @@ -17,13 +17,13 @@ #include <string> -#include "asio/detail/assert.hpp" -#include "asio/detail/config.hpp" #include "mongo/util/errno_util.h" #include "mongo/util/net/ssl/apple.hpp" #include "mongo/util/net/ssl/error.hpp" +#include <asio/detail/assert.hpp> +#include <asio/detail/config.hpp> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace error { @@ -110,6 +110,6 @@ const asio::error_category& get_stream_category() { } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_IMPL_ERROR_IPP diff --git a/src/mongo/util/net/ssl/impl/src.hpp b/src/mongo/util/net/ssl/impl/src.hpp index c807cf1cb20..b1907ed7094 100644 --- a/src/mongo/util/net/ssl/impl/src.hpp +++ b/src/mongo/util/net/ssl/impl/src.hpp @@ -13,7 +13,7 @@ #define ASIO_SOURCE -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> #if defined(ASIO_HEADER_ONLY) #error Do not compile Asio library source with ASIO_HEADER_ONLY defined diff --git a/src/mongo/util/net/ssl/stream.hpp b/src/mongo/util/net/ssl/stream.hpp index 8c903bb837d..0397b609e1b 100644 --- a/src/mongo/util/net/ssl/stream.hpp +++ b/src/mongo/util/net/ssl/stream.hpp @@ -15,13 +15,8 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> -#include "asio/async_result.hpp" -#include "asio/detail/buffer_sequence_adapter.hpp" -#include "asio/detail/handler_type_requirements.hpp" -#include "asio/detail/noncopyable.hpp" -#include "asio/detail/type_traits.hpp" #include "mongo/util/net/ssl/apple.hpp" #include "mongo/util/net/ssl/context.hpp" #include "mongo/util/net/ssl/detail/buffered_handshake_op.hpp" @@ -32,8 +27,13 @@ #include "mongo/util/net/ssl/detail/stream_core.hpp" #include "mongo/util/net/ssl/detail/write_op.hpp" #include "mongo/util/net/ssl/stream_base.hpp" +#include <asio/async_result.hpp> +#include <asio/detail/buffer_sequence_adapter.hpp> +#include <asio/detail/handler_type_requirements.hpp> +#include <asio/detail/noncopyable.hpp> +#include <asio/detail/type_traits.hpp> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -594,6 +594,6 @@ private: } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_STREAM_HPP diff --git a/src/mongo/util/net/ssl/stream_base.hpp b/src/mongo/util/net/ssl/stream_base.hpp index cd4b390adee..ca2ed11ca4a 100644 --- a/src/mongo/util/net/ssl/stream_base.hpp +++ b/src/mongo/util/net/ssl/stream_base.hpp @@ -15,9 +15,9 @@ #pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include "asio/detail/config.hpp" +#include <asio/detail/config.hpp> -#include "asio/detail/push_options.hpp" +#include <asio/detail/push_options.hpp> namespace asio { namespace ssl { @@ -43,6 +43,6 @@ protected: } // namespace ssl } // namespace asio -#include "asio/detail/pop_options.hpp" +#include <asio/detail/pop_options.hpp> #endif // ASIO_SSL_STREAM_BASE_HPP |