Skip to content
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

Merged
merged 1 commit into from
May 28, 2016
Merged

Fix misleading intentation errors on gcc 6.0 #33798

merged 1 commit into from
May 28, 2016

Conversation

locallycompact
Copy link
Contributor

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.

@rust-highfive
Copy link
Collaborator

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.

@hanna-kruppe
Copy link
Contributor

hanna-kruppe commented May 22, 2016

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.

@alexcrichton
Copy link
Member

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.

@hanna-kruppe
Copy link
Contributor

hanna-kruppe commented May 23, 2016

Turning off the warning will probably lead to a warning about -Wno-... being unrecognized by GCC <6. My remark on third-party code is, as I said, very theoretical. We never once updated miniz in the four years since it was added, and in fact did some local modifications before (b043349). I just started writing the comment before I knew that, and wanted to share the results of my archeology rather than scrap the whole comment.

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.

@locallycompact
Copy link
Contributor Author

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.

@hanna-kruppe
Copy link
Contributor

hanna-kruppe commented May 23, 2016

Upstream is almost always preferable, miniz is a special case IMO.

Edit: hoedown in particular we do update from upstream, see #28574 for example

@alexcrichton
Copy link
Member

@bors: r+ 6e9774f

ah ok, especially if it's difficult to ignore the warning seems fine to me, thanks for the investigation @rkruppe!

@bors
Copy link
Contributor

bors commented May 24, 2016

⌛ Testing commit 6e9774f with merge debc439...

bors added a commit that referenced this pull request May 24, 2016
…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.
@bors
Copy link
Contributor

bors commented May 24, 2016

💔 Test failed - auto-win-gnu-32-opt

@alexcrichton
Copy link
Member

@dns2utf8
Copy link
Contributor

I made a PR to upstream: richgel999/miniz#52
Maybe upgrade miniz after it is merged.

Regards

@bors
Copy link
Contributor

bors commented May 27, 2016

⌛ Testing commit 6e9774f with merge 7bddce6...

bors added a commit that referenced this pull request May 27, 2016
…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.
@bors bors merged commit 6e9774f into rust-lang:master May 28, 2016
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.

7 participants