Fix nss/nss_test1.c compile with latest GCC
Commit Message
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.
@@ -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;