Skip to content

Fixes a shadowed variable in the system time zone initializer. #152

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

Merged
merged 1 commit into from
Dec 16, 2015
Merged

Fixes a shadowed variable in the system time zone initializer. #152

merged 1 commit into from
Dec 16, 2015

Conversation

brownleej
Copy link

The shadowed variable that's being removed in this PR causes the name to fall out of scope as soon as it exits the "if (0 < ret)" block, and the outermost "name" field is left null. This causes the systemTimeZone to always report as GMT.

I'm not sure if the mechanism I'm using to test this is the best way to go. Calling into the C time functions seems like a hack, and something that might get broken by subtle changes to system configurations. It works on both my Mac and Linux installs, and it correctly gives an error when the change to CFTimeZone.c is removed.

@phausler
Copy link
Contributor

oops, hmm perhaps we should enable error on shadowing
Validating against the C api's is perfectly reasonable in a unit test.

phausler added a commit that referenced this pull request Dec 16, 2015
Fixes a shadowed variable in the system time zone initializer.
@phausler phausler merged commit d4ae9bf into swiftlang:master Dec 16, 2015
@brownleej brownleej deleted the system-time-zone-fix branch December 17, 2015 00:21
atrick pushed a commit to atrick/swift-corelibs-foundation that referenced this pull request Jan 12, 2021
Add a `BuildSystemDelegate` which supports notifications for build settings changes
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