fix(ci): unbreak alpha CI baseline (format + TOKENS_COUNT + const)#216
Merged
Conversation
Three pre-existing breakages on alpha that block every PR's CI:
1. lint-format failed on include/keepkey/emulator/{setup.h,libkkemu.h}
— newly-merged libkkemu support landed without clang-format applied.
Run: clang-format -i ...
2. build-arm-firmware-btc-only failed with TOKENS_COUNT redefined.
coins.h:51 defines TOKENS_COUNT=0 in BITCOIN_ONLY builds (because
the comment claims ethereum_tokens.h isn't included), but ethereum.c
actually does include ethereum_tokens.h, which redefines it.
Guard ethereum_tokens.h's #define with #ifndef so coins.h's BTC-only
fallback wins when both are included.
3. static-analysis (cppcheck) failed on lib/emulator/libkkemu.c:167
— Canvas *c is read-only, declare as const Canvas *.
ethereum_tokens.h IS included in BTC-only builds (transitively via ethereum.c and ethereum_tokens.c), so the override in coins.h that forces TOKENS_COUNT=0 collides with the real definition. Single source of truth: ethereum_tokens.h owns TOKENS_COUNT. Reverts the #ifndef guard from the previous commit since coins.h no longer fights it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Alpha's CI is currently red on every PR — same set of failures across #213, #215, and alpha's own last push (commit `92c8f534`). Three independent pre-existing breakages, all small:
1. `lint-format` — clang-format violations on libkkemu headers
`include/keepkey/emulator/{setup.h,libkkemu.h}` were merged without the formatter being applied. Just ran `clang-format -i` — pure whitespace + macro alignment + pointer-style fixes.
2. `build-arm-firmware-btc-only` — `TOKENS_COUNT` redefined
`coins.h:51` pre-defines `TOKENS_COUNT=0` in `BITCOIN_ONLY` builds (the comment there claims `ethereum_tokens.h` isn't included), but `ethereum.c` actually does include `ethereum_tokens.h`, which then redefines the macro and `-Werror` kills the build.
Surgical fix: guard `ethereum_tokens.h`'s define with `#ifndef TOKENS_COUNT` so `coins.h`'s BTC-only fallback wins when both are pulled in.
3. `static-analysis` — `Canvas *` could be `const Canvas *`
cppcheck flagged `lib/emulator/libkkemu.c:167`: `c` is only used to read `c->buffer`, so declare it const.
Why this matters
Until alpha is green, every PR shows red CI from these unrelated failures, hiding actual regressions. PRs #213 (metadata-keys) and #215 (macOS emu artifact) both block on this same set.
Test plan