summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include/stdlib.h
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowi@redhat.com>2014-12-05 16:21:04 +0000
committerYaakov Selkowitz <yselkowi@redhat.com>2014-12-05 16:21:04 +0000
commitbf9897549dabfe002ebc8048e910706995383ae9 (patch)
tree1a3ac4f3d0bd39c1ef086e972f225ee3eca0a78d /newlib/libc/include/stdlib.h
parentce6c6a4d82f03cdc14ed72964ba718ace495ee6c (diff)
downloadcygnal-bf9897549dabfe002ebc8048e910706995383ae9.tar.gz
cygnal-bf9897549dabfe002ebc8048e910706995383ae9.tar.bz2
cygnal-bf9897549dabfe002ebc8048e910706995383ae9.zip
* libc/include/stdlib.h (__bsd_qsort_r): Declare.
(qsort_r): Declare. * libc/search/Makefile.am (ELIX_2_SOURCES): Rename from ELIX_SOURCES. (ELIX_4_SOURCES): Define. Add bsd_qsort_r.c and qsort_r.c. (libsearch_la_SOURCES): Adapt accordingly. (lib_a_SOURCES): Adapt accordingly. (CHEWOUT_FILES): Add qsort_r.def. * libc/search/Makefile.in: Regenerate. * libc/search/bsd_qsort_r.c: New file. * libc/search/qsort.c: Update from FreeBSD HEAD. Adapt for both BSD and GNU qsort_r flavors. * libc/search/qsort_r.c: New file.
Diffstat (limited to 'newlib/libc/include/stdlib.h')
-rw-r--r--newlib/libc/include/stdlib.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
index 9fc14fa3b..ffbb44349 100644
--- a/newlib/libc/include/stdlib.h
+++ b/newlib/libc/include/stdlib.h
@@ -248,6 +248,22 @@ int _EXFUN(_system_r,(struct _reent *, const char *));
_VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *));
+/* There are two common qsort_r variants. If you request
+ _BSD_SOURCE, you get the BSD version; otherwise you get the GNU
+ version. We want that #undef qsort_r will still let you
+ invoke the underlying function, but that requires gcc support. */
+#ifdef _BSD_SOURCE
+# ifdef __GNUC__
+_VOID _EXFUN(qsort_r,(_PTR __base, size_t __nmemb, size_t __size, _PTR __thunk, int (*_compar)(_PTR, const _PTR, const _PTR)))
+ __asm__ (__ASMNAME ("__bsd_qsort_r"));
+# else
+_VOID _EXFUN(__bsd_qsort_r,(_PTR __base, size_t __nmemb, size_t __size, _PTR __thunk, int (*_compar)(_PTR, const _PTR, const _PTR)));
+# define qsort_r __bsd_qsort_r
+# endif
+#elif __GNU_VISIBLE
+_VOID _EXFUN(qsort_r,(_PTR __base, size_t __nmemb, size_t __size, int (*_compar)(const _PTR, const _PTR, _PTR), _PTR __thunk));
+#endif
+
/* On platforms where long double equals double. */
#ifdef _HAVE_LONG_DOUBLE
#if !defined(__STRICT_ANSI__) || \