Skip to content

certmap: Suppress warning Wmissing-braces#370

Closed
lslebodn wants to merge 1 commit into
SSSD:masterfrom
lslebodn:certmap
Closed

certmap: Suppress warning Wmissing-braces#370
lslebodn wants to merge 1 commit into
SSSD:masterfrom
lslebodn:certmap

Conversation

@lslebodn

@lslebodn lslebodn commented Sep 6, 2017

Copy link
Copy Markdown
Contributor

Older version of gcc(e.g. gcc-4.8.5-11.el7) had a false positive warning
with c99 struct initialisation "{ 0 }".
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64709

CC src/lib/certmap/libsss_certmap_la-sss_cert_content_nss.lo

src/lib/certmap/sss_cert_content_nss.c:
In function 'add_pkinit_princ_to_san_list':
src/lib/certmap/sss_cert_content_nss.c:475:12:
error: missing braces around initializer [-Werror=missing-braces]
struct kerberos_principal_name kname = { 0 };
^
src/lib/certmap/sss_cert_content_nss.c:475:12:
error: (near initialization for 'kname.realm') [-Werror=missing-braces]

@sumit-bose

Copy link
Copy Markdown
Contributor

ACK, but maybe it would be good to add a comment about the issue in the code as well so that this change will not be 'optimized' out later because the { 0 } initializer is used at other places in this files as well for less complex structs.

@lslebodn

lslebodn commented Sep 6, 2017 via email

Copy link
Copy Markdown
Contributor Author

@sumit-bose

Copy link
Copy Markdown
Contributor

Maybe: "To avoid 'missing-braces' warnings with older versions of gcc kerberos_principal_name cannot be initialized with { 0 } but must be initialized with memset()."?

Older version of gcc(e.g. gcc-4.8.5-11.el7) had a false positive warning
with c99 struct initialisation "{ 0 }".
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64709

  CC       src/lib/certmap/libsss_certmap_la-sss_cert_content_nss.lo

src/lib/certmap/sss_cert_content_nss.c:
    In function 'add_pkinit_princ_to_san_list':
src/lib/certmap/sss_cert_content_nss.c:475:12:
    error: missing braces around initializer [-Werror=missing-braces]
     struct kerberos_principal_name kname = { 0 };
            ^
src/lib/certmap/sss_cert_content_nss.c:475:12:
    error: (near initialization for 'kname.realm') [-Werror=missing-braces]
@sumit-bose

Copy link
Copy Markdown
Contributor

Thank you for adding the comment. ACK

@lslebodn

lslebodn commented Sep 6, 2017

Copy link
Copy Markdown
Contributor Author

master:

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants