From patchwork Mon Aug 31 17:46:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40346 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D21A33959E55; Mon, 31 Aug 2020 17:46:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D21A33959E55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1598895971; bh=f17QQ6RNJq9WOfwXsNHsyYx7K17kMtUccoWswHoVZ8Q=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=MbuYfODyUoLITiZwETJmDEikhorRoTTMbsG0XtWm0U0vlMf3jE/afbQg9766T+9po TeZPqs+ZFq+dCYtILDrj+MoVRykMkoS9Bki/wh7aiazrenHg6CBoIkI0WLBtAo0niN +utdDqBOTDMaZo62e0iG8Mblb7U+tMhy2A2aNMLQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by sourceware.org (Postfix) with ESMTPS id 17DD03959E54 for ; Mon, 31 Aug 2020 17:46:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 17DD03959E54 Received: by mail-qv1-xf41.google.com with SMTP id ef16so1574250qvb.8 for ; Mon, 31 Aug 2020 10:46:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=f17QQ6RNJq9WOfwXsNHsyYx7K17kMtUccoWswHoVZ8Q=; b=Vpau9jxhnRhGkKfAyPwhnZ2o6UNFIHNIbSSmLCa/+5/tQis2rYnebVD0aXAkp/gGsM oO507Khdp9ZUI07yfZ+PS+a6BQJIQdvG6GVoS1R1/kwFVQdzTgYbaUCUZvi1cejIBs5I sYg15kzZKHwAb7xzd3vuLsk407QgPSbaCEAvY7zTFqXMR30Uq2mH07D6heUDOc3Z0+1q FKp2mSvcjOBGq7Q55HCd20iPo8pngMIw4crfVB8K9muKdfqFfaupgY5Xsdi0i/SuJc3C 9ipKdg/txw+MXk5qLKFNLDYl96TzL6zHpgajCB5An+rGlY4uVcc+Y8dR5YxKQ272N6wz 1Sog== X-Gm-Message-State: AOAM531WyM6y9NxZwp0dBvtLoMPfzJfv9PuR4l/e5jFS5YKNY3cwLKpg Kf3v+PGG7Xm/wjw7asXMvufpoGVq2kO0eWxJ X-Google-Smtp-Source: ABdhPJwpIzxkAyUUK2tO/7z2ARNzgt61QYHf0uSGEfSqXfTc3GJU3NSIK1cYNA+r0fi5w7QEr/iRCg== X-Received: by 2002:ad4:4591:: with SMTP id x17mr2159842qvu.226.1598895968029; Mon, 31 Aug 2020 10:46:08 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d9sm9966572qkj.83.2020.08.31.10.46.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 10:46:07 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [COMMITTED] malloc: Fix mallinfo deprecation declaration Date: Mon, 31 Aug 2020 14:46:03 -0300 Message-Id: <20200831174603.3301733-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It fixes the build issue below introduced by e3960d1c57e57 (Add mallinfo2 function that support sizes >= 4GB). It moves the __MALLOC_DEPRECATED to the usual place for function attributes: In file included from ../include/malloc.h:3, from ../sysdeps/x86_64/multiarch/../../../test-skeleton.c:31, from ../sysdeps/x86_64/multiarch/test-multiarch.c:96: ../malloc/malloc.h:118:1: error: empty declaration [-Werror] 118 | __MALLOC_DEPRECATED; It also adds the required deprecated warning suppression on the tests. Checked on x86_64-linux-gnu. --- malloc/malloc.h | 3 +-- malloc/tst-malloc-tcache-leak.c | 7 +++++++ malloc/tst-mxfast.c | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/malloc/malloc.h b/malloc/malloc.h index e25b33462a..b2371f7704 100644 --- a/malloc/malloc.h +++ b/malloc/malloc.h @@ -115,8 +115,7 @@ struct mallinfo2 }; /* Returns a copy of the updated current mallinfo. */ -__MALLOC_DEPRECATED; -extern struct mallinfo mallinfo (void) __THROW; +extern struct mallinfo mallinfo (void) __THROW __MALLOC_DEPRECATED; /* Returns a copy of the updated current mallinfo. */ extern struct mallinfo2 mallinfo2 (void) __THROW; diff --git a/malloc/tst-malloc-tcache-leak.c b/malloc/tst-malloc-tcache-leak.c index f6f6023b5a..2a7a0646c5 100644 --- a/malloc/tst-malloc-tcache-leak.c +++ b/malloc/tst-malloc-tcache-leak.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -72,6 +73,10 @@ do_test (void) pthread_t required to run the test. */ thread = (pthread_t *) xcalloc (1, sizeof (pthread_t)); + /* The test below covers the deprecated mallinfo function. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations"); + info_before = mallinfo (); assert (info_before.uordblks != 0); @@ -104,6 +109,8 @@ do_test (void) if (info_after.uordblks > (info_before.uordblks + threads)) FAIL_EXIT1 ("Memory usage after threads is too high.\n"); + DIAG_POP_NEEDS_COMMENT; + /* Did not detect excessive memory usage. */ free (thread); exit (0); diff --git a/malloc/tst-mxfast.c b/malloc/tst-mxfast.c index 57b4a0a8dc..8afee0f9d5 100644 --- a/malloc/tst-mxfast.c +++ b/malloc/tst-mxfast.c @@ -21,6 +21,7 @@ the fast bins. */ #include +#include #include int @@ -36,8 +37,14 @@ do_test (void) p2 = malloc (512); free (p1); + /* The test below covers the deprecated mallinfo function. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations"); + m = mallinfo (); + DIAG_POP_NEEDS_COMMENT; + /* This will fail if there are any blocks in the fastbins. */ TEST_COMPARE (m.smblks, 0);