From 99ef11bfc6d0bed3816c1317d494daa1494b46dd Mon Sep 17 00:00:00 2001 From: helly25 Date: Sat, 19 Oct 2024 16:10:43 +0200 Subject: [PATCH] Cosmetics: * Correct header guards * Correct documnetation --- CHANGELOG.md | 2 +- mbo/config/BUILD.bazel | 2 +- mbo/config/internal/config.h.in | 22 +++++++++++++--------- mbo/config/require.h | 6 +++--- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94ee061..b11c3bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ * Added `mbo::testing::WhenTransformedBy` which allows to compare containers after transforming them. * Added custom Bazel flag `--//mbo/config:require_throws` which controls whether `MBO_CONFIG_REQUIRE` throw exceptions or use crash logging (the default `False` or `0`). This mostly affects containers. -* Added custom Bazel flag `--//mbo/config:limited_ordered_max_unroll_capacity`. This was undocumented as `--//mbo/container:limited_ordered_max_unroll_capacity` until now. It controls the maximum unroll size for LimitedOrdered/Map/Set. +* Added custom Bazel flag `--//mbo/config:limited_ordered_max_unroll_capacity`. This was undocumented as `--//mbo/container:limited_ordered_max_unroll_capacity` until now (though listed in the changelog). It controls the maximum unroll size for LimitedOrdered/Map/Set. # 0.2.33 diff --git a/mbo/config/BUILD.bazel b/mbo/config/BUILD.bazel index c2ac46e..b6f5165 100644 --- a/mbo/config/BUILD.bazel +++ b/mbo/config/BUILD.bazel @@ -17,7 +17,7 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "int_flag") load(":internal/config.bzl", "config_gen") -# Create custom bazel flag `--//mbo/container:limited_ordered_max_unroll_capacity`. +# Create custom bazel flag `--//mbo/config:limited_ordered_max_unroll_capacity`. int_flag( name = "limited_ordered_max_unroll_capacity", build_setting_default = 16, diff --git a/mbo/config/internal/config.h.in b/mbo/config/internal/config.h.in index 731b462..aec5fda 100644 --- a/mbo/config/internal/config.h.in +++ b/mbo/config/internal/config.h.in @@ -13,32 +13,36 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef MBO_CONTAINER_INTERNAL_LIMITED_ORDERED_CONFIG_H_ -#define MBO_CONTAINER_INTERNAL_LIMITED_ORDERED_CONFIG_H_ +#ifndef MBO_CONFIG_CONFIG_H_ +#define MBO_CONFIG_CONFIG_H_ #include namespace mbo::config { -// The maximum unroll capacity for `LimitedOrdered` based containers: `LimitedSet` and `LimitedMap`. +// The maximum unroll capacity for `LimitedOrdered` based containers: `LimitedMap` and `LimitedSet`. // Beyond unrolling 32 comparison steps, unrolling has deminishing returns for any architecture. // The acceptable range is [4..32]. // -// For an Apple M2-Max and an AMD Epyc 7000 CPU, 24 turned out to be a good compromise in micro benchmarks. +// For Apple M2-Max and AMD Epyc 7000 CPU, 24 appeared to be a good compromise in micro benchmarks. // // For complex code inlining + unrolling might become problematic for larger values. // -// The exact value is controlled by the custom bazel flag `--//mbo/container:limited_ordered_max_unroll_capacity`. +// This is controlled by the custom Bazel flag `--//mbo/config:limited_ordered_max_unroll_capacity`. // When the library is built as a dependency (e.g. as `com_helly25_mbo`), then the flag becomes -// `--@com_helly_25//mbo/container:limited_ordered_max_unroll_capacity`. +// `--@com_helly_25//mbo/config:limited_ordered_max_unroll_capacity`. static constexpr std::size_t kUnrollMaxCapacityDefault = 16; -// Config macro `MBO_CONFIG_REQUIRE_THROWS` controls whether container requirement violations -// result in throwing a `std::runtime_error` or a `ABSL_LOG_IF` (the latter (0) being the default). +// Configuration that controls whether container requirement violations result in throwing a +// `std::runtime_error` or crashing using `ABSL_LOG_IF` (the latter being the default). // // When exceptions are used then the affected functions cannot be declared `noexcept`. +// +// This is controlled by custom Bazel `--//mbo/config:require_throws`. +// When the library is built as a dependency (e.g. as `com_helly25_mbo`), then the flag becomes +// `--@com_helly_25//mbo/config:require_throws` (defaults to `False` / `0`). static constexpr bool kRequireThrows = false; } // namespace mbo::config -#endif // MBO_CONTAINER_INTERNAL_LIMITED_ORDERED_CONFIG_H_ +#endif // MBO_CONFIG_CONFIG_H_ diff --git a/mbo/config/require.h b/mbo/config/require.h index d71036c..0ae8a63 100644 --- a/mbo/config/require.h +++ b/mbo/config/require.h @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef MBO_CONTAINER_INTERNAL_REQUIRE_H_ -#define MBO_CONTAINER_INTERNAL_REQUIRE_H_ +#ifndef MBO_CONFIG_REQUIRE_H_ +#define MBO_CONFIG_REQUIRE_H_ #include // IWYU pragma: keep @@ -47,4 +47,4 @@ // NOLINTEND(cppcoreguidelines-macro-usage) -#endif // MBO_CONTAINER_INTERNAL_REQUIRE_H_ +#endif // MBO_CONFIG_REQUIRE_H_