Skip to content

Commit 5ad0b3e

Browse files
authoredSep 6, 2024
apacheGH-43796: [C++] Indent preprocessor directives (apache#43798)
### Rationale for this change This is for easy to read. FYI: Google C++ style guide doesn't require indent in preprocessor directives nor deny it: https://google.github.io/styleguide/cppguide.html#Preprocessor_Directives ```cpp // Good - directives at beginning of line if (lopsided_score) { #if DISASTER_PENDING // Correct -- Starts at beginning of line DropEverything(); # if NOTIFY // OK but not required -- Spaces after # NotifyClient(); # endif #endif BackToNormal(); } ``` ### What changes are included in this PR? * Add clang-format configurations for preprocessor directives indentation * Apply these configurations ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: apache#43796 Authored-by: Sutou Kouhei <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent 262d6f6 commit 5ad0b3e

File tree

147 files changed

+1425
-1418
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+1425
-1418
lines changed
 

‎.clang-format

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ BasedOnStyle: Google
1919
ColumnLimit: 90
2020
DerivePointerAlignment: false
2121
IncludeBlocks: Preserve
22+
IndentPPDirectives: AfterHash

‎cpp/src/arrow/acero/aggregate_benchmark.cc

+8-8
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ struct SumSentinelUnrolled : public Summer<T> {
165165
static void Sum(const ArrayType& array, SumState<T>* state) {
166166
SumState<T> local;
167167

168-
#define SUM_NOT_NULL(ITEM) \
169-
do { \
170-
local.total += values[i + ITEM] * Traits<T>::NotNull(values[i + ITEM]); \
171-
local.valid_count++; \
172-
} while (0)
168+
# define SUM_NOT_NULL(ITEM) \
169+
do { \
170+
local.total += values[i + ITEM] * Traits<T>::NotNull(values[i + ITEM]); \
171+
local.valid_count++; \
172+
} while (0)
173173

174174
const auto values = array.raw_values();
175175
const auto length = array.length();
@@ -185,7 +185,7 @@ struct SumSentinelUnrolled : public Summer<T> {
185185
SUM_NOT_NULL(7);
186186
}
187187

188-
#undef SUM_NOT_NULL
188+
# undef SUM_NOT_NULL
189189

190190
for (int64_t i = length_rounded * 8; i < length; ++i) {
191191
local.total += values[i] * Traits<T>::NotNull(values[i]);
@@ -256,7 +256,7 @@ struct SumBitmapVectorizeUnroll : public Summer<T> {
256256
for (int64_t i = 0; i < length_rounded; i += 8) {
257257
const uint8_t valid_byte = bitmap[i / 8];
258258

259-
#define SUM_SHIFT(ITEM) (values[i + ITEM] * ((valid_byte >> ITEM) & 1))
259+
# define SUM_SHIFT(ITEM) (values[i + ITEM] * ((valid_byte >> ITEM) & 1))
260260

261261
if (valid_byte < 0xFF) {
262262
// Some nulls
@@ -277,7 +277,7 @@ struct SumBitmapVectorizeUnroll : public Summer<T> {
277277
}
278278
}
279279

280-
#undef SUM_SHIFT
280+
# undef SUM_SHIFT
281281

282282
for (int64_t i = length_rounded; i < length; ++i) {
283283
if (bit_util::GetBit(bitmap, i)) {

0 commit comments

Comments
 (0)
Please sign in to comment.