Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Feb 2026 15:28:12 +0000
From:      Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Cc:        Konstantin Belousov <kib@FreeBSD.org>
Subject:   git: 9748212e619b - stable/13 - include/stdckdint.h: make the header compatible with C++
Message-ID:  <698b4e8c.43ff6.32072bce@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/13 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=9748212e619b7608ac50ad6d0a768b20d5c9fd0b

commit 9748212e619b7608ac50ad6d0a768b20d5c9fd0b
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-10-17 03:49:14 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-02-10 14:24:30 +0000

    include/stdckdint.h: make the header compatible with C++
    
    by removing the cast to _Bool.  The _Bool type is not defined for C++,
    and the specification from the gcc info doc states that the return
    type of the  __builtin_{add,sub,mul}_overflow() is bool already.
    
    This is done instead of including stdbool.h to avoid namespace
    pollution, since defining bool from stdckdint.h simingly is not
    sanctioned by ISO/IEC 9899:2024.
    
    PR:     290299
    Reviewed by:    des
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D53149
    
    (cherry picked from commit 3c052bec12fcf09f81ba0760ebecec38e196d332)
---
 include/stdckdint.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/stdckdint.h b/include/stdckdint.h
index af3074dded89..9cb877fe8198 100644
--- a/include/stdckdint.h
+++ b/include/stdckdint.h
@@ -13,7 +13,7 @@
 
 #if __GNUC_PREREQ__(5, 1) || __has_builtin(__builtin_add_overflow)
 #define ckd_add(result, a, b)						\
-	(_Bool)__builtin_add_overflow((a), (b), (result))
+	__builtin_add_overflow((a), (b), (result))
 #else
 #define ckd_add(result, a, b)						\
 	_Static_assert(0, "checked addition not supported")
@@ -21,7 +21,7 @@
 
 #if __GNUC_PREREQ__(5, 1) || __has_builtin(__builtin_sub_overflow)
 #define ckd_sub(result, a, b)						\
-	(_Bool)__builtin_sub_overflow((a), (b), (result))
+	__builtin_sub_overflow((a), (b), (result))
 #else
 #define ckd_sub(result, a, b)						\
 	_Static_assert(0, "checked subtraction not supported")
@@ -29,7 +29,7 @@
 
 #if __GNUC_PREREQ__(5, 1) || __has_builtin(__builtin_mul_overflow)
 #define ckd_mul(result, a, b)						\
-	(_Bool)__builtin_mul_overflow((a), (b), (result))
+	__builtin_mul_overflow((a), (b), (result))
 #else
 #define ckd_mul(result, a, b)						\
 	_Static_assert(0, "checked multiplication not supported")


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?698b4e8c.43ff6.32072bce>