-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix misleading intentation errors on gcc 6.0 #33798
Fix misleading intentation errors on gcc 6.0 #33798
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This is third party code that's just stored in the repo for convenience. Patching third-party code means that it gets harder to update to newer upstream versions. However, we never updated our copy of miniz since it was added, and development of miniz seems to have mostly stopped (though I found a few newer commits at https://github.com/tessel/miniz/), so this is more of a theoretical concern in this case. |
Thanks for the PR! Could we perhaps just add a compiler flag that disables these errors in this situation instead? I, like @rkruppe, would like to stick to the upstream sources as much as possible. |
Turning off the warning will probably lead to a warning about As far as I am concerned, the third-party-ness is a non-concern. I consider it more likely and more desirable that we'll replace miniz with a pure rust implementation (or maybe a binding to a different compression library) before we pull in a more current miniz version. |
Fwiw, there's another case of this in hoedown. I've submitted that pr upstream here: hoedown/hoedown#194 , but can also submit to the downstream fork if it's preferable. |
Upstream is almost always preferable, miniz is a special case IMO. Edit: hoedown in particular we do update from upstream, see #28574 for example |
…excrichton Fix misleading intentation errors on gcc 6.0 Currently building with latest gcc results in the following error: compile: x86_64-unknown-linux-gnu/rt/miniz.o /home/lc/rust/src/rt/miniz.c: In function ‘tinfl_decompress’: /home/lc/rust/src/rt/miniz.c:578:9: error: this ‘for’ clause does not guard... [-Werror=misleading-indentation] for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8; ^~~ /home/lc/rust/src/rt/miniz.c:578:47: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘for’ for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8; ^~~ /home/lc/rust/src/rt/miniz.c: In function ‘tdefl_find_match’: /home/lc/rust/src/rt/miniz.c:1396:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation] if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break; ^~ /home/lc/rust/src/rt/miniz.c:1396:23: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break; ^ This patch stops this.
💔 Test failed - auto-win-gnu-32-opt |
I made a PR to upstream: richgel999/miniz#52 Regards |
…excrichton Fix misleading intentation errors on gcc 6.0 Currently building with latest gcc results in the following error: compile: x86_64-unknown-linux-gnu/rt/miniz.o /home/lc/rust/src/rt/miniz.c: In function ‘tinfl_decompress’: /home/lc/rust/src/rt/miniz.c:578:9: error: this ‘for’ clause does not guard... [-Werror=misleading-indentation] for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8; ^~~ /home/lc/rust/src/rt/miniz.c:578:47: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘for’ for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8; ^~~ /home/lc/rust/src/rt/miniz.c: In function ‘tdefl_find_match’: /home/lc/rust/src/rt/miniz.c:1396:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation] if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break; ^~ /home/lc/rust/src/rt/miniz.c:1396:23: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ if (!dist) break; p = s; q = d->m_dict + probe_pos; for (probe_len = 0; probe_len < max_match_len; probe_len++) if (*p++ != *q++) break; ^ This patch stops this.
Currently building with latest gcc results in the following error:
This patch stops this.