Repository navigation
Conversation
magikh0e
force-pushed
the
tools-check-menu-tables
branch
from
September 25, 2026 18:53
5faeaa9 to
529c02d
Compare
The menus are parallel arrays: a `..._items[N]` of labels beside a `..._icons[N]` of bitmap pointers, walked by the same index. Add an entry to one and forget the other and C++ says nothing. An array with fewer initialisers than its declared size is legal, and the missing elements are null. Neither -Wall nor -Wextra warns. What happens then is not a blank row. displaySubmenu() hands the pointer to TFT_eSPI's drawBitmap, which dereferences it, so the board faults the moment that menu page is opened. The crash lands in the drawing code, a long way from the table that caused it, and only on one page of one menu. Reads source. No board, no toolchain, nothing beyond the standard library. It also checks that each label table and its icon table share a bound, since two tables walked with different lengths is the same bug with an extra step.
magikh0e
force-pushed
the
tools-check-menu-tables
branch
from
September 25, 2026 18:53
529c02d to
cfb3dda
Compare
Author
|
Retargeted from |
This branch has not been deployed
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.
The menus are parallel arrays: a
..._items[N]of labels beside a..._icons[N]of bitmap pointers, walked by the same index.Add an entry to one and forget the other and the compiler says nothing. An
array with fewer initialisers than its declared size is legal C++, and the
missing elements are null. Neither
-Wallnor-Wextrawarns.What happens next is not a blank row.
displaySubmenu()hands the pointer toTFT_eSPI's
drawBitmap, which dereferences it, so the board faults the momentthat page is opened. The crash lands in the drawing code, a long way from the
table that caused it, and only on that one page of that one menu. That
combination is what makes it expensive to track down.
It currently finds nothing, and that is the point
Run against this tree at
90f7967, all 30 tables are full and all 13label/icon pairs agree. This is a regression guard rather than a bug report.
I am proposing it because it is the failure I hit on a fork of this code:
raising a page's feature count from 2 to 3 left the icon table with two
initialisers, and it compiled clean.
Testing
Mutation tested against this tree, with the checker's own output:
gps_submenu_icons[gps_NUM_SUBMENU_ITEMS] is 3 but has 2 initialisersgps_submenu_icons[gps_NUM_SUBMENU_ITEMS] is 4 but has 3 initialisersBoth mutations are reverted. The branch contains only the new file.
What it is
One file,
tools/check_menu_tables.py, about 100 lines. It reads source, soit needs no board and no toolchain, and nothing beyond the standard library.
Exit status is 0 when every table is full and each label table's bound matches
its icon table's, so it drops into CI as is if you want it there.
Nothing else in the repo is touched.
Licence
I maintain a GPL-3.0-or-later fork, so to be unambiguous: this contribution is
offered under the MIT licence, the same as the rest of this project. It is
original work and does not derive from any GPL dependency in my fork.