mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
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
19 lines
292 B
C
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
|