Declare Studio's net field under the condition it is used - #2982
Open
annejan wants to merge 1 commit into
Open
Conversation
studio->net is read where either BUILD_EDITORS or BUILD_SURF is set:
initConsole(studio->console, studio, studio->fs, studio->net, ...)
but the field is declared only under BUILD_SURF, so compiling the studio
with BUILD_EDITORS and without BUILD_SURF fails:
error: 'Studio' has no member named 'net'
CMakeLists.txt turns BUILD_SURF on whenever BUILD_EDITORS is set, so the
in-tree builds never produce that combination; it is out-of-tree builds
compiling these sources directly that run into it.
The declaration now carries the same condition as the use, matching the
Console field just above it. No configuration that builds today changes:
with BUILD_SURF defined the preprocessed result is identical.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Collaborator
Obviously up to nesbox, but I'm not sure we should ship one without the other. Right now we have a hard error (I presume) telling someone "this combo doesn't work"... If we take that away we'd need to figure out where to document this where people would be sure to read 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.
studio->netis read wherever eitherBUILD_EDITORSorBUILD_SURFis set:but the field itself is declared only under
BUILD_SURF, so compiling the studio withBUILD_EDITORSand withoutBUILD_SURFfails:Worth being upfront:
CMakeLists.txt:59setsBUILD_SURF ONwheneverBUILD_EDITORSis set, so no in-tree build produces that combination. This only bites builds that compile these sources directly with their own definitions — I ran into it porting TIC-80 to the ESP32-P4, wanting the editors without the network layer.The change
The declaration now carries the same condition as its use, matching the
Console*field immediately above it. Three added lines, no deletions.No configuration that builds today is affected: with
BUILD_SURFdefined the preprocessed result is identical. Verified by building the SDL target.Note this makes that configuration compile; it does not make it fully work.
console.ccallstic_net_get(console->net, ...)outside anyBUILD_SURFguard, so with no network layer that would be a nulltic_net.net.c's fallback implementation handles a null and fails the request cleanly, but the naett path would not. Fixing that properly means deciding whether console's version check and download paths should beBUILD_SURF-only, which felt like your call rather than mine — happy to follow up if you want it.