From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 8E4C13858C3A; Mon, 10 Jul 2023 08:43:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E4C13858C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688978583; bh=+0aRHn5yA7mDSxEsoX5pFm2ip3+Z5PyMd7LO20yZQ5M=; h=From:To:Subject:Date:From; b=HUOHnmRfjE7aXzyZ1UUQoRhECdLozzewuE6bUrzA9B0g8XjLhZ2TZNJwq9g2NsuHJ /qT/BgMzZd1XPYWL/31/JrBq4gZAVmpBg4NlS5golfftyS4WUyNHzAcBZUiKYMZBNE KiLbLFJYOzAR6KDSWNb4ie+q2CeR47qykZDep5vo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: Make gcc-specific code in compiler-agnostic X-Act-Checkin: newlib-cygwin X-Git-Author: Mark Geisert X-Git-Refname: refs/heads/main X-Git-Oldrev: b03601a6713a6f7ef9ed3adea7d0e7715332f87d X-Git-Newrev: 3f2790e0443973fc3130713b0f8d8be3bf5650af Message-Id: <20230710084303.8E4C13858C3A@sourceware.org> Date: Mon, 10 Jul 2023 08:43:03 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D3f2790e0443= 973fc3130713b0f8d8be3bf5650af commit 3f2790e0443973fc3130713b0f8d8be3bf5650af Author: Mark Geisert AuthorDate: Sun Jul 9 00:59:22 2023 -0700 Commit: Corinna Vinschen CommitDate: Mon Jul 10 10:42:24 2023 +0200 Cygwin: Make gcc-specific code in compiler-agnostic =20 The current version of cannot be compiled by Clang due to the use of builtin versions of malloc, free, and memset. Their presence here was a dubious optimization anyway, so their usage has been converted to standard library functions. =20 The use of __builtin_popcountl remains because Clang implements it just like gcc does. If/when some other compiler (Rust? Go?) runs into this issue we can deal with specialized handling then. =20 The "#include " here to define __inline can be removed since both of the new includes sub-include it. =20 Addresses: https://cygwin.com/pipermail/cygwin/2023-July/253927.html Fixes: 9cc910dd33a5 (Cygwin: Make safe for c89 compilati= ons) Signed-off-by: Mark Geisert Diff: --- winsup/cygwin/include/sys/cpuset.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/include/sys/cpuset.h b/winsup/cygwin/include/sys= /cpuset.h index 0c95134ff31a..95c777cfbc6d 100644 --- a/winsup/cygwin/include/sys/cpuset.h +++ b/winsup/cygwin/include/sys/cpuset.h @@ -9,7 +9,8 @@ details. */ #ifndef _SYS_CPUSET_H_ #define _SYS_CPUSET_H_ =20 -#include +#include +#include =20 #ifdef __cplusplus extern "C" { @@ -44,14 +45,14 @@ __cpuset_alloc_size (int num) static __inline cpu_set_t * __cpuset_alloc (int num) { - return (cpu_set_t *) __builtin_malloc (CPU_ALLOC_SIZE(num)); + return (cpu_set_t *) malloc (CPU_ALLOC_SIZE(num)); } =20 #define CPU_FREE(set) __cpuset_free (set) static __inline void __cpuset_free (cpu_set_t *set) { - __builtin_free (set); + free (set); } =20 /* These _S macros operate on dynamically-sized cpu sets of size 'siz' byt= es */ @@ -59,7 +60,7 @@ __cpuset_free (cpu_set_t *set) static __inline void __cpuset_zero_s (size_t siz, cpu_set_t *set) { - (void) __builtin_memset (set, 0, siz); + (void) memset (set, 0, siz); } =20 #define CPU_SET_S(cpu, siz, set) __cpuset_set_s (cpu, siz, set)