diff options
author | Alexander Monakov <amonakov@ispras.ru> | 2019-08-01 20:14:53 +0300 |
---|---|---|
committer | Alexander Monakov <amonakov@gcc.gnu.org> | 2019-08-01 20:14:53 +0300 |
commit | ce0454d9419dbcd73e65dae2a3eba15eeddbe338 (patch) | |
tree | 77afb8b4e0b9aa4081ff1695ebd5ff725a38b365 /gcc/system.h | |
parent | f339eb66071559a02a0c05b3ee89fc8352969bc9 (diff) | |
download | gcc-ce0454d9419dbcd73e65dae2a3eba15eeddbe338.zip gcc-ce0454d9419dbcd73e65dae2a3eba15eeddbe338.tar.gz gcc-ce0454d9419dbcd73e65dae2a3eba15eeddbe338.tar.bz2 |
sort.cc: introduce gcc_sort_r
* sort.cc (sort_r_ctx): New struct.
(reorder23): Make templated on context type.
(reorder45): Ditto.
(cmp1): Ditto. Adjust signature.
(netsort): Ditto.
(mergesort): Ditto.
[CHECKING_P] (cmp2to3): New static function. Use it...
(gcc_qsort) [CHECKING_P]: ...here.
(gcc_sort_r): New function.
* system.h (sort_r_cmp_fn): New function typedef.
(qsort_chk): Adjust signature.
(gcc_sort_r): Declare.
* vec.c (qsort_chk_error): Adjust.
(qsort_chk): Adjust.
From-SVN: r273977
Diffstat (limited to 'gcc/system.h')
-rw-r--r-- | gcc/system.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/system.h b/gcc/system.h index d04f8fd..56af544 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -1197,13 +1197,14 @@ helper_const_non_const_cast (const char *p) /* Get definitions of HOST_WIDE_INT. */ #include "hwint.h" -/* GCC qsort API-compatible functions: except in release-checking compilers, - redirect 4-argument qsort calls to gcc_qsort; keep 1-argument invocations - corresponding to vec::qsort (cmp): they use C qsort internally anyway. */ -void qsort_chk (void *, size_t, size_t, int (*)(const void *, const void *)); +typedef int sort_r_cmp_fn (const void *, const void *, void *); +void qsort_chk (void *, size_t, size_t, sort_r_cmp_fn *, void *); +void gcc_sort_r (void *, size_t, size_t, sort_r_cmp_fn *, void *); void gcc_qsort (void *, size_t, size_t, int (*)(const void *, const void *)); void gcc_stablesort (void *, size_t, size_t, int (*)(const void *, const void *)); +/* Redirect four-argument qsort calls to gcc_qsort; one-argument invocations + correspond to vec::qsort, and use C qsort internally. */ #define PP_5th(a1, a2, a3, a4, a5, ...) a5 #undef qsort #define qsort(...) PP_5th (__VA_ARGS__, gcc_qsort, 3, 2, qsort, 0) (__VA_ARGS__) |