Warning fixes#108
Merged
Merged
Conversation
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.
Fixes gcc warning.
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.
Hello,
I have made a few more fixes make
-Wextrain gcc happiermainstate.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!