mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
Merge 'Remove anonymous namespaces from headers' from Patryk Wróbel
Anonymous namespace implies internal linkage for its members. When it is defined in a header, then each translation unit, which includes such header defines its own unique instance of members of the unnamed namespace that are ODR-used within that translation unit. This can lead to unexpected results including code bloat or undefined behavior due to ODR violations. This PR removes unnamed namespaces from header files. References: - [CppCoreGuidelines: "SF.21: Don’t use an unnamed (anonymous) namespace in a header"](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf21-dont-use-an-unnamed-anonymous-namespace-in-a-header) - [SEI CERT C++: "DCL59-CPP. Do not define an unnamed namespace in a header file"](https://wiki.sei.cmu.edu/confluence/display/cplusplus/DCL59-CPP.+Do+not+define+an+unnamed+namespace+in+a+header+file) Closes scylladb/scylladb#16998 * github.com:scylladb/scylladb: utils/config_file_impl.hh: remove anonymous namespace from header mutation/mutation.hh: remove anonymous namespace from header
This commit is contained in:
@@ -189,8 +189,6 @@ private:
|
||||
friend std::ostream& operator<<(std::ostream& os, const mutation& m);
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
template<consume_in_reverse reverse, FlattenedConsumerV2 Consumer>
|
||||
std::optional<stop_iteration> consume_clustering_fragments(schema_ptr s, mutation_partition& partition, Consumer& consumer, mutation_consume_cookie& cookie, is_preemptible preempt = is_preemptible::no) {
|
||||
constexpr bool crs_in_reverse = reverse == consume_in_reverse::yes;
|
||||
@@ -308,8 +306,6 @@ std::optional<stop_iteration> consume_clustering_fragments(schema_ptr s, mutatio
|
||||
return stop;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
template<FlattenedConsumerV2 Consumer>
|
||||
auto mutation::consume(Consumer& consumer, consume_in_reverse reverse, mutation_consume_cookie cookie) &&
|
||||
-> mutation_consume_result<decltype(consumer.consume_end_of_stream())> {
|
||||
|
||||
@@ -135,8 +135,6 @@ void validate(boost::any& out, const std::vector<std::string>& in, std::unordere
|
||||
|
||||
namespace utils {
|
||||
|
||||
namespace {
|
||||
|
||||
/*
|
||||
* Our own bpo::typed_valye.
|
||||
* Only difference is that we _don't_ apply defaults (they are already applied)
|
||||
@@ -172,8 +170,6 @@ inline typed_value_ex<T>* value_ex() {
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sstring hyphenate(const std::string_view&);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user