Re: git: 8dcf3a82c54c - main - libc: Implement bsort(3) a bitonic type of sorting algorithm.

From: Charlie Li <vishwin_at_freebsd.org>
Date: Wed, 19 Apr 2023 19:07:15 UTC
Hans Petter Selasky wrote:
> diff --git a/include/stdlib.h b/include/stdlib.h
> index 730223e7fd77..857092b9053e 100644
> --- a/include/stdlib.h
> +++ b/include/stdlib.h
> @@ -107,6 +107,10 @@ void	*malloc(size_t) __malloc_like __result_use_check __alloc_size(1);
>   int	 mblen(const char *, size_t);
>   size_t	 mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
>   int	 mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
> +#if __BSD_VISIBLE
> +void	 bsort(void *, size_t, size_t,
> +	    int (* _Nonnull)(const void *, const void *));
> +#endif
>   void	 qsort(void *, size_t, size_t,
>   	    int (* _Nonnull)(const void *, const void *));
>   int	 rand(void);
> @@ -300,6 +304,8 @@ int	 heapsort(void *, size_t, size_t,
>   #ifdef __BLOCKS__
>   int	 heapsort_b(void *, size_t, size_t,
>   	    int (^ _Nonnull)(const void *, const void *));
> +void	 bsort_b(void *, size_t, size_t,
> +	    int (^ _Nonnull)(const void *, const void *));
>   void	 qsort_b(void *, size_t, size_t,
>   	    int (^ _Nonnull)(const void *, const void *));
>   #endif
> @@ -313,6 +319,8 @@ int	 mkostemps(char *, int, int);
>   int	 mkostempsat(int, char *, int, int);
>   void	 qsort_r(void *, size_t, size_t,
>   	    int (*)(const void *, const void *, void *), void *);
> +void	 bsort_r(void *, size_t, size_t,
> +	    int (*)(const void *, const void *, void *), void *);
>   int	 radixsort(const unsigned char **, int, const unsigned char *,
>   	    unsigned);
>   void	*reallocarray(void *, size_t, size_t) __result_use_check
> @@ -397,6 +405,11 @@ errno_t	 qsort_s(void *, rsize_t, rsize_t,
>       int (*)(const void *, const void *, void *), void *);
>   #endif /* __EXT1_VISIBLE */
>   
> +#if __BSD_VISIBLE
> +errno_t	 bsort_s(void *, rsize_t, rsize_t,
> +    int (*)(const void *, const void *, void *), void *);
> +#endif /* __BSD_VISIBLE */
> +
>   __END_DECLS
>   __NULLABILITY_PRAGMA_POP
>   
This causes ports to fail, so far with Python's configure phase and any 
Python ports with C extensions:

In file included from /usr/local/include/python3.11/Python.h:23:
/usr/include/stdlib.h:409:1: error: unknown type name 'errno_t'
errno_t  bsort_s(void *, rsize_t, rsize_t,
^
/usr/include/stdlib.h:409:35: error: redefinition of parameter 'rsize_t'
errno_t  bsort_s(void *, rsize_t, rsize_t,
                                   ^
/usr/include/stdlib.h:409:26: note: previous declaration is here
errno_t  bsort_s(void *, rsize_t, rsize_t,
                          ^
2 errors generated.

-- 
Charlie Li
…nope, still don't have an exit line.