From ba488b10eccafc6375566cd369be76958132a99e Mon Sep 17 00:00:00 2001 From: Patryk Wrobel Date: Fri, 26 Jan 2024 08:38:35 +0100 Subject: [PATCH 1/2] mutation/mutation.hh: remove anonymous namespace from header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 change aligns the code with the following guidelines: - CppCoreGuidelines: "SF.21: Don’t use an unnamed (anonymous) namespace in a header" - SEI CERT C++: "DCL59-CPP. Do not define an unnamed namespace in a header file" Signed-off-by: Patryk Wrobel --- mutation/mutation.hh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mutation/mutation.hh b/mutation/mutation.hh index 630d0dd1eb..58b602da3f 100644 --- a/mutation/mutation.hh +++ b/mutation/mutation.hh @@ -189,8 +189,6 @@ private: friend std::ostream& operator<<(std::ostream& os, const mutation& m); }; -namespace { - template std::optional 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 consume_clustering_fragments(schema_ptr s, mutatio return stop; } -} // anonymous namespace - template auto mutation::consume(Consumer& consumer, consume_in_reverse reverse, mutation_consume_cookie cookie) && -> mutation_consume_result { From 6faa178f108786d7d367899706dda079ff8e6c03 Mon Sep 17 00:00:00 2001 From: Patryk Wrobel Date: Fri, 26 Jan 2024 08:44:31 +0100 Subject: [PATCH 2/2] utils/config_file_impl.hh: remove anonymous namespace from header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 change aligns the code with the following guidelines: - CppCoreGuidelines: "SF.21: Don’t use an unnamed (anonymous) namespace in a header" - SEI CERT C++: "DCL59-CPP. Do not define an unnamed namespace in a header file" Signed-off-by: Patryk Wrobel --- utils/config_file_impl.hh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/utils/config_file_impl.hh b/utils/config_file_impl.hh index 63a2e6a973..b3f83fb763 100644 --- a/utils/config_file_impl.hh +++ b/utils/config_file_impl.hh @@ -135,8 +135,6 @@ void validate(boost::any& out, const std::vector& 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* value_ex() { return r; } -} - sstring hyphenate(const std::string_view&); }