From patchwork Wed Jul 19 21:17:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 21695 Received: (qmail 83194 invoked by alias); 19 Jul 2017 21:17:13 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 83148 invoked by uid 89); 19 Jul 2017 21:17:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: camailhost.cavium.com Date: Wed, 19 Jul 2017 14:17:09 -0700 From: Steve Ellcey Message-Id: <201707192117.v6JLH93S004005@sellcey-dt.caveonetworks.com> To: libc-alpha@sourceware.org Subject: [Patch] Fix nss/nss_test1.c compile with latest GCC Reply-To: sellcey@cavium.com 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 * 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;