From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D582F1F8C7 for ; Sat, 31 Jul 2021 19:01:56 +0000 (UTC) Received: from localhost ([::1]:41506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m9uF9-0007fv-Dx for normalperson@yhbt.net; Sat, 31 Jul 2021 15:01:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9uF4-0007dR-Ko for bug-gnulib@gnu.org; Sat, 31 Jul 2021 15:01:51 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:37128) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9uF2-00068k-QJ for bug-gnulib@gnu.org; Sat, 31 Jul 2021 15:01:50 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E75D51600F3 for ; Sat, 31 Jul 2021 12:01:47 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Wzm3QDuaK4k2; Sat, 31 Jul 2021 12:01:47 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0F1DB1600F1; Sat, 31 Jul 2021 12:01:47 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id c64aQ2atyLfh; Sat, 31 Jul 2021 12:01:46 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id DF49F160083; Sat, 31 Jul 2021 12:01:46 -0700 (PDT) From: Paul Eggert To: bug-gnulib@gnu.org Subject: [PATCH 4/6] gnulib-common: update for gcc -Wmismatched-dealloc Date: Sat, 31 Jul 2021 12:01:21 -0700 Message-Id: <20210731190124.279622-4-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210731190124.279622-1-eggert@cs.ucla.edu> References: <20210731190124.279622-1-eggert@cs.ucla.edu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Eggert Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" * m4/gnulib-common.m4 (gl_COMMON_BODY): Define the macros _GL_ATTRIBUTE_DEALLOC and _GL_ATTRIBUTE_DEALLOC_FREE. These can be useful with gcc -Wmismatched-dealloc. --- ChangeLog | 5 +++++ m4/gnulib-common.m4 | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7e388c4dd..33a472f5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2021-07-30 Paul Eggert =20 + gnulib-common: update for gcc -Wmismatched-dealloc + * m4/gnulib-common.m4 (gl_COMMON_BODY): Define the macros + _GL_ATTRIBUTE_DEALLOC and _GL_ATTRIBUTE_DEALLOC_FREE. These can + be useful with gcc -Wmismatched-dealloc. + gnulib-common: update for C2x 2020-12-11 draft Use blessed-by-draft-standard way to test for [[__deprecated__]] etc.; this is supported by GCC 11 and the fallback code should diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 347462d1d..2872ecdf7 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -148,6 +148,18 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_CONST #endif =20 +/* _GL_ATTRIBUTE_DEALLOC (F, I) is for functions returning pointers + that can be freed by passing them as the Ith argument to the + function F. _GL_ATTRIBUTE_DEALLOC_FREE is for functions that + return pointers that can be freed via 'free'; it can be used + only after including stdlib.h. */ +#if _GL_GNUC_PREREQ (11, 0) +# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) +#else +# define _GL_ATTRIBUTE_DEALLOC(f, i) +#endif +#define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) + #if _GL_HAS_C_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] #elif _GL_HAS_ATTRIBUTE (deprecated) --=20 2.31.1