On 27/10/2020 13:36, Jan Kiszka wrote:
> On 22.10.20 19:58, Andrea Bastoni wrote:
>> This solves warnings due to -Wbuiltin-declaration-mismatch
>>
>> Signed-off-by: Andrea Bastoni <[email protected]>
>> ---
>>  hypervisor/include/jailhouse/string.h | 5 +++--
>>  hypervisor/include/jailhouse/types.h  | 8 ++++++++
>>  hypervisor/lib.c                      | 6 +++---
>>  3 files changed, 14 insertions(+), 5 deletions(-)
>>
>> diff --git a/hypervisor/include/jailhouse/string.h 
>> b/hypervisor/include/jailhouse/string.h
>> index 24f0b0b4..7dc3de3b 100644
>> --- a/hypervisor/include/jailhouse/string.h
>> +++ b/hypervisor/include/jailhouse/string.h
>> @@ -12,9 +12,10 @@
>>   * This work is licensed under the terms of the GNU GPL, version 2.  See
>>   * the COPYING file in the top-level directory.
>>   */
>> +#include <jailhouse/types.h>
>>  
>> -void *memcpy(void *d, const void *s, unsigned long n);
>> -void *memset(void *s, int c, unsigned long n);
>> +void *memcpy(void *d, const void *s, size_t n);
>> +void *memset(void *s, int c, size_t n);
>>  
>>  int strcmp(const char *s1, const char *s2);
>>  
>> diff --git a/hypervisor/include/jailhouse/types.h 
>> b/hypervisor/include/jailhouse/types.h
>> index 828e40f7..f97dc252 100644
>> --- a/hypervisor/include/jailhouse/types.h
>> +++ b/hypervisor/include/jailhouse/types.h
>> @@ -55,6 +55,14 @@ typedef u32 __u32;
>>  typedef s64 __s64;
>>  typedef u64 __u64;
>>  
>> +#if BITS_PER_LONG == 64
>> +typedef unsigned long uptr_t;
>> +#else
>> +typedef unsigned int uptr_t;
>> +#endif
>> +
>> +typedef uptr_t size_t;
> 
> What's the benefit of the indirection via uptr_t?

Since I was adding a size dependent type, I thought to add an equivalent to
uintptr_t which could be used in other contexts. Probably I should have called
it uintptr_t directly.

>> +
>>  #endif /* !__ASSEMBLY__ */
>>  
>>  #endif /* !_JAILHOUSE_JAILHOUSE_TYPES_H */
>> diff --git a/hypervisor/lib.c b/hypervisor/lib.c
>> index fc9af7aa..e8a9733d 100644
>> --- a/hypervisor/lib.c
>> +++ b/hypervisor/lib.c
>> @@ -10,10 +10,10 @@
>>   * the COPYING file in the top-level directory.
>>   */
>>  
>> -#include <jailhouse/string.h>
>>  #include <jailhouse/types.h>
>> +#include <jailhouse/string.h>
> 
> If string.h needs types.h, it must include it itself - which you do
> above. So you can drop types.h from here.

Right.

> 
>>  
>> -void *memset(void *s, int c, unsigned long n)
>> +void *memset(void *s, int c, size_t n)
>>  {
>>      u8 *p = s;
>>  
>> @@ -33,7 +33,7 @@ int strcmp(const char *s1, const char *s2)
>>      return *(unsigned char *)s1 - *(unsigned char *)s2;
>>  }
>>  
>> -void *memcpy(void *dest, const void *src, unsigned long n)
>> +void *memcpy(void *dest, const void *src, size_t n)
>>  {
>>      const u8 *s = src;
>>      u8 *d = dest;
>>
> 
> Jan
> 

-- 
Thanks,
Andrea Bastoni

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/0c29c249-2a95-26dd-1790-9df1f4fbe2d5%40tum.de.

Reply via email to