aboutsummaryrefslogtreecommitdiff
path: root/gcc/system.h
diff options
context:
space:
mode:
authorAlexander Monakov <amonakov@ispras.ru>2018-05-13 21:23:06 +0300
committerAlexander Monakov <amonakov@gcc.gnu.org>2018-05-13 21:23:06 +0300
commit82a04cd1d37bfaf10de8f648e35d40c91853d026 (patch)
tree0f08f3d658c0f7ea3c270d1428051151b0c20614 /gcc/system.h
parent628332f85dbcd0996f68afae47b2b6d134b7b268 (diff)
downloadgcc-82a04cd1d37bfaf10de8f648e35d40c91853d026.zip
gcc-82a04cd1d37bfaf10de8f648e35d40c91853d026.tar.gz
gcc-82a04cd1d37bfaf10de8f648e35d40c91853d026.tar.bz2
Introduce gcc_qsort
* sort.cc: New file. * system.h [!CHECKING_P] (qsort): Redirect to gcc_qsort. * vec.c (qsort_chk): Use gcc_qsort. * Makefile.in (OBJS-libcommon): Add sort.o. (build/sort.o): New target. Use it... (BUILD_RTL): ... here, and... (build/gencfn-macros): ... here, and... (build/genmatch): ... here. From-SVN: r260216
Diffstat (limited to 'gcc/system.h')
-rw-r--r--gcc/system.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/system.h b/gcc/system.h
index 4abc321..88dffcc 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -1202,11 +1202,14 @@ helper_const_non_const_cast (const char *p)
/* 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
+void qsort_chk (void *, size_t, size_t, int (*)(const void *, const void *));
+void gcc_qsort (void *, size_t, size_t, int (*)(const void *, const void *));
#define PP_5th(a1, a2, a3, a4, a5, ...) a5
#undef qsort
+#if CHECKING_P
#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 *));
+#else
+#define qsort(...) PP_5th (__VA_ARGS__, gcc_qsort, 3, 2, qsort, 0) (__VA_ARGS__)
#endif
#endif /* ! GCC_SYSTEM_H */