Message ID | 1396278243-24455-1-git-send-email-will.newton@linaro.org |
---|---|
State | Committed |
Delegated to: | Carlos O'Donell |
Headers |
Return-Path: <x14307373@homiemail-mx22.g.dreamhost.com> X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 27BC6360289 for <siddhesh@wilcox.dreamhost.com>; Mon, 31 Mar 2014 08:04:20 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14307373) id CF4F04496BA4; Mon, 31 Mar 2014 08:04:19 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx22.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx22.g.dreamhost.com (Postfix) with ESMTPS id 982B44485B70 for <glibc@patchwork.siddhesh.in>; Mon, 31 Mar 2014 08:04:19 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=P9Z4eBdvKkw75RHfQnm0IMJbe2xGXBBAABnbC78S/KzJ38P18m3cW sk9fnbvj5OHtqPUYiE4ID3Ed6w6QJMx9PzcIC7QPDOfPMZbwSaufoNca2ou/hf2H 0kId4KkB3LZE9+ujzQO4ljX9WMNLB9F2qblaGZxoAtuezY5Y537suw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=dRKex+ZfXysuDeuBhRDHauayWC0=; b=ZESZhuYVgxX1HZ24UYoIezW+e2WZ lA/ZPxdH/NnWunvw9q53qIV+7LZiyzKZx4UOKdT7hjn5qlpNSrzOYYAplT5C2AI9 +fYQMlwTigwDaVHdlDINJ/oYEfRsm1sqWaSKa56X6ALqqLMR/wknGhOsaD1f6pMT 3g67Ltpoo2Nyt7o= Received: (qmail 24191 invoked by alias); 31 Mar 2014 15:04:18 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-glibc=patchwork.siddhesh.in@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 24175 invoked by uid 89); 31 Mar 2014 15:04:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f47.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=+wMVr6D7P72n+4uaGez9Jc/NBXfJAme0LHCaJAhsqIc=; b=Y10jViAFH/5aYJkJOt4Ftrv5HOcBl6OpNTw7rsv7RYDHSyPlW6BPukv4BX/inHiWFI f+p17ls66T1JQznc4eNJ0XI7k8JrhCPpu9Co7NSv88+YjY117LvBPcRzA99Xo8Fr1i3W PtP/O0FQAuNzU+jiS7jIFTazQUlBuZsVfwJvqSyuONic0BuJ0OWcbsa1ZP5qH18bRii1 wCP8O0I2NYTC0IwTwIH9nqzf8RlJMQkULNvYDbAAtdmQQnxQYpILXbFNh9SUpynUn2yG Xz7rbyWYBFjcoxfR+sv7g5JUKl3cArzjIRHLFX1D50Vuga80tdXJgc9ijnNDEAgF3JdJ d7OA== X-Gm-Message-State: ALoCoQnOdH5LZQOaRIC/A8lMO39j7IQsGdRDCSTkLDS3jpAzX3dvTGcSm+DwryfTyP3KXEgGy3yR X-Received: by 10.194.6.106 with SMTP id z10mr15012940wjz.1.1396278252192; Mon, 31 Mar 2014 08:04:12 -0700 (PDT) From: Will Newton <will.newton@linaro.org> To: libc-alpha@sourceware.org Subject: [PATCH] malloc: Fix MALLOC_DEBUG -Wundef warning Date: Mon, 31 Mar 2014 16:04:03 +0100 Message-Id: <1396278243-24455-1-git-send-email-will.newton@linaro.org> X-DH-Original-To: glibc@patchwork.siddhesh.in |
Commit Message
Will Newton
March 31, 2014, 3:04 p.m. UTC
MALLOC_DEBUG is set optionally on the command line. Default the value to zero if it is not set on the command line, and test its value with #if rather than #ifdef. Verified the code is identical before and after this change apart from line numbers. ChangeLog: 2014-03-31 Will Newton <will.newton@linaro.org> * malloc/malloc.c [!MALLOC_DEBUG]: #define MALLOC_DEBUG to zero if it is not defined elsewhere. (mtrim): Test the value of MALLOC_DEBUG with #if rather than #ifdef. --- malloc/malloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On 31 March 2014 16:04, Will Newton <will.newton@linaro.org> wrote: > MALLOC_DEBUG is set optionally on the command line. Default the value > to zero if it is not set on the command line, and test its value > with #if rather than #ifdef. Verified the code is identical before > and after this change apart from line numbers. > > ChangeLog: > > 2014-03-31 Will Newton <will.newton@linaro.org> > > * malloc/malloc.c [!MALLOC_DEBUG]: #define MALLOC_DEBUG > to zero if it is not defined elsewhere. (mtrim): Test > the value of MALLOC_DEBUG with #if rather than #ifdef. > --- > malloc/malloc.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) Ping? > diff --git a/malloc/malloc.c b/malloc/malloc.c > index 9a45707..1120d4d 100644 > --- a/malloc/malloc.c > +++ b/malloc/malloc.c > @@ -270,6 +270,10 @@ > or other mallocs available that do this. > */ > > +#ifndef MALLOC_DEBUG > +#define MALLOC_DEBUG 0 > +#endif > + > #ifdef NDEBUG > # define assert(expr) ((void) 0) > #else > @@ -4477,7 +4481,7 @@ mtrim (mstate av, size_t pad) > > if (size > psm1) > { > -#ifdef MALLOC_DEBUG > +#if MALLOC_DEBUG > /* When debugging we simulate destroying the memory > content. */ > memset (paligned_mem, 0x89, size & ~psm1); > -- > 1.8.1.4 >
On 04/08/2014 08:34 AM, Will Newton wrote: > On 31 March 2014 16:04, Will Newton <will.newton@linaro.org> wrote: >> MALLOC_DEBUG is set optionally on the command line. Default the value >> to zero if it is not set on the command line, and test its value >> with #if rather than #ifdef. Verified the code is identical before >> and after this change apart from line numbers. >> >> ChangeLog: >> >> 2014-03-31 Will Newton <will.newton@linaro.org> >> >> * malloc/malloc.c [!MALLOC_DEBUG]: #define MALLOC_DEBUG >> to zero if it is not defined elsewhere. (mtrim): Test >> the value of MALLOC_DEBUG with #if rather than #ifdef. >> --- >> malloc/malloc.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) > > Ping? > >> diff --git a/malloc/malloc.c b/malloc/malloc.c >> index 9a45707..1120d4d 100644 >> --- a/malloc/malloc.c >> +++ b/malloc/malloc.c >> @@ -270,6 +270,10 @@ >> or other mallocs available that do this. >> */ >> >> +#ifndef MALLOC_DEBUG >> +#define MALLOC_DEBUG 0 >> +#endif >> + >> #ifdef NDEBUG >> # define assert(expr) ((void) 0) >> #else >> @@ -4477,7 +4481,7 @@ mtrim (mstate av, size_t pad) >> >> if (size > psm1) >> { >> -#ifdef MALLOC_DEBUG >> +#if MALLOC_DEBUG >> /* When debugging we simulate destroying the memory >> content. */ >> memset (paligned_mem, 0x89, size & ~psm1); Looks good to me. Cheers, Carlos.
diff --git a/malloc/malloc.c b/malloc/malloc.c index 9a45707..1120d4d 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -270,6 +270,10 @@ or other mallocs available that do this. */ +#ifndef MALLOC_DEBUG +#define MALLOC_DEBUG 0 +#endif + #ifdef NDEBUG # define assert(expr) ((void) 0) #else @@ -4477,7 +4481,7 @@ mtrim (mstate av, size_t pad) if (size > psm1) { -#ifdef MALLOC_DEBUG +#if MALLOC_DEBUG /* When debugging we simulate destroying the memory content. */ memset (paligned_mem, 0x89, size & ~psm1);