mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 19:34:43 +01:00
sys/limits.h: Add BOOL_MAX, BITINT_MAXWIDTH, and C23 feature test macro
Add BOOL_MAX and BITINT_MAXWIDTH macros for C23 compliance, and define the __STDC_VERSION_LIMITS_H__ feature test macro now that the header fully conforms to C23. Reviewed by: fuz Approved by: fuz (mentor) MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/2352
This commit is contained in:
3 files changed
+12
-4
No files matched your search
+3
-3
@@ -29,8 +29,8 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LIMITS_H_
|
||||
#define _LIMITS_H_
|
||||
#ifndef __STDC_VERSION_LIMITS_H__
|
||||
#define __STDC_VERSION_LIMITS_H__ 202311L
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
@@ -148,4 +148,4 @@
|
||||
#include <sys/syslimits.h>
|
||||
#endif
|
||||
|
||||
#endif /* !_LIMITS_H_ */
|
||||
#endif /* !__STDC_VERSION_LIMITS_H__ */
|
||||
@@ -69,6 +69,7 @@
|
||||
#endif
|
||||
|
||||
#if __ISO_C_VISIBLE >= 2023
|
||||
#define BOOL_MAX 1 /* max value for a bool */
|
||||
#define BOOL_WIDTH 1 /* number of bits in a bool */
|
||||
|
||||
#define CHAR_WIDTH __CHAR_BIT /* number of bits in a char */
|
||||
@@ -86,6 +87,12 @@
|
||||
|
||||
#define LLONG_WIDTH __LLONG_BIT /* number of bits in a long long */
|
||||
#define ULLONG_WIDTH __LLONG_BIT /* number of bits in an unsigned long long */
|
||||
|
||||
#ifdef __BITINT_MAXWIDTH__
|
||||
#define BITINT_MAXWIDTH __BITINT_MAXWIDTH__
|
||||
#else
|
||||
#define BITINT_MAXWIDTH ULLONG_WIDTH
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __POSIX_VISIBLE || __XSI_VISIBLE
|
||||
|
||||
+2
-1
@@ -32,7 +32,8 @@
|
||||
#ifndef _SYS_SYSLIMITS_H_
|
||||
#define _SYS_SYSLIMITS_H_
|
||||
|
||||
#if !defined(_STANDALONE) && !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_)
|
||||
#if !defined(_STANDALONE) && !defined(_KERNEL) && \
|
||||
!defined(__STDC_VERSION_LIMITS_H__) && !defined(_SYS_PARAM_H_)
|
||||
#warning "No user-serviceable parts inside."
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user