Skip to content

Warning fixes#108

Merged
soruk42 merged 3 commits into
stardot:dev-mainfrom
davel:davel/warnings2
Mar 8, 2026
Merged

Warning fixes#108
soruk42 merged 3 commits into
stardot:dev-mainfrom
davel:davel/warnings2

Conversation

@davel

@davel davel commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

Hello,

I have made a few more fixes make -Wextra in gcc happier

mainstate.c - the existing behaviour looks fine, I have made it more explicit.

miscprocs.c - kbd_readline() doesn't return a readstate, I'm fairly sure existing behaviour was wrong under error conditions.

tokens.c - I suspect the fall-through will only happen on corrupt BASIC files. We should probably reject the file or warn when the second byte of a two-byte opcode is out of range, rather than ignoring the first byte and treating it as a single byte opcode. However, I don't know if existing BASIC files (perhaps from obscure platforms?) are relying on current behaviour.

I'm not sure about the desired behaviour here, https://github.com/stardot/MatrixBrandy/blame/dev-main/src/mainstate.c#L1732

e43842e introduces the clause, so I suspect invoking def_locvar() after falling-through is correct, but I've not convinced myself enough to patch this!

This fixes compiler warnings.

We appear to fall-through when we get an invalid two byte token. I'm not
convinced the current behaviour is correct. I suspect we should be reporting
an error and rejecting the file, however I don't have a large pile of
tokenised BBC BASIC from the wild to test such a change against.
kbd_readline() returns a int32, not a readstate.
@davel davel marked this pull request as ready for review November 12, 2025 13:08
@soruk42 soruk42 merged commit 7fae5e1 into stardot:dev-main Mar 8, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants