From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 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 966001F5A0 for ; Thu, 9 Feb 2023 12:21:47 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=clisp.org header.i=@clisp.org header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=DY/vmpaq; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQ5vg-0005Ds-Jg; Thu, 09 Feb 2023 07:21:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pQ5ve-0005DY-4U for bug-gnulib@gnu.org; Thu, 09 Feb 2023 07:21:30 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.162]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pQ5vb-000460-Pc for bug-gnulib@gnu.org; Thu, 09 Feb 2023 07:21:29 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1675945284; cv=none; d=strato.com; s=strato-dkim-0002; b=hgM6W7RDz60V8vCyXarUqWz3H2ZTJ1E1iRjAAtKUYKzV+lacx467lplkuNRsWjI0qZ sLmvZaX2VfAC0lfATkSXRtgABwH9aJH5i3vO3yFmn85IODeB5xDTnLVIP5Jva3lcdxOu uepG9RtMl3mFkAEV37VNXUO0xkTExUoAEAXh2DJbhV9/gYhr+8KnrMtGiUze2N+IdvJf 3kfrzslMwjBB+Psnb21Azl0DzftRC6DHONylG2GjkTt72BJPtiDR4s0vXIcztvcZitfr wAJraPT/Y5UkS6SgoJ3AxBAjnOEiFTjAEvb99i69ZN4ARtNfIOnkbiWO/9wT0t7H0fGU 6FiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1675945284; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=5t7y7s6VY7E0U7m/oDxtoVHIWbwMmlr4m4ZozjkQ67o=; b=WOXolw7UBNvOgDF/iWIlpAce2fD8Fc2ruBnBytJD6TbFCivDBi2ZSm7tg9wGuXx2W6 Banl2RdZDwWtHSv5tHXEnhvi6LFF3S3AXyTJfQHC6mXizj29/qrO/a0COjkrYe+n5Aly 5Jnitox82FB1cGoIYr6tUJuXnYacirqiUBeWmRgZXYB/RlfPoTbVaO9XVHoNC6ZQ09JM F5d94m0AqGCoVtKwDUzskhcoYRqjTEQ3NOHEYO2W/h68Mriry+EeGHczLcMJNY6aouPz OgDahSh1eNUn4DtiCL4lPLUMBeet0zG/tRUkTTTHcqjiABR3tw9lInMvtEHkw1yXSPn6 9JXw== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1675945284; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=5t7y7s6VY7E0U7m/oDxtoVHIWbwMmlr4m4ZozjkQ67o=; b=DY/vmpaqAeMCp0+JgGk3eJzA4Cn2JxXMMuJMmMD7/yDVmvwvtinpPuYbNnLhWOLT4W E0ybzLGgZIzxILs0A1r+vXPDnAj9rWAOErk3I7LNMnYWpbykZyZkzJcGsWfgra++NgQo jkia8olc3IFyBlskFnROcODzMQd8PsLSZElFJukPU7C1uoID/S14XXLXkUXzZ7PvM1Gh 1JGae0/Gj70U2m3miAXxgUXmKTNL8cW+0lGNDs8RtwPnRo9KulRDD0J3Skm+5QMTZSOA nk7U8wYmDHQUb1u5v0lTo/hBcMO36VcJdgXfYUOlY1ufVseEMrLgrrMIHNVLd5+/I815 IYHg== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpOR3/Sus0aMwOpDc0DhXnpl0pTgeA==" Received: from nimes.localnet by smtp.strato.de (RZmta 49.3.0 AUTH) with ESMTPSA id f83259z19CLOGAZ (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 9 Feb 2023 13:21:24 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Fix error in C++ mode on glibc systems Date: Thu, 09 Feb 2023 13:21:24 +0100 Message-ID: <2714877.YpNBiEq8W8@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=81.169.146.162; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org When compiling a Gnulib testdir with clang15 with -std=gnu2x option, on a CentOS 8 Stream system, I see this compilation error: In file included from ../../gltests/test-nullptr-c++.cc:30: In file included from ../../gltests/macros.h:22: ../gllib/stdlib.h:756:1: error: exception specification in declaration does not match previous declaration _GL_FUNCDECL_RPL (free, void, (void *ptr) throw ()); ^ ../gllib/wchar.h:238:23: note: expanded from macro '_GL_FUNCDECL_RPL' _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) ^ :194:1: note: expanded from here rpl_free ^ ../gllib/wchar.h:698:19: note: previous declaration is here _GL_EXTERN_C void rpl_free (void *); ^ 1 error generated. The cause is that on 2022-04-28 we added the 'throw ()' annotation to the rpl_free declaration in stdlib.h. https://lists.gnu.org/archive/html/bug-gnulib/2022-04/msg00072.html But we have similar declarations also in malloc.h, string.h, wchar.h, and they all need to be consistent. This patch fixes it. 2023-02-09 Bruno Haible Fix error in C++ mode on glibc systems (regression 2022-04-28). * lib/malloc.in.h (rpl_free): Add exception specification like stdlib.in.h does. * lib/string.in.h (rpl_free): Likewise. * lib/wchar.in.h (rpl_free): Likewise. diff --git a/lib/malloc.in.h b/lib/malloc.in.h index 4921f6e994..2fcbe23535 100644 --- a/lib/malloc.in.h +++ b/lib/malloc.in.h @@ -65,7 +65,11 @@ # if (@REPLACE_FREE@ && !defined free \ && !(defined __cplusplus && defined GNULIB_NAMESPACE)) /* We can't do '#define free rpl_free' here. */ +# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) +_GL_EXTERN_C void rpl_free (void *) throw (); +# else _GL_EXTERN_C void rpl_free (void *); +# endif # undef _GL_ATTRIBUTE_DEALLOC_FREE # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) # else diff --git a/lib/string.in.h b/lib/string.in.h index aa08821392..b6bf432e1f 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -126,7 +126,11 @@ # if (@REPLACE_FREE@ && !defined free \ && !(defined __cplusplus && defined GNULIB_NAMESPACE)) /* We can't do '#define free rpl_free' here. */ +# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) +_GL_EXTERN_C void rpl_free (void *) throw (); +# else _GL_EXTERN_C void rpl_free (void *); +# endif # undef _GL_ATTRIBUTE_DEALLOC_FREE # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) # else diff --git a/lib/wchar.in.h b/lib/wchar.in.h index bbca92797d..2beddd780f 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -188,7 +188,11 @@ typedef int rpl_mbstate_t; # if (@REPLACE_FREE@ && !defined free \ && !(defined __cplusplus && defined GNULIB_NAMESPACE)) /* We can't do '#define free rpl_free' here. */ +# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) +_GL_EXTERN_C void rpl_free (void *) throw (); +# else _GL_EXTERN_C void rpl_free (void *); +# endif # undef _GL_ATTRIBUTE_DEALLOC_FREE # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) # else