Skip to content

Commit bcfef55

Browse files
scottlambclaude
andcommitted
encoder tests: align mock 'index' field with the API's uint8_t
Apple clang 21 fails the encoder test builds with errors like: quantum/encoder/tests/encoder_tests.cpp:37:40: error: non-constant-expression cannot be narrowed from type 'uint8_t' (aka 'unsigned char') to 'int8_t' (aka 'signed char') in initializer list [-Wc++11-narrowing] 37 | updates[updates_array_idx % 32] = {index, clockwise}; | ^~~~~ `encoder_update_kb()` takes `uint8_t index`, but the test-only `struct update` declared the captured field as `int8_t`. The aggregate-init `{index, clockwise}` then narrows uint8_t -> int8_t, which clang's stricter -Wc++11-narrowing rejects (gcc was lenient about it, which is why Linux CI didn't catch this). The signed type was a mismatch, not a deliberate choice — encoder indices are non-negative — so widen the field to `uint8_t` to match the real API instead of papering over the narrowing with a cast. Applied identically to all six encoder test variants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b9c6ec0 commit bcfef55

6 files changed

Lines changed: 12 additions & 12 deletions

quantum/encoder/tests/encoder_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ extern "C" {
2626
}
2727

2828
struct update {
29-
int8_t index;
30-
bool clockwise;
29+
uint8_t index;
30+
bool clockwise;
3131
};
3232

3333
uint8_t updates_array_idx = 0;

quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ extern "C" {
2626
}
2727

2828
struct update {
29-
int8_t index;
30-
bool clockwise;
29+
uint8_t index;
30+
bool clockwise;
3131
};
3232

3333
uint8_t updates_array_idx = 0;

quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ extern "C" {
2626
}
2727

2828
struct update {
29-
int8_t index;
30-
bool clockwise;
29+
uint8_t index;
30+
bool clockwise;
3131
};
3232

3333
uint8_t updates_array_idx = 0;

quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ extern "C" {
2626
}
2727

2828
struct update {
29-
int8_t index;
30-
bool clockwise;
29+
uint8_t index;
30+
bool clockwise;
3131
};
3232

3333
uint8_t updates_array_idx = 0;

quantum/encoder/tests/encoder_tests_split_no_left.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ extern "C" {
2626
}
2727

2828
struct update {
29-
int8_t index;
30-
bool clockwise;
29+
uint8_t index;
30+
bool clockwise;
3131
};
3232

3333
uint8_t updates_array_idx = 0;

quantum/encoder/tests/encoder_tests_split_no_right.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ extern "C" {
2626
}
2727

2828
struct update {
29-
int8_t index;
30-
bool clockwise;
29+
uint8_t index;
30+
bool clockwise;
3131
};
3232

3333
uint8_t updates_array_idx = 0;

0 commit comments

Comments
 (0)