[Skiboot] [PATCH V4 1/9] libc: Expand limits.h and include in stdint.h

Christophe Lombard clombard at linux.ibm.com
Sat Jun 24 01:36:47 AEST 2023



Le 21/06/2023 à 06:28, Nicholas Piggin a écrit :
> 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)

This is indeed a point to consider. I will look.

Thanks

>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/skiboot/attachments/20230623/c5a97fbf/attachment.htm>


More information about the Skiboot mailing list