git: 939430f23771 - stable/12 - Fix the build of scandir_b with GCC.

Ryan Libby rlibby at FreeBSD.org
Thu Dec 31 20:47:20 UTC 2020


The branch stable/12 has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=939430f23771bb2bdd85337a58f5ba0757f60782

commit 939430f23771bb2bdd85337a58f5ba0757f60782
Author:     John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2020-08-31 21:55:25 +0000
Commit:     Ryan Libby <rlibby at FreeBSD.org>
CommitDate: 2020-12-31 19:56:33 +0000

    Fix the build of scandir_b with GCC.
    
    Use explicit typedefs for block thunk structures as in r264143.
    
    Reviewed by:    kib, adrian
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D26256
    
    (cherry picked from commit d10af81d2defe43db0db0a7dca3eefb047bd8ddc)
---
 lib/libc/gen/scandir.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c
index 2b8d244bcc59..10cd7633dac1 100644
--- a/lib/libc/gen/scandir.c
+++ b/lib/libc/gen/scandir.c
@@ -56,15 +56,18 @@ void qsort_b(void *, size_t, size_t, void *);
 #define	SELECT(x)	select(x)
 #endif
 
-#ifndef I_AM_SCANDIR_B
+#ifdef I_AM_SCANDIR_B
+typedef DECLARE_BLOCK(int, select_block, const struct dirent *);
+typedef DECLARE_BLOCK(int, dcomp_block, const struct dirent **,
+    const struct dirent **);
+#else
 static int alphasort_thunk(void *thunk, const void *p1, const void *p2);
 #endif
 
 int
 #ifdef I_AM_SCANDIR_B
-scandir_b(const char *dirname, struct dirent ***namelist,
-    DECLARE_BLOCK(int, select, const struct dirent *),
-    DECLARE_BLOCK(int, dcomp, const struct dirent **, const struct dirent **))
+scandir_b(const char *dirname, struct dirent ***namelist, select_block select,
+    dcomp_block dcomp)
 #else
 scandir(const char *dirname, struct dirent ***namelist,
     int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **,


More information about the dev-commits-src-all mailing list