From nobody Tue Jun 23 20:53:09 2026 X-Original-To: dev-commits-src-branches@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 4glHMv4Lnnz6j5wj for ; Tue, 23 Jun 2026 20:53:15 +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 4glHMp1BH0z3HdY for ; Tue, 23 Jun 2026 20:53:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782247990; 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=HhP7UTIie1NO7CxchgPyYc9qMqon18sYifZaQyzHhQQ=; b=QBdYoOvof9L7a+CyClDtJ96GnV5cv8UG9qLZVo46zyuhgLUG279YMtpKfnAxOTRYDcFc/e HZmGxW0ux74LAbY71RYFVk3uRiFy/8XK2PB1k137Mjx5HU3aja84g2dsSROJ5lzIJt/XOj jrxylUKm8hkrGCcuaVqjUaoqaPlYBIY7Wj6PB2eouKdnkgE9W1qG0sxMzrrI9PAdAqoEYm F2OojlPUgdcJTAEEfgESDmgP87Ah14gVEWphTc/xaf8/Z3SoCWy9p4x5Um9CnVwcJI9VVF iZTZhwcQYSP1PHyNUf4pYfI2NueJVMtESbchFUhgBSTJ+BqNmh3NtLGB1L1nsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782247990; a=rsa-sha256; cv=none; b=aUbNnCbW6OiWrkgBpFEFc9shd3qefI2mVfKEEh4Bktyuay6U2/CURY8OKvZPTtNurLVZqk kJVQPob/qABh8tisvRQUFUnEaT4cO+lTo7oOcuvGuHSS9yvtyzkg+u7b6RJBeltdYQ9IMy gIT0uNwyAtA07b3a+/3aSMBIk02O1mPW2KSIrtiuvo4npVI68PUzaPBTFT40MxjNLybNPx 1HF8gQtw56127lWyj1FETrw03fbJvndSjzBQH5vDXyZ6hr3WuuoLv1LG7JWHWXTnKbYCgN fSmnjdbtjmKq5YW2bACl73dZGRMaGJHWJ52x/+HgxPX2X0ARzKna3sQTkC99mw== 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=1782247990; 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=HhP7UTIie1NO7CxchgPyYc9qMqon18sYifZaQyzHhQQ=; b=P0A2bfVlWgPmx9D6LZmdtLFT//+/sRuYqLgSxUFUvf8SVtPKF+gwfCE+jHjH46Rt9Jyw6z iq/r//V6cmE80xmZ2CLiOYBjE1UT71MZuax/FrL0Tpjbz0zdE4StmzKszZnIlD/Vr24Bdb QPiLzOYvH6CzqsXFFoZQegYyf3v6s4wg+C5ii4jvBHuAIy6mqUFxborq7OcO919DZNN+Ch Sw9PHdZtmqK6Btsnh0GCT79MbEbIgJlcgK+/fvwH7kBcfqDeZ7suN7W2HqO9KrQaDtXESv o99+fNUyEMvjywBZSLLrfQcnJg0O9kj+Wzc0FxB+9x+fxMGnEKoWz36v4E47lA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4glHMn6fmZzqcB for ; Tue, 23 Jun 2026 20:53:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19862 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 23 Jun 2026 20:53:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: ShengYi Hung Subject: git: 9f2b898a0f32 - stable/15 - libc: Use slow path in fenv in C++ List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: aokblast X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 9f2b898a0f321c7d6e229733c604b99147a1dd0c Auto-Submitted: auto-generated Date: Tue, 23 Jun 2026 20:53:09 +0000 Message-Id: <6a3af235.19862.17dc0c1c@gitrepo.freebsd.org> The branch stable/15 has been updated by aokblast: URL: https://cgit.FreeBSD.org/src/commit/?id=9f2b898a0f321c7d6e229733c604b99147a1dd0c commit 9f2b898a0f321c7d6e229733c604b99147a1dd0c Author: ShengYi Hung AuthorDate: 2026-06-04 08:58:28 +0000 Commit: ShengYi Hung CommitDate: 2026-06-23 20:52:58 +0000 libc: Use slow path in fenv in C++ C++ exposes cfenv functions via using ::func. Our name-mangling mechanism rewrites all function calls causing symbols such as std::feclearexcept to be transformed into std::__feclearexcept_int. Since no such function exists, compilation fails. The using ::feclearexpect declarations themselves are unaffected because they are not function calls, which further exposes the mismatch As a result, enable the fast path only for C and fall back to the slow path in C++. Reviewed by: kib Fixes: 5bc64b7d417d MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57450 (cherry picked from commit 9c0489508695fde3bdd742edfd1b4b681aab4d19) --- lib/msun/aarch64/fenv.h | 10 ++++++++++ lib/msun/arm/fenv.h | 10 ++++++++++ lib/msun/powerpc/fenv.h | 12 ++++++++++++ lib/msun/riscv/fenv.h | 12 ++++++++++++ lib/msun/x86/fenv.h | 10 ++++++++++ 5 files changed, 54 insertions(+) diff --git a/lib/msun/aarch64/fenv.h b/lib/msun/aarch64/fenv.h index 5d47940cf9eb..aebcd99909ce 100644 --- a/lib/msun/aarch64/fenv.h +++ b/lib/msun/aarch64/fenv.h @@ -96,6 +96,15 @@ int feenableexcept(int); int fedisableexcept(int); int fegetexcept(void); +/* + * C permits a standard library function to also be exposed as a function-like + * macro (C23 7.1.4), and msun uses that here to inline the fast path. C++ + * forbids it: imports these names into namespace std (using + * ::feclearexcept; etc.), so std::feclearexcept() and friends must denote the + * actual functions. Expose the inlining macros to C only; C++ uses the real + * extern functions (defined in the matching lib/msun//fenv.c). + */ +#ifndef __cplusplus #define feclearexcept(a) __feclearexcept_int(a) #define fegetexceptflag(e, a) __fegetexceptflag_int(e, a) #define fesetexceptflag(e, a) __fesetexceptflag_int(e, a) @@ -110,6 +119,7 @@ int fegetexcept(void); #define feenableexcept(a) __feenableexcept_int(a) #define fedisableexcept(a) __fedisableexcept_int(a) #define fegetexcept() __fegetexcept_int() +#endif /* !__cplusplus */ __fenv_static inline int __feclearexcept_int(int __excepts) diff --git a/lib/msun/arm/fenv.h b/lib/msun/arm/fenv.h index 78ca9ef0f589..6febbf95008d 100644 --- a/lib/msun/arm/fenv.h +++ b/lib/msun/arm/fenv.h @@ -129,6 +129,15 @@ int fedisableexcept(int); int fegetexcept(void); #endif +/* + * C permits a standard library function to also be exposed as a function-like + * macro (C23 7.1.4), and msun uses that here to inline the fast path. C++ + * forbids it: imports these names into namespace std (using + * ::feclearexcept; etc.), so std::feclearexcept() and friends must denote the + * actual functions. Expose the inlining macros to C only; C++ uses the real + * extern functions (defined in the matching lib/msun//fenv.c). + */ +#ifndef __cplusplus #define feclearexcept(a) __feclearexcept_int(a) #define fegetexceptflag(e, a) __fegetexceptflag_int(e, a) #define fesetexceptflag(e, a) __fesetexceptflag_int(e, a) @@ -145,6 +154,7 @@ int fegetexcept(void); #define fedisableexcept(a) __fedisableexcept_int(a) #define fegetexcept() __fegetexcept_int() #endif +#endif /* !__cplusplus */ __fenv_static inline int __feclearexcept_int(int __excepts) diff --git a/lib/msun/powerpc/fenv.h b/lib/msun/powerpc/fenv.h index 21a99e0fbb5f..e401603793ab 100644 --- a/lib/msun/powerpc/fenv.h +++ b/lib/msun/powerpc/fenv.h @@ -142,6 +142,15 @@ int feholdexcept(fenv_t *); int fesetenv(const fenv_t *); int feupdateenv(const fenv_t *); +/* + * C permits a standard library function to also be exposed as a function-like + * macro (C23 7.1.4), and msun uses that here to inline the fast path. C++ + * forbids it: imports these names into namespace std (using + * ::feclearexcept; etc.), so std::feclearexcept() and friends must denote the + * actual functions. Expose the inlining macros to C only; C++ uses the real + * extern functions (defined in the matching lib/msun//fenv.c). + */ +#ifndef __cplusplus #define feclearexcept(a) __feclearexcept_int(a) #define fegetexceptflag(e, a) __fegetexceptflag_int(e, a) #define fesetexceptflag(e, a) __fesetexceptflag_int(e, a) @@ -153,6 +162,7 @@ int feupdateenv(const fenv_t *); #define feholdexcept(e) __feholdexcept_int(e) #define fesetenv(e) __fesetenv_int(e) #define feupdateenv(e) __feupdateenv_int(e) +#endif /* !__cplusplus */ __fenv_static inline int __feclearexcept_int(int __excepts) @@ -289,8 +299,10 @@ __feupdateenv_int(const fenv_t *__envp) int feenableexcept(int); int fedisableexcept(int); +#ifndef __cplusplus /* see the note above; C++ uses the real functions */ #define feenableexcept(a) __feenableexcept_int(a) #define fedisableexcept(a) __fedisableexcept_int(a) +#endif __fenv_static inline int __feenableexcept_int(int __mask) diff --git a/lib/msun/riscv/fenv.h b/lib/msun/riscv/fenv.h index 1059744941f3..199ca1806684 100644 --- a/lib/msun/riscv/fenv.h +++ b/lib/msun/riscv/fenv.h @@ -91,6 +91,15 @@ int feholdexcept(fenv_t *); int fesetenv(const fenv_t *); int feupdateenv(const fenv_t *); +/* + * C permits a standard library function to also be exposed as a function-like + * macro (C23 7.1.4), and msun uses that here to inline the fast path. C++ + * forbids it: imports these names into namespace std (using + * ::feclearexcept; etc.), so std::feclearexcept() and friends must denote the + * actual functions. Expose the inlining macros to C only; C++ uses the real + * extern functions (defined in the matching lib/msun//fenv.c). + */ +#ifndef __cplusplus #define feclearexcept(a) __feclearexcept_int(a) #define fegetexceptflag(e, a) __fegetexceptflag_int(e, a) #define fesetexceptflag(e, a) __fesetexceptflag_int(e, a) @@ -102,6 +111,7 @@ int feupdateenv(const fenv_t *); #define feholdexcept(e) __feholdexcept_int(e) #define fesetenv(e) __fesetenv_int(e) #define feupdateenv(e) __feupdateenv_int(e) +#endif /* !__cplusplus */ __fenv_static inline int __feclearexcept_int(int __excepts) @@ -224,8 +234,10 @@ __feupdateenv_int(const fenv_t *__envp) int feenableexcept(int); int fedisableexcept(int); +#ifndef __cplusplus /* see the note above; C++ uses the real functions */ #define feenableexcept(a) __feenableexcept_int(a) #define fedisableexcept(a) __fedisableexcept_int(a) +#endif __fenv_static inline int __feenableexcept_int(int __mask __unused) diff --git a/lib/msun/x86/fenv.h b/lib/msun/x86/fenv.h index b5da37902083..cb44624a858a 100644 --- a/lib/msun/x86/fenv.h +++ b/lib/msun/x86/fenv.h @@ -150,12 +150,22 @@ int fesetround(int); int fegetround(void); int fesetenv(const fenv_t *); +/* + * C permits a standard library function to also be exposed as a function-like + * macro (C23 7.1.4), and msun uses that here to inline the fast path. C++ + * forbids it: imports these names into namespace std (using + * ::feclearexcept; etc.), so std::feclearexcept() and friends must denote the + * actual functions. Expose the inlining macros to C only; C++ uses the real + * extern functions (defined in the matching lib/msun//fenv.c). + */ +#ifndef __cplusplus #define feclearexcept(a) __feclearexcept_int(a) #define fegetexceptflag(e, a) __fegetexceptflag_int(e, a) #define fetestexcept(a) __fetestexcept_int(a) #define fesetround(a) __fesetround_int(a) #define fegetround() __fegetround_int() #define fesetenv(a) __fesetenv_int(a) +#endif /* !__cplusplus */ #ifdef __i386__