-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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
ZOOKEEPER-3954: C client: GCC 10 compilation fixes #1481
ZOOKEEPER-3954: C client: GCC 10 compilation fixes #1481
Conversation
…ining Michael Hudson-Doyle experienced an error while compiling the C client with GCC 10 and "aggressive" optimization settings: > 'free_auth_completions' is being inlined into 'free_completions', > and this lets gcc see that members of 'a_list' are being accessed > without initialization This is (fortunately!) a red herring: what GCC doesn't see is that, in practice, 'zoo_lock_auth' always returns zero, and that 'a_list' is always initialized in the conditional block which follows it. Let's "fix" this by removing the 'if'. The rest of the client code doesn't check 'zoo_lock_auth's return value--and we have bigger issues if unconditional locks start failing anyway.
The "unused" function causes a warning in GCC 10, which in turn causes the build to fail when '-Werror' is enabled (as in the ticket's compilation log excerpt).
The unused variable causes a warning in GCC 10, which in turn causes the build to fail when '-Werror' is enabled (as in the ticket's compilation log excerpt).
This PR is against the 3.5 branch, but the commits, once reviewed, should also be cherry-picked to 3.6 and (partially) to Cc: @mwhudson, @eolivelli, @symat. |
The best practice is to send the PR against master, then send amended patches for other active branches when needed. Btw thank you very much for this fix. Please send the patch for master as well |
Okay; here is a patch against |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, +1
(I'm not sure if you need separate PRs for branch-3.5 and branch-3.6 if the cherrypick is clean. but anyway, this way we had CI running on all branches, which never hurt)
Okay, noted. (But in this case, I just thought I'd push the branch as I had created it for testing anyway.) |
The in this PR avoids a confusing and scary compilation issue [encountered by Michael Hudson-Doyle](https://issues.apache.org/jira/browse/ZOOKEEPER-3954) when building the C client with GCC 10 and "aggressive" optimization settings: > `free_auth_completions` is being inlined into `free_completions`, and this lets gcc see that members of `a_list` are being accessed without initialization This is (fortunately!) a red herring: what GCC doesn't see is that, in practice, `zoo_lock_auth` always returns zero, and that `a_list` is always initialized in the conditional block which follows it. That issue is easily "fixed" by removing the `if`. The rest of the client code doesn't check `zoo_lock_auth`'s return value--and we have bigger issues if unconditional locks start failing anyway. See also #1481 and #1486. Author: Damien Diederen <dd@crosstwine.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mate Szalay-Beko <symat@apache.org> Closes #1487 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-master
The most important change in this PR avoids a confusing and scary compilation issue [encountered by Michael Hudson-Doyle](https://issues.apache.org/jira/browse/ZOOKEEPER-3954) when building the C client with GCC 10 and "aggressive" optimization settings: > `free_auth_completions` is being inlined into `free_completions`, and this lets gcc see that members of `a_list` are being accessed without initialization This is (fortunately!) a red herring: what GCC doesn't see is that, in practice, `zoo_lock_auth` always returns zero, and that `a_list` is always initialized in the conditional block which follows it. That issue is easily "fixed" by removing the `if`. The rest of the client code doesn't check `zoo_lock_auth`'s return value--and we have bigger issues if unconditional locks start failing anyway. The remaining changes get rid of a couple of innocuous warnings, to that the client can successfully build even when configured with `-Werror`. See also #1481. Author: Damien Diederen <dd@crosstwine.com> Reviewers: Mate Szalay-Beko <symat@apache.org> Closes #1486 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-3.6
The most important change in this PR avoids a confusing and scary compilation issue [encountered by Michael Hudson-Doyle](https://issues.apache.org/jira/browse/ZOOKEEPER-3954) when building the C client with GCC 10 and "aggressive" optimization settings: > `free_auth_completions` is being inlined into `free_completions`, and this lets gcc see that members of `a_list` are being accessed without initialization This is (fortunately!) a red herring: what GCC doesn't see is that, in practice, `zoo_lock_auth` always returns zero, and that `a_list` is always initialized in the conditional block which follows it. That issue is easily "fixed" by removing the `if`. The rest of the client code doesn't check `zoo_lock_auth`'s return value--and we have bigger issues if unconditional locks start failing anyway. The remaining changes get rid of a couple of innocuous warnings, to that the client can successfully build even when configured with `-Werror`. Author: Damien Diederen <dd@crosstwine.com> Reviewers: Mate Szalay-Beko <symat@apache.org> Closes #1481 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes
The in this PR avoids a confusing and scary compilation issue [encountered by Michael Hudson-Doyle](https://issues.apache.org/jira/browse/ZOOKEEPER-3954) when building the C client with GCC 10 and "aggressive" optimization settings: > `free_auth_completions` is being inlined into `free_completions`, and this lets gcc see that members of `a_list` are being accessed without initialization This is (fortunately!) a red herring: what GCC doesn't see is that, in practice, `zoo_lock_auth` always returns zero, and that `a_list` is always initialized in the conditional block which follows it. That issue is easily "fixed" by removing the `if`. The rest of the client code doesn't check `zoo_lock_auth`'s return value--and we have bigger issues if unconditional locks start failing anyway. See also apache#1481 and apache#1486. Author: Damien Diederen <dd@crosstwine.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mate Szalay-Beko <symat@apache.org> Closes apache#1487 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-master
The in this PR avoids a confusing and scary compilation issue [encountered by Michael Hudson-Doyle](https://issues.apache.org/jira/browse/ZOOKEEPER-3954) when building the C client with GCC 10 and "aggressive" optimization settings: > `free_auth_completions` is being inlined into `free_completions`, and this lets gcc see that members of `a_list` are being accessed without initialization This is (fortunately!) a red herring: what GCC doesn't see is that, in practice, `zoo_lock_auth` always returns zero, and that `a_list` is always initialized in the conditional block which follows it. That issue is easily "fixed" by removing the `if`. The rest of the client code doesn't check `zoo_lock_auth`'s return value--and we have bigger issues if unconditional locks start failing anyway. See also apache#1481 and apache#1486. Author: Damien Diederen <dd@crosstwine.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mate Szalay-Beko <symat@apache.org> Closes apache#1487 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-master
The in this PR avoids a confusing and scary compilation issue [encountered by Michael Hudson-Doyle](https://issues.apache.org/jira/browse/ZOOKEEPER-3954) when building the C client with GCC 10 and "aggressive" optimization settings: > `free_auth_completions` is being inlined into `free_completions`, and this lets gcc see that members of `a_list` are being accessed without initialization This is (fortunately!) a red herring: what GCC doesn't see is that, in practice, `zoo_lock_auth` always returns zero, and that `a_list` is always initialized in the conditional block which follows it. That issue is easily "fixed" by removing the `if`. The rest of the client code doesn't check `zoo_lock_auth`'s return value--and we have bigger issues if unconditional locks start failing anyway. See also apache#1481 and apache#1486. Author: Damien Diederen <dd@crosstwine.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mate Szalay-Beko <symat@apache.org> Closes apache#1487 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-master
The in this PR avoids a confusing and scary compilation issue [encountered by Michael Hudson-Doyle](https://issues.apache.org/jira/browse/ZOOKEEPER-3954) when building the C client with GCC 10 and "aggressive" optimization settings: > `free_auth_completions` is being inlined into `free_completions`, and this lets gcc see that members of `a_list` are being accessed without initialization This is (fortunately!) a red herring: what GCC doesn't see is that, in practice, `zoo_lock_auth` always returns zero, and that `a_list` is always initialized in the conditional block which follows it. That issue is easily "fixed" by removing the `if`. The rest of the client code doesn't check `zoo_lock_auth`'s return value--and we have bigger issues if unconditional locks start failing anyway. See also apache#1481 and apache#1486. Author: Damien Diederen <dd@crosstwine.com> Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mate Szalay-Beko <symat@apache.org> Closes apache#1487 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-master
The most important change in this PR avoids a confusing and scary compilation issue encountered by Michael Hudson-Doyle when building the C client with GCC 10 and "aggressive" optimization settings:
This is (fortunately!) a red herring: what GCC doesn't see is that, in practice,
zoo_lock_auth
always returns zero, and thata_list
is always initialized in the conditional block which follows it.That issue is easily "fixed" by removing the
if
. The rest of the client code doesn't checkzoo_lock_auth
's return value--and we have bigger issues if unconditional locks start failing anyway.The remaining changes get rid of a couple of innocuous warnings, to that the client can successfully build even when configured with
-Werror
.