arichardson added inline comments.

================
Comment at: include/clang/Basic/Builtins.def:942
 LIBBUILTIN(alloca, "v*z",         "f",     "stdlib.h", ALL_GNU_LANGUAGES)
+LIBBUILTIN(qsort_r, "",           "fC<3,-1,-1,4>", "stdlib.h", 
ALL_GNU_LANGUAGES)
 // POSIX string.h
----------------
qsort_r callback argument order is different on Linux, macOS and FreeBSD so 
those constants can't be hardcoded: 
Linux:
`void qsort_r(void *base, size_t nmemb, size_t size, int (*compar)(const void 
*, const void *, void *), void *arg);`
FreeBSD:
`void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, int 
(*compar)(void *, const void *, const void*));`
macos:
`void qsort_r(void *base, size_t nel, size_t width, void *thunk, int 
(*compar)(void *, const void *, const void *));`


================
Comment at: test/CodeGen/callback_qsort_r.c:1
+// RUN: %clang %s -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -D_GNU_SOURCE %s -S -c -emit-llvm -o - -O1 | FileCheck %s 
--check-prefix=IR
----------------
This should use a linux triple otherwise the qsort_r declaration is wrong. 
Ideally it should also handle macos+FreeBSD with the inverted argument order.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55483/new/

https://reviews.llvm.org/D55483



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to