Skip to content

Commit b3037a1

Browse files
authored
Comply with two clang-tidy bugprone checks, and add clang-tidy comments. (#267)
1 parent 049e363 commit b3037a1

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

.clang-tidy

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ Checks: '
2626
performance-*,
2727
portability-*,
2828
readability-*,
29-
-bugprone-branch-clone,
3029
-bugprone-easily-swappable-parameters,
3130
-bugprone-implicit-widening-of-multiplication-result,
3231
-bugprone-narrowing-conversions,
3332
-bugprone-reserved-identifier,
3433
-bugprone-signed-char-misuse,
3534
-bugprone-suspicious-include,
36-
-bugprone-too-small-loop-variable,
3735
-bugprone-unhandled-self-assignment,
3836
-clang-analyzer-cplusplus.NewDelete,
3937
-clang-analyzer-cplusplus.NewDeleteLeaks,
@@ -73,8 +71,14 @@ AnalyzeTemporaryDtors: true
7371
# we hide the reference implementation in another repository.
7472
# -modernize-use-trailing-return-type,
7573
# At the time of writing (8/22), all of the core BusTub code is in compliance with this. This check only fails
76-
# because some GTest file that is generated at build time. There should be a workaround...?
77-
# (The file's name is gmock_main.cc).
74+
# because some GTest file (gmock_main.cc) that is generated at build time. There should be a workaround...?
75+
# -clang-analyzer-security.insecureAPI.rand, -clang-analyzer-security.insecureAPI.rand, -bugprone-unhandled-self-assignment,
76+
# -bugprone-implicit-widening-of-multiplication-result
77+
# These have not been investigated yet.
78+
# -bugprone-reserved-identifier,
79+
# Fails due to use of some __SHORT_FILE__ symbol, originating from very old code.
80+
# -bugprone-suspicious-include,
81+
# False positive due to GTest code.
7882
# -bugprone-too-small-loop-variable,
7983
# Complains about uint8_t or uint16_t when the limit on the loop is a container's .size() (size_t).
8084
# We usually do this when we know the maximum size of the container though, so propose leaving disabled.
@@ -88,8 +92,7 @@ AnalyzeTemporaryDtors: true
8892
# We use C-style arrays in page.h, type.h and logger.h. They're a little more ergonomic than std::array. Thoughts?
8993
# -readability-magic-numbers,
9094
# Let's not deal with people doing ridiculous things to hack around this. If it bites them, it bites them.
91-
# -bugprone-branch-clone, -bugprone-signed-char-misuse, -bugprone-unhandled-self-assignment,
92-
# -clang-diagnostic-implicit-int-float-conversion, -modernize-use-auto, -modernize-use-trailing-return-type,
93-
# -readability-convert-member-functions-to-static, -readability-make-member-function-const, -readability-qualified-auto,
94-
# -readability-redundant-access-specifiers
95-
# Not available on clang-8. Disable for forward compatibility with students running modern clang versions.
95+
# -bugprone-signed-char-misuse, -clang-diagnostic-implicit-int-float-conversion, -readability-make-member-function-const,
96+
# -readability-qualified-auto, -readability-redundant-access-specifiers
97+
# These were previously disabled for not being available in clang-tidy-8. They are now available on our clang-tidy-12,
98+
# and potentially worth investigating/fixing.

src/include/catalog/column.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ class Column {
9191
static auto TypeSize(TypeId type) -> uint8_t {
9292
switch (type) {
9393
case TypeId::BOOLEAN:
94-
return 1;
9594
case TypeId::TINYINT:
9695
return 1;
9796
case TypeId::SMALLINT:

src/include/execution/executors/aggregation_executor.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,8 @@ class SimpleAggregationHashTable {
4848
for (const auto &agg_type : agg_types_) {
4949
switch (agg_type) {
5050
case AggregationType::CountAggregate:
51-
// Count starts at zero.
52-
values.emplace_back(ValueFactory::GetIntegerValue(0));
53-
break;
5451
case AggregationType::SumAggregate:
55-
// Sum starts at zero.
52+
// Count/Sum starts at zero.
5653
values.emplace_back(ValueFactory::GetIntegerValue(0));
5754
break;
5855
case AggregationType::MinAggregate:

0 commit comments

Comments
 (0)