From: Steve Ellcey <sellcey@cavium.com>
To: libc-alpha@sourceware.org
Subject: [Patch] Fix nss/nss_test1.c compile with latest GCC
Date: Wed, 19 Jul 2017 21:17:00 -0000 [thread overview]
Message-ID: <201707192117.v6JLH93S004005@sellcey-dt.caveonetworks.com> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1165 bytes --]
While building and testing glibc with the latest (ToT) GCC, I got the
following error message:
nss_test1.c:60:46: error: division âsizeof (struct passwd *) / sizeof (struct passwd)â does not compute the number of array elements [-Werror=sizeof-pointer-div]
#define default_npwd_data (sizeof (pwd_data) / sizeof (pwd_data[0]))
I think this is due to new error checking added to GCC and in this
case I think that GCC is correct in its error. We should
be using the default_pwd_data in this expression and not pwd_data.
This patch fixes the proglem, OK for checkin?
2017-07-19 Steve Ellcey <sellcey@cavium.com>
* nss/nss_test1.c (default_npwd_data): Fix definition.
diff --git a/nss/nss_test1.c b/nss/nss_test1.c
index b728e41..86bbc2c 100644
--- a/nss/nss_test1.c
+++ b/nss/nss_test1.c
@@ -57,7 +57,8 @@ static struct passwd default_pwd_data[] =
PWD (60),
PWD (20000)
};
-#define default_npwd_data (sizeof (pwd_data) / sizeof (pwd_data[0]))
+#define default_npwd_data \
+ (sizeof (default_pwd_data) / sizeof (default_pwd_data[0]))
static struct passwd *pwd_data = default_pwd_data;
static int npwd_data = default_npwd_data;
next reply other threads:[~2017-07-19 21:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 21:17 Steve Ellcey [this message]
2017-07-19 23:13 ` DJ Delorie
2017-07-21 16:55 ` Steve Ellcey
2017-07-21 23:02 ` H.J. Lu
2017-07-21 23:17 ` H.J. Lu
2017-07-21 23:23 ` DJ Delorie
2017-07-21 23:35 ` H.J. Lu
2017-07-21 23:51 ` DJ Delorie
2017-07-21 23:55 ` Steve Ellcey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201707192117.v6JLH93S004005@sellcey-dt.caveonetworks.com \
--to=sellcey@cavium.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).