From nobody Thu Jan 19 22:49:12 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Nyd9452Rtz2svPS; Thu, 19 Jan 2023 22:49:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Nyd944VN6z4PBR; Thu, 19 Jan 2023 22:49:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674168552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0f28niiw2d7uqRnSGieiAW1txXQcMDXUnq9ngYLMTt4=; b=y3vB6MT+GBQnh8CSiM6H4jCef/7YlLkriMfYpdqApt7vDlZPwLuLQ3m2yx3+3B8AXfuS0V 8URkxrbcKVYnBe2QYvcj/wfecmgsOsKq1prHqhZ5FEfKzuZlBEWnwDkHBYDVAF34zuLEcz LlOcFOe4TKB/+BFO3r+dtoA8wzBHNuqEbU46OSmeWVwB8nbJG3Qp4w44Uasi5gwnM/nrgx VrYUClVpIm9VLgTz8C+GCVa44nYF6iTyqkEhnrJYG7z8DmKNAx5Hz98OUk4nlXXltciKj2 ZukPr21jzWbHfuQHYWEGxxSD83J786SFsp7O+dB9Z1DxtX/ZLU59ynE/BLPifw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674168552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0f28niiw2d7uqRnSGieiAW1txXQcMDXUnq9ngYLMTt4=; b=VAytz0axJROd3lRRVNGjPDu87wtW2AD96DTCRBJKuT60n820VeyMmQqXe80BL6VruqHCsY DInV+SwezpiR7lX1I/v0rcjz/bcZf/k+q7RrnMXO5pqX3D3Wh6ut1Qo+n191QQ3qJSNWdk QDxxp6h2DLSHwCAtOdcBrcI+zBadrZBcM0lP/CVkoY/yuMaSDaycS83fK/55ILsld1Kg5j kuAOGEhwrW5EQrC3pylLlAKoVuen70idZ3epjq6u8OVyxZ0KeN8aOb9lTBrT323+hfRJ9T H4OQem23Ze29LEhVw6HRArmuXOZZSYXDL5bifmHnxbkSN+g3i7yVefaAm0dUhQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674168552; a=rsa-sha256; cv=none; b=llnoqqDX1HyDM6i4NqgvBvhrhnF3xOcUaIgm3zGn4a17Xb2Botvwdo2q9bcn6Bgz7yPnGe dJZc7Y+PBtpD03vZdMWOH16qS6xCy1fHl5pPMUT4YUt/6NbcTXTHtnt26uTGCH5+ReB/Kg JTjAlgep0Sb1W5kGl8U19kUXFa4w7TjZvRKgVYiF5PgIypaQTzFyxzZv5uf8zYKBem0QSa a2TKDpI8lwjYoaHy595nAC5YKyx7TciyOKq02CZEAH4d/cWE2Ny23iZOF0kW6dmRq/5LdC bTN+7nzHHuw5pHvKCPUUAd4S056dUmJsypRvn7tsaSVq0OVIo8M3O3BKbssWRg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Nyd943XVPz172P; Thu, 19 Jan 2023 22:49:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30JMnCl4040411; Thu, 19 Jan 2023 22:49:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30JMnCXf040410; Thu, 19 Jan 2023 22:49:12 GMT (envelope-from git) Date: Thu, 19 Jan 2023 22:49:12 GMT Message-Id: <202301192249.30JMnCXf040410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 43703bc489ec - main - stdlib.h: Fix qsort_r compatibility with GCC 12. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 43703bc489ec504b947b869045c492ed38c1a69c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=43703bc489ec504b947b869045c492ed38c1a69c commit 43703bc489ec504b947b869045c492ed38c1a69c Author: John Baldwin AuthorDate: 2023-01-19 22:48:52 +0000 Commit: John Baldwin CommitDate: 2023-01-19 22:48:52 +0000 stdlib.h: Fix qsort_r compatibility with GCC 12. GCC 12 (unlike GCC 9) does not match a function argument passed to the old qsort_r() API (as is used in the qsort_r_compat test) to a function pointer type via __generic. It treats the function type as a distinct type from a function pointer. As a workaround, add a second definition of qsort_r for GCC 12 which uses the bare function type. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37410 --- include/stdlib.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/stdlib.h b/include/stdlib.h index 754e8f5f5fd4..30d24aea1c10 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -352,9 +352,15 @@ void __qsort_r_compat(void *, size_t, size_t, void *, __sym_compat(qsort_r, __qsort_r_compat, FBSD_1.0); #endif #if defined(__generic) && !defined(__cplusplus) +#if __GNUC__ == 12 +#define qsort_r(base, nel, width, arg4, arg5) \ + __generic(arg5, int (void *, const void *, const void *), \ + __qsort_r_compat, qsort_r)(base, nel, width, arg4, arg5) +#else #define qsort_r(base, nel, width, arg4, arg5) \ __generic(arg5, int (*)(void *, const void *, const void *), \ __qsort_r_compat, qsort_r)(base, nel, width, arg4, arg5) +#endif #elif defined(__cplusplus) __END_DECLS extern "C++" {