Files
freebsd/include/stdckdint.h
T
Mark Johnston 37bd69d43c sys: Add sys/ckdint.h
We have a C23 stdckdint.h header for userspace, which provides checked
addition, subtraction and multiplication.  We lack similar helpers in
the kernel, where they are regularly needed.

Let's just adopt the C23 macros.  For bonus points, I added a wrapper to
ensure that ignored an return value is raised as an error by the
compiler.

Reviewed by:	kib, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D58773
2026-08-17 18:41:36 +00:00

19 lines
292 B
C

/*-
* Copyright (c) 2023 Dag-Erling Smørgrav
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#ifndef __STDC_VERSION_STDCKDINT_H__
#define __STDC_VERSION_STDCKDINT_H__ 202311L
#include <sys/_visible.h>
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 2023
#include <sys/ckdint.h>
#endif
#endif