diff options
Diffstat (limited to 'gcc/system.h')
-rw-r--r-- | gcc/system.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/system.h b/gcc/system.h index 59449f1..f0664e9 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -1181,4 +1181,14 @@ helper_const_non_const_cast (const char *p) /* Get definitions of HOST_WIDE_INT. */ #include "hwint.h" +/* qsort comparator consistency checking: except in release-checking compilers, + redirect 4-argument qsort calls to qsort_chk; keep 1-argument invocations + corresponding to vec::qsort (cmp): they use C qsort internally anyway. */ +#if CHECKING_P +#define PP_5th(a1, a2, a3, a4, a5, ...) a5 +#undef qsort +#define qsort(...) PP_5th (__VA_ARGS__, qsort_chk, 3, 2, qsort, 0) (__VA_ARGS__) +void qsort_chk (void *, size_t, size_t, int (*)(const void *, const void *)); +#endif + #endif /* ! GCC_SYSTEM_H */ |