From nobody Fri Jun 26 16:48:18 2026 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 4gn1nt4vvBz6jm79 for ; Fri, 26 Jun 2026 16:48:18 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gn1nt4PbFz49tm for ; Fri, 26 Jun 2026 16:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782492498; 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=SLYSc4MiJDBoaE8T8LkrHZyjvClDrI7OMGvIg2fKt+s=; b=g/aHRLw/kaWNcaLORHHeNSTQ9weRroCTzq2y5Vb9Kh8ire98YsFys1UrnFsBctrUOTHXX6 veYKE4qmHu35vLb0m/6jOsiP/GJezdLiPK26eDVuplEfh9shA+74nxwEHF+LqWpSxBRBPU cZ2zzCccwNX4w15MhaxhANRqdhSs8qNphFcvL1Qwa5uRjaIX2WqwCsTNMoqJICrc23BsGo nU8Qc0yoF8y5GZyXRu4vuGqjbiK/vjMAvxoHFu9GWTs0AnrWNR1WjCXA6u0HSxCMxW4F7E dxLi4t0egV1A41PYyQ6M+S3OL+FsOSx6jHH53x3lVKJAEqeZQzhV0ryZq7DeSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782492498; a=rsa-sha256; cv=none; b=eVxACSMmE853QjMKfjRUc8RT1b/OeYzMQRHNt6nqwgVbCcZmSl/JiSo/Y1z2TIwBo2zUaB IXY0qohAdB9m9IjFCVKy9gpsp+gxF/2jEYbzVCc+1XQy0pkeTAtQ7e6OIqO5imgmSZwCkt J1LVUf2GHknfBUz9eO2FyVVWeH0v1dJv7lGBfveJrHJmANRrh0YumV2K2mOUC5uanbJamx CLl+vEjLB7m1cH+jKiqevQRlxOz94cPg8TutonMR73HxzUGxKJmnEUV1OlVBjKxqvmqD4u zE9u1YLJv9TRd1i9BEM9HNDtP2UAmcetYlRla+MskLs6M6GRI9J9RSDC5mW/Rw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782492498; 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=SLYSc4MiJDBoaE8T8LkrHZyjvClDrI7OMGvIg2fKt+s=; b=QdFiajMpKGLL+rYRTjf+sRxLrhBdKuyX6eJpWT4doYRj7NDdKimSivVnymAS1+R70Fgs58 nPADnrb4tVWBtduiMfFSqp5k1rQ5FJya8DZBowyMGDQwzgYP/zapkw9wUMnFDCI3NX6jiI bQSHcsCpuUx46gOOS5t07DIART6pO1D3fVCJMgeNcQA0VeCMB0wN5iSo32etDn2do6udHo jyXJKD0Wrc91a3s2FfhDzrSP2ISDnMcxwW6XJkY1n6tOKDJzeyyDm/U4I+jSzLIADaXBJe nTJdk+Jj02S2MNiyvP82KP/JEqWAATWnLgRhYvs5CvP9T3v7F+zYk+QXSHlN9g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gn1nt3KZjzm6j for ; Fri, 26 Jun 2026 16:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3187d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 26 Jun 2026 16:48:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 2515e3f6776a - main - cdefs(9): encourage __nodiscard over __result_use_check 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2515e3f6776a3f95c888be5e58b28df0ffbe3dd8 Auto-Submitted: auto-generated Date: Fri, 26 Jun 2026 16:48:18 +0000 Message-Id: <6a3ead52.3187d.dba871d@gitrepo.freebsd.org> The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=2515e3f6776a3f95c888be5e58b28df0ffbe3dd8 commit 2515e3f6776a3f95c888be5e58b28df0ffbe3dd8 Author: Brooks Davis AuthorDate: 2026-06-26 16:41:40 +0000 Commit: Brooks Davis CommitDate: 2026-06-26 16:41:40 +0000 cdefs(9): encourage __nodiscard over __result_use_check __nodiscard is closer to (and sometimes expands to) [[nodiscard]] from C23 and C++17 so prefer it to the homegrown __result_use_check. When __nodiscard does expand to [[nodiscard]] it must appear entierly before the function declaration (or between the function name and argument list) so relocate as appropriate. This differs from __attribute__((__warn_unused_result__)) used by __result_use_check which is more flexible. Reviewed by: imp, markj, emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D57881 --- share/man/man9/cdefs.9 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/man/man9/cdefs.9 b/share/man/man9/cdefs.9 index 2bda50c3f875..9edfeec70bc6 100644 --- a/share/man/man9/cdefs.9 +++ b/share/man/man9/cdefs.9 @@ -3,7 +3,7 @@ .\" .\" SPDX-License-Identifier: BSD-2-Clause .\" -.Dd May 6, 2026 +.Dd June 26, 2026 .Dt CDEFS 9 .Os .Sh NAME @@ -121,6 +121,9 @@ family of functions. .Dq fastcall ABI to call and name mangle this function. .It Sy __result_use_check Ta Warn if function caller does not use its return value +Obsolete, use +.Sy __nodiscard +instead. .It Sy __nodiscard Ta Equivalent to the standard .Dq [[nodiscard]] attribute. @@ -134,6 +137,9 @@ If applied to a struct, C++ class or enum, this applies to all functions returning values of that type. If applied to a C++ constructor, this applies to creating instances of the class using that constructor. +Note that +.Sy __nodiscard +must appear before the function declaration. .It Sy __returns_twice Ta Returns multiple times, like .Xr fork 2 .It Sy __unreachable Ta This code is not reachable at runtime