Skip to content

[RFC] Use GNULIB's compiler warning code#378

Closed
fidencio wants to merge 3 commits into
SSSD:masterfrom
fidencio:wip/manywarnings
Closed

[RFC] Use GNULIB's compiler warning code#378
fidencio wants to merge 3 commits into
SSSD:masterfrom
fidencio:wip/manywarnings

Conversation

@fidencio

@fidencio fidencio commented Sep 9, 2017

Copy link
Copy Markdown
Contributor

This is the 3rd tentative to have this patch reviewed. For more references, please, see: PR #50.

So, I've re-worked those patches a little bit and here is the time difference when running reconfing with the patches:

real	0m26.047s
user	0m21.318s
sys	0m4.635s

And now without:

real	0m25.565s
user	0m20.696s
sys	0m4.433s

This patch set is rebased on top of PR #377.

I really would appreciate if someone could review and give their opinion.

The reason this PR was blocked is because this time difference has been considered a "performance issue".

@jhrozek , could you take a look on this?

@fidencio
fidencio force-pushed the wip/manywarnings branch 4 times, most recently from 4623e3d to 592ecb7 Compare September 9, 2017 13:55
@fidencio

fidencio commented Sep 9, 2017

Copy link
Copy Markdown
Contributor Author

The only two patches which have to be reviewed as part of this PR are:

  • CMOCKA: Silence a false-positive "deference of null pointer" warning
  • BUILD: Make use of GNULIB's compiler warning code

The patches which this PR has been rebased atop are here because without then our CI would fail.

@jhrozek

jhrozek commented Sep 12, 2017

Copy link
Copy Markdown
Contributor

I'm seeing a build failure with these patches on my machine:

/home/remote/jhrozek/devel/sssd/src/util/crypto/nss/nss_sha512crypt.c: In function ‘sha512_crypt_r’:
/home/remote/jhrozek/devel/sssd/src/util/crypto/nss/nss_sha512crypt.c:71:12: error: stack protector not protecting local variables: variable length buffer [-Werror=stack-protector]
 static int sha512_crypt_r(const char *key,
            ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:17864: recipe for target 'src/util/crypto/nss/libsss_crypt_la-nss_sha512crypt.lo' failed

@jhrozek

jhrozek commented Sep 12, 2017

Copy link
Copy Markdown
Contributor

btw as I said in PR #371 since there are fixes developed independently, maybe the patches that are also included from PR #371 should be dropped from this PR so that we can merge both.

@jhrozek jhrozek self-assigned this Sep 12, 2017
Comment thread src/resolv/async_resolv.c
new_end->next = NULL;
if (new_end) {
new_end->next = NULL;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make sense to return an error if new_end is NULL? Or is it OK to just ignore that?

Comment thread src/providers/ad/ad_gpo.c
/* If INI_PARSE_IGNORE_NON_KVP is not defined, use 0 (no effect) */
#ifndef INI_PARSE_IGNORE_NON_KVP
#define INI_PARSE_IGNORE_NON_KVP 0
#warning INI_PARSE_IGNORE_NON_KVP not defined.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mzidek-rh does RHEL-6 ship with the newer ding-libs API? If yes, I guess this is OK, otherwise we should keep the warning..

*/
if (recent_dom_info != NULL) {
recent_dom_info->next = NULL;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the resolv patch, I think it's better to fail explicitly than silently skip even in case of a false positive.

@jhrozek jhrozek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer explicit failure in case some check fails and we need to check with @mzidek-rh about removing the INI warning.

@mzidek-gh

Copy link
Copy Markdown
Contributor

I did not review all the patches, but I do not like the removal of the INI warning. I guess we can not treat warnings as errors for all platforms. It is easy to forget that you need new ding-libs for some of the features to work properly in SSSD and if someone compiles the code for EL6 (scratch builds) this warning is a valuable piece of information. I explicitly grep for it when do some scratch builds to verify if the new ding-libs was available during compile time (not just run time).

@fidencio

Copy link
Copy Markdown
Contributor Author

Okay. I'll re-work this PR.

About merging this PR and the #371, I'm okay with that. But I'd prefer dropping the patches from there than from here (as those patches here are at least 6 months older than that ones).

@jhrozek

jhrozek commented Sep 12, 2017

Copy link
Copy Markdown
Contributor

btw there are more warnings on RHEL-6:

cache_req_data.o `test -f 'src/responder/common/cache_req/cache_req_data.c' || echo '/var/lib/jenkins/workspace/ci/label/rhel6/'`src/responder/common/cache_req/cache_req_data.c
cc1: warning: command line option "-Wenum-compare" is valid for C++/ObjC++ but not for C
cc1: warning: command line option "-Wenum-compare" is valid for C++/ObjC++ but not for C
cc1: warnings being treated as errors
/var/lib/jenkins/workspace/ci/label/rhel6/src/responder/common/cache_req/cache_req_result.c: In function 'cache_req_add_result':
/var/lib/jenkins/workspace/ci/label/rhel6/src/responder/common/cache_req/cache_req_result.c:35: error: declaration of 'index' shadows a global declaration [-Wshadow]
/usr/include/string.h:489: error: shadowed declaration is here [-Wshadow]

@fidencio

fidencio commented Sep 12, 2017 via email

Copy link
Copy Markdown
Contributor Author

@fidencio

fidencio commented Sep 20, 2017

Copy link
Copy Markdown
Contributor Author

@jhrozek, in order to keep this PR moving ... I've decided to do not warn in case of stack-protector.
I'd like to hear from you whether you want a bug filled for this (as it's happening in a few pieces of our code).

I've submit the code to our internal CI and I'll post the link as soon as I get the results.

This PR is rebased atop of #377.

@pbrezina

Copy link
Copy Markdown
Member

@fidencio I'm not Jakub but just file a ticket for those warnings and lets move on with this one. It's been opened a year ago, you deserve it :-)

@jhrozek

jhrozek commented Sep 27, 2017

Copy link
Copy Markdown
Contributor

@fidencio I'm sorry this stalled, but I guess the PR needs a rebase atop master, right? At least the fixes for the warnings are present in master now..

@fidencio

Copy link
Copy Markdown
Contributor Author

Also, I'd like to open at least one bug to fix some of the warnings we've been ignoring so far.

It's needed in case GNULIB's manywarnings patch gets accepted, but it's
clearly a false-positive.

Signed-off-by: Fabiano Fidêncio <[email protected]>
This patch is based on cabc051.

Our coverage build uses -O0 but the macro _FORTIFY_SOURCE requires to be
compiled with optimization.

Signed-off-by: Fabiano Fidêncio <[email protected]>
As GNULIB has the 'manywarnings' module, which basically turns on every
GCC warning, let's make use of it. We can easily blacklist the warnings
we cannot cope with, but the main goal should be to have enabled every
possible GCC warning.

When new GCC warnings are created the 'manywarnings' file can be
refreshed from upstream GNULIB.

Compilation with -Werror is explicitly disabled for RHEL6 in our CI, as
a lot of warnings show up there due to old dependencies or even as
false-positives.

Signed-off-by: Fabiano Fidêncio <[email protected]>
@fidencio

fidencio commented Dec 14, 2017

Copy link
Copy Markdown
Contributor Author

@fidencio

Copy link
Copy Markdown
Contributor Author

I've fired a CI build and I'm waiting for its results.

@fidencio

Copy link
Copy Markdown
Contributor Author

I've decided to close this PR, there are more important things to be worked on/reviewed.

@pbrezina

Copy link
Copy Markdown
Member

I'm sorry this got stalled, does it need any rebasing? If you rebase it one more time, I will review it immediately.

@pbrezina

Copy link
Copy Markdown
Member

Same for Amit's patch.

@fidencio

Copy link
Copy Markdown
Contributor Author

@pbrezina, thanks for the offer but there's no need, sincerely. :-)

There's more important work to be done/reviewed at the moment and keeping the PR opened didn't make sense.

In the future, in case someone has interest on having this merged, we can get back and talk about it. For now, I'd just keep it closed and forget about this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants