Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ CheckOptions:
value: 'NULL'
- key: performance-unnecessary-value-param.AllowedTypes
value: 'absl::Status;absl::StatusOr;std::string_view'
- key: readability-implicit-bool-conversion.AllowIntegerConditions
value: '1'
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: '1'
- key: readability-function-cognitive-complexity.Threshold
value: '25'
- key: readability-braces-around-statements.ShortStatementLines
Expand Down
4 changes: 2 additions & 2 deletions mbo/container/any_scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class AnyScanImpl {
// For MakAnyScan / MakeConstScan
template<AcceptableContainer Container>
requires(kAccessByRef)
explicit AnyScanImpl(MakeAnyScanData<Container, kScanMode> data)
explicit AnyScanImpl(const MakeAnyScanData<Container, kScanMode>& data)
: funcs_{
.iter =
[data = data] {
Expand All @@ -374,7 +374,7 @@ class AnyScanImpl {
!kAccessByRef // This is the ConvertingScan constructor
&& types::ConstructibleFrom<AccessType, ::mbo::types::ContainerConstIteratorValueType<Container>>
&& types::ConstructibleFrom<value_type, AccessType>)
explicit AnyScanImpl(MakeAnyScanData<Container, kScanMode> data)
explicit AnyScanImpl(const MakeAnyScanData<Container, kScanMode>& data)
: funcs_{
// NOTE: data must be copied here!
.iter =
Expand Down
8 changes: 6 additions & 2 deletions mbo/hash/hash_differential_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
namespace mbo::hash {
namespace {

// NOLINTBEGIN(*-magic-numbers)
// readability-implicit-bool-conversion is suppressed rather than "fixed": inside
// the reference macros (XXH64 / XXH3_*) it misattributes a conversion to the gtest
// `<<` message chain, pointing at string literals like "len: " and proposing they
// be replaced with `true`. Nothing here converts anything to bool.
// NOLINTBEGIN(*-magic-numbers,readability-implicit-bool-conversion)

TEST(DifferentialTest, Xxh64MatchesReference) {
std::mt19937_64 rng(0xD1FF64U); // NOLINT(cert-msc51-cpp,cert-msc32-c,bugprone-random-generator-seed): reproducible
Expand Down Expand Up @@ -89,7 +93,7 @@ TEST(DifferentialTest, Xxh3Hash128MatchesReference) {
}
}

// NOLINTEND(*-magic-numbers)
// NOLINTEND(*-magic-numbers,readability-implicit-bool-conversion)

} // namespace
} // namespace mbo::hash
4 changes: 2 additions & 2 deletions mbo/strings/numbers.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ unsigned BigNumberLen(T v) {
// We first check whether we can do even better by limiting us to 4 byte types.
// We use a macro to let the compiler compute the actual length values.
if constexpr (sizeof(v) <= 4) {
#define CHECK_CAP(cap) std::make_pair<uint32_t, unsigned>(cap, std::string_view(#cap).size() - 3)
#define CHECK_CAP(cap) std::pair<uint32_t, unsigned>(cap, std::string_view(#cap).size() - 3)
constexpr auto kData = mbo::container::ToLimitedMap<std::pair<uint32_t, unsigned>>({
CHECK_CAP(4'294'967'295ULL),
CHECK_CAP(999'999'999ULL),
Expand All @@ -68,7 +68,7 @@ unsigned BigNumberLen(T v) {
#undef CHECK_CAP
return kData.lower_bound(v)->second;
} else {
#define CHECK_CAP(cap) std::make_pair<uint64_t, unsigned>(cap, std::string_view(#cap).size() - 3)
#define CHECK_CAP(cap) std::pair<uint64_t, unsigned>(cap, std::string_view(#cap).size() - 3)
constexpr auto kData = mbo::container::ToLimitedMap<std::pair<uint64_t, unsigned>>({
CHECK_CAP(18'446'744'073'709'551'615ULL),
CHECK_CAP(9'999'999'999'999'999'999ULL),
Expand Down
Loading