[Skiboot] [PATCH 01/10] libc: Expand limits.h and include in stdint.h

Christophe Lombard clombard at linux.vnet.ibm.com
Sat Feb 26 00:46:36 AEDT 2022


Add maximum native integer size and limits of specified-width integer
types.
These types are required by the external library: libpldm.

Signed-off-by: Christophe Lombard <clombard at linux.vnet.ibm.com>
---
 libc/include/limits.h | 6 ++++++
 libc/include/stdint.h | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/libc/include/limits.h b/libc/include/limits.h
index bfde9635..09f054a2 100644
--- a/libc/include/limits.h
+++ b/libc/include/limits.h
@@ -33,5 +33,11 @@
 
 #define 	UINT32_MAX	UINT_MAX
 #define 	INT32_MAX	INT_MAX
+#define 	UINT16_MAX	USHRT_MAX
+#define 	UINT8_MAX	UCHAR_MAX
+
+#ifndef SIZE_MAX
+#define SIZE_MAX (~0ull)
+#endif
 
 #endif
diff --git a/libc/include/stdint.h b/libc/include/stdint.h
index 2a2c1d91..080d875a 100644
--- a/libc/include/stdint.h
+++ b/libc/include/stdint.h
@@ -13,6 +13,9 @@
 #ifndef _STDINT_H
 #define _STDINT_H
 
+/* C99 requires *_MAX to be in stdint.h */
+#include <limits.h>
+
 typedef unsigned char uint8_t;
 typedef signed char int8_t;
 
-- 
2.35.1



More information about the Skiboot mailing list