[Skiboot] [PATCH V4 1/9] libc: Expand limits.h and include in stdint.h
Nicholas Piggin
npiggin at gmail.com
Wed Jun 21 14:28:22 AEST 2023
On Wed Jun 21, 2023 at 12:51 AM AEST, Christophe Lombard wrote:
> Add maximum native integer size and limits of specified-width integer
> types.
> These types are required by the external library: libpldm.
For the libc and include changes, maybe add something in
libc/README.txt? It's not quite so well documented as some
other imports unfortunately.
Some changes look like they might be able to go upstream
too. But probably libc cleanup and rebase is a project all
on its own :(
Anyway these look fine for the most part except... libstb
defines a SIZE_MAX :( Is there any way the beams could cross?
Could libstb just use this one? (I wonder if that was a skiboot
specific change)
>
> Signed-off-by: Christophe Lombard <clombard at linux.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..0c85d2e2 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.40.1
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
More information about the Skiboot
mailing list