public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [Patch] Fix nss/nss_test1.c compile with latest GCC
@ 2017-07-19 21:17 Steve Ellcey
  2017-07-19 23:13 ` DJ Delorie
  0 siblings, 1 reply; 9+ messages in thread
From: Steve Ellcey @ 2017-07-19 21:17 UTC (permalink / raw)
  To: libc-alpha

[-- 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;

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-07-21 23:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-19 21:17 [Patch] Fix nss/nss_test1.c compile with latest GCC Steve Ellcey
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

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).