Open
Conversation
src/loader.c:61:17: warning: code will never be executed [-Wunreachable-code] 61 | c = '+'; src/loader.c:149:30: warning: code will never be executed [-Wunreachable-code] 149 | offset = fcb2 + 1; src/loader.c:156:30: warning: code will never be executed [-Wunreachable-code] 156 | offset = fcb2 + 1; src/loader.c:195:30: warning: code will never be executed [-Wunreachable-code] 195 | offset = fcb2 + 9; src/loader.c:214:30: warning: code will never be executed [-Wunreachable-code] 214 | offset = fcb2 + 1; src/loader.c:221:30: warning: code will never be executed [-Wunreachable-code] 221 | offset = fcb2 + 1; Signed-off-by: Jeffrey H. Johnson <trnsz@pobox.com>
-Wunreachable-code warnings-Wunreachable-code warnings
Owner
|
Don't really like this - as the code is left unreachable on purpose, depending on the value of the macro. The The question should be - it is useful for the emulator to parse the FCB in DOS 1, 2 or 3 modes? If it is a useful feature, perhaps we should add a command line option to select the mode. Thanks! |
Collaborator
Author
|
Doing (1)+(1) and similar, or comparing against ((0)) instead of just 0, does work on all compilers, back to K&R.
The other option would be to use #if in the preprocessor, but that is probably even uglier looking.
Whatever you want to do is fine of course. This warning isn’t part of Clang’s -Wall at this time (but likely will be in the future).
Edit: If you plan on making this a runtime switch, probably best to just close this out, but merging as-is does clear the warnings so you can use that flag to find new issues in the future.
|
Collaborator
Author
|
@dmsc should I close this one out? |
Owner
I will keep it open until I do a proper fix :) |
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.
Silence Clang’s
-Wunreachable-codewarnings: