Skip to content

Fix swift build warning - 'default will never be executed' #7419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

therealbnut
Copy link
Contributor

There is a build warning when running utils/build-script:

build/Ninja-DebugAssert/swift-macosx-x86_64/stdlib/private/StdlibUnittest/8/StdlibUnittest.swift:989:5: warning: default will never be executed
    default:
    ^

The default case is necessary, but produces a warning in non-resilient builds. This PR keeps the default case, but temporarily removes another (equivalent) case to ensure the switch is:

  • exhaustive
  • not redundant

@hughbe
Copy link
Contributor

hughbe commented Feb 13, 2017

@swift-ci please smoke test

@therealbnut
Copy link
Contributor Author

Thanks @hughbe

@therealbnut
Copy link
Contributor Author

@airspeedswift I noticed you added the FIXME near this code, are you the right person to ping for review?

@airspeedswift
Copy link
Member

@therealbnut thanks, that's a good workaround.

@slavapestov do you know what the deal is with the real fix? Just wondering if we'll lose track without the warning still firing...

@airspeedswift
Copy link
Member

@swift-ci Please test

@airspeedswift
Copy link
Member

want to run a full test rather than just smoke since this is in the unit testing framework...

@airspeedswift airspeedswift self-requested a review February 25, 2017 02:16
@therealbnut
Copy link
Contributor Author

@airspeedswift I just found this issue SR-3278, which seems to refer to this code. SR-3278 can probably be closed if this PR is merged.

Perhaps at minimum a new issue should be added for the "real fix"? I had a look but I couldn't find one.

@therealbnut
Copy link
Contributor Author

Thanks for your review :)

@therealbnut
Copy link
Contributor Author

@slavapestov I believe this PR is just waiting for your feedback on @airspeedswift's question, just a reminder, thanks :)

@slavapestov
Copy link
Contributor

@airspeedswift The real fix is to not emit the warning about the redundant default statement if the enum is not explicitly marked fixed layout, even in non-resilient builds. However that is a language change, so at the very least it can't happen until we're ready to flip the switch to building the stdlib and related code in Swift 4 mode.

@airspeedswift airspeedswift merged commit d07ba91 into swiftlang:master Mar 7, 2017
@airspeedswift
Copy link
Member

OK thanks. Will try and remember to put this back when we have that.

@therealbnut
Copy link
Contributor Author

thanks @airspeedswift for reviewing and @slavapestov for your help :)

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.

4 participants