From nobody Fri Jul 14 20:27:35 2023 X-Original-To: dev-commits-src-all@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 4R2jhR5Ghkz4mb5N; Fri, 14 Jul 2023 20:27:35 +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 4R2jhR4RfFz3DpH; Fri, 14 Jul 2023 20:27:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689366455; 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=sSJpmTYkJIpoQ5L3dMsjpSe2vZPPnBr2SphG/AFg364=; b=Ua6cuHdqWT7UUpwHQPA4/YWzUTi5DdLGLSes80BRzjr0Ht2NzJRbFLGXPaZruwzs7FJcB6 ZuYfiaYm95jiElohERaa4NeRyeRvSQPQH0ZUyCtG0HY1ZljW/gsUW04GET/BsvtVHdTd2v UobXt2YcejKkuUGes7ndMm9mCxyCkZd0LsiyS5ZEll9Z7odxrSG0/qb4rQ6fapHGko3psd T19zX/KCqDUaTEWR8Y9lRyFj3OY/KMtiaaMNAb7TZByJ6iMsuT15bzdcU+3aaS5KTIl3qB +31lvZW4FtSRyhNGbgsrZjq+vlxY7yuxHFcylwAff1TrbDoODoR2a44FIufiNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689366455; 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=sSJpmTYkJIpoQ5L3dMsjpSe2vZPPnBr2SphG/AFg364=; b=L9DfRIwyzs/WsjHAATBaVYLuOcQEox/JOnF0xudBIcxMl536aicgpFbhjIDM71BZEqDx79 3uRR8kHtF8Skb//940dieyLig6qBDWtOWw0R8oZiiOBFqBCghkT05Ya79Ms23K3Ckwl/yp ICQDWN4kJqVD1zqQki8vf7fPXWqweSPpZ9h5wxZaX3ihEASPqNpEbcOi6S3dSiS8HlLFI+ z/t2XjpAr4enFxrWh3kY/PbRCYoMvQHkyz+3cD21V855YWQhpjnnh4HAJZWpxnW7ZnUrnw 73WsOCJvr4J5wNJnZQwQ8Emf7IOtAvEp8kHeMYAdOKN7BjHnjkO3FROho3AOCg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689366455; a=rsa-sha256; cv=none; b=nC5AauqQAGmlAw6sr+nif0VJp4DRlP/0ned3IGbCVLU11vFzaksDIKlS3Ti7/Lq+qQhpsi 9sPHccgFCynfPML3VpL/qOrOGvjLW3Kb9YcG0hVStMH6FOslZDuTL6Mq0QY2DF3FaKXOL4 4s0B+MgtwOcrBB+DyOj39jWdOYTUmJv+GKwccnof/s+bUwCGsr3un9BCmpy8zI2SHqFpCg 1vplS0TNRcodJZTw96UPeFtGLPK4cTEqqPgD45tQLnIdMJZzh+ZNpXk9EHcijsje9TyQcw ti+ApLz6bAyhELd83yJnUbB9kz4CJGiCrbV5IOijUBU+7Ds0fPFUH+vYxdDiJg== 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 4R2jhR3RB9zXR8; Fri, 14 Jul 2023 20:27:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36EKRZ64093532; Fri, 14 Jul 2023 20:27:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36EKRZa8093531; Fri, 14 Jul 2023 20:27:35 GMT (envelope-from git) Date: Fri, 14 Jul 2023 20:27:35 GMT Message-Id: <202307142027.36EKRZa8093531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: 3f5788e0ed8e - main - lib/libc/string/ffs*.c: work around gcc warning List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f5788e0ed8e85567f651ad360596b8c330af5a9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=3f5788e0ed8e85567f651ad360596b8c330af5a9 commit 3f5788e0ed8e85567f651ad360596b8c330af5a9 Author: Robert Clausecker AuthorDate: 2023-07-10 22:10:52 +0000 Commit: Robert Clausecker CommitDate: 2023-07-14 20:26:43 +0000 lib/libc/string/ffs*.c: work around gcc warning Gcc warns of infinite recursion if we use __builtin_ffs*() to implement ffs*(). This is because gcc uses ffs() to implement these on some platforms. Sidestep the warning by using __builtin_ctz*() for these. Sponsored by: FreeBSD Foundation Reported by: jlduran@gmail.com, jhb Fixes: ee8b0c43 (D40730) Reviewed by: jhb, mhorne Approved by: jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D40966 --- lib/libc/string/ffs.c | 2 +- lib/libc/string/ffsl.c | 2 +- lib/libc/string/ffsll.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libc/string/ffs.c b/lib/libc/string/ffs.c index c011b3390612..34140e3e4d85 100644 --- a/lib/libc/string/ffs.c +++ b/lib/libc/string/ffs.c @@ -47,5 +47,5 @@ __FBSDID("$FreeBSD$"); int ffs(int mask) { - return (__builtin_ffs(mask)); + return (mask == 0 ? 0 : __builtin_ctz(mask) + 1); } diff --git a/lib/libc/string/ffsl.c b/lib/libc/string/ffsl.c index 6e1ac8ec45c1..701e23cdf8f4 100644 --- a/lib/libc/string/ffsl.c +++ b/lib/libc/string/ffsl.c @@ -44,5 +44,5 @@ __FBSDID("$FreeBSD$"); int ffsl(long mask) { - return (__builtin_ffsl(mask)); + return (mask == 0 ? 0 : __builtin_ctzl(mask) + 1); } diff --git a/lib/libc/string/ffsll.c b/lib/libc/string/ffsll.c index b945658b9008..e94fb518eb03 100644 --- a/lib/libc/string/ffsll.c +++ b/lib/libc/string/ffsll.c @@ -44,5 +44,5 @@ __FBSDID("$FreeBSD$"); int ffsll(long long mask) { - return (__builtin_ffsll(mask)); + return (mask == 0 ? 0 : __builtin_ctzll(mask) + 1); }