This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 05/12] RISC-V: Generic <string.h> Routines
On 14/06/2017 17:51, Joseph Myers wrote:
> On Wed, 14 Jun 2017, Palmer Dabbelt wrote:
>
>> sysdeps/riscv/bits/string.h | 25 +++++++
>
> bits/string.h is about to go away, you might wish to work relative to
> Zack's patch <https://sourceware.org/ml/libc-alpha/2017-06/msg00497.html>
> (or indeed help review it).
>
>> diff --git a/sysdeps/riscv/bits/string.h b/sysdeps/riscv/bits/string.h
>> new file mode 100644
>> index 0000000000..8160b8cc77
>> --- /dev/null
>> +++ b/sysdeps/riscv/bits/string.h
>> @@ -0,0 +1,25 @@
>> +/* This file should provide inline versions of string functions.
>> +
>> + Surround GCC-specific parts with #ifdef __GNUC__, and use `__extern_inline'.
>> +
>> + This file should define __STRING_INLINES if functions are actually defined
>> + as inlines. */
>> +
>> +#ifndef _BITS_STRING_H
>> +#define _BITS_STRING_H 1
>> +
>> +#define _STRING_INLINE_unaligned 0
>> +
>> +#if defined(__GNUC__) && !defined(__cplusplus)
>> +
>> +static __inline__ unsigned long __libc_detect_null(unsigned long w)
>
> That obviously should not go in a public header (and isn't namespace-clean
> anyway).
>
>> diff --git a/sysdeps/riscv/memcpy.c b/sysdeps/riscv/memcpy.c
>> new file mode 100644
>> index 0000000000..f816a54b9b
>> --- /dev/null
>> +++ b/sysdeps/riscv/memcpy.c
>> @@ -0,0 +1,74 @@
>
> Should have copyright and license notice.
>
>> diff --git a/sysdeps/riscv/strcpy.c b/sysdeps/riscv/strcpy.c
>> new file mode 100644
>> index 0000000000..c01c506a55
>> --- /dev/null
>> +++ b/sysdeps/riscv/strcpy.c
>> @@ -0,0 +1,54 @@
>
> Likewise. Is there an actual advantage over the generic version based on
> memcpy and strlen?
>
>> diff --git a/sysdeps/riscv/strlen.c b/sysdeps/riscv/strlen.c
>> new file mode 100644
>> index 0000000000..049e1ebd8f
>> --- /dev/null
>> +++ b/sysdeps/riscv/strlen.c
>> @@ -0,0 +1,39 @@
>
> Likewise. This looks like fairly generic C. Would RTH's generic string
> function improvements
> <https://sourceware.org/ml/libc-alpha/2016-12/msg00830.html> be helpful to
> RISC-V? If so, helping to review them might save you from maintaining
> some architecture-specific variants in future.
>
Btw, I plan to update RTH's patch with some fixes and changes.