Re: svn commit: r364091 - head/lib/libc/gen

2020-08-28 Thread Konstantin Belousov
On Thu, Aug 27, 2020 at 05:28:03PM -0700, Adrian Chadd wrote:
> Hi!
> 
> This breaks when compiling FreeBSD-mips on GCC-9. :(
> 
> In file included from
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:50,
>  from
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir_b.c:29:
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/include/block_abi.h:45:2:
> error: anonymous struct declared inside parameter list will not be visible
> outside of this definition or declarati
>45 |  struct {\
>   |  ^~
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:67:5:
> note: in expansion of macro 'DECLARE_BLOCK'
>67 | DECLARE_BLOCK(int, dcomp, const struct dirent **, const struct
> dirent **))
>   | ^
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/include/block_abi.h:45:2:
> error: anonymous struct declared inside parameter list will not be visible
> outside of this definition or declarati
>45 |  struct {\
>   |  ^~
> /usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:66:5:
> note: in expansion of macro 'DECLARE_BLOCK'
>66 | DECLARE_BLOCK(int, select, const struct dirent *),
>   | ^
> cc1: all warnings being treated as errors
> --- scandir_b.o ---
> *** [scandir_b.o] Error code 1

You did not show the exact command line for your compilation failure.
Since gcc does not support blocks, I think the best route is to add
something like the following to lib/libc/gen/Makefile.inc:
CWARNFLAGS.gcc.scandir_b.c= -Wno-error
(I did not even tried to test it).
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364091 - head/lib/libc/gen

2020-08-27 Thread Adrian Chadd
{snip}

and for completeness sake, bsearch_b.c has the same issue but isn't
included in lib/Makefile; thus why it's not tripping the compiler error.



-adrian
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364091 - head/lib/libc/gen

2020-08-27 Thread Adrian Chadd
Hi!

This breaks when compiling FreeBSD-mips on GCC-9. :(

In file included from
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:50,
 from
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir_b.c:29:
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/include/block_abi.h:45:2:
error: anonymous struct declared inside parameter list will not be visible
outside of this definition or declarati
   45 |  struct {\
  |  ^~
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:67:5:
note: in expansion of macro 'DECLARE_BLOCK'
   67 | DECLARE_BLOCK(int, dcomp, const struct dirent **, const struct
dirent **))
  | ^
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/include/block_abi.h:45:2:
error: anonymous struct declared inside parameter list will not be visible
outside of this definition or declarati
   45 |  struct {\
  |  ^~
/usr/home/adrian/work/freebsd/head-embedded/src/lib/libc/gen/scandir.c:66:5:
note: in expansion of macro 'DECLARE_BLOCK'
   66 | DECLARE_BLOCK(int, select, const struct dirent *),
  | ^
cc1: all warnings being treated as errors
--- scandir_b.o ---
*** [scandir_b.o] Error code 1


-adrian
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364091 - head/lib/libc/gen

2020-08-10 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 10 21:41:49 2020
New Revision: 364091
URL: https://svnweb.freebsd.org/changeset/base/364091

Log:
  Export scandir_b from libc.
  
  Apparently it was not exported, because scandir_b.c was not included
  into libc SRCS.  Export it with the CURRENT-13 version.
  
  Also, because it was not exported before ino64, clean up
  scandir-compat11.c.
  
  PR:   248572
  Reported by:  Alex S 
  Reviewed by:  emaste
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D26020

Modified:
  head/lib/libc/gen/Makefile.inc
  head/lib/libc/gen/Symbol.map
  head/lib/libc/gen/scandir-compat11.c
  head/lib/libc/gen/scandir.c

Modified: head/lib/libc/gen/Makefile.inc
==
--- head/lib/libc/gen/Makefile.inc  Mon Aug 10 20:34:45 2020
(r364090)
+++ head/lib/libc/gen/Makefile.inc  Mon Aug 10 21:41:49 2020
(r364091)
@@ -120,6 +120,7 @@ SRCS+=  __getosreldate.c \
recvmmsg.c \
rewinddir.c \
scandir.c \
+   scandir_b.c \
scandir-compat11.c \
seed48.c \
seekdir.c \

Modified: head/lib/libc/gen/Symbol.map
==
--- head/lib/libc/gen/Symbol.mapMon Aug 10 20:34:45 2020
(r364090)
+++ head/lib/libc/gen/Symbol.mapMon Aug 10 21:41:49 2020
(r364091)
@@ -416,7 +416,6 @@ FBSD_1.5 {
readdir;
readdir_r;
scandir;
-   scandir_b;
sem_clockwait_np;
setproctitle_fast;
timespec_get;
@@ -424,6 +423,7 @@ FBSD_1.5 {
 
 FBSD_1.6 {
memalign;
+   scandir_b;
sigandset;
sigisemptyset;
sigorset;

Modified: head/lib/libc/gen/scandir-compat11.c
==
--- head/lib/libc/gen/scandir-compat11.cMon Aug 10 20:34:45 2020
(r364090)
+++ head/lib/libc/gen/scandir-compat11.cMon Aug 10 21:41:49 2020
(r364091)
@@ -49,32 +49,25 @@ __FBSDID("$FreeBSD$");
 
 #include "gen-compat.h"
 
-#ifdef I_AM_SCANDIR_B
-#include "block_abi.h"
-#defineSELECT(x)   CALL_BLOCK(select, x)
-#ifndef __BLOCKS__
-void
-qsort_b(void *, size_t, size_t, void*);
-#endif
-#else
+/*
+ * scandir_b@FBSD_1.4 was never exported from libc.so.7 due to a
+ * mistake, so there is no use of exporting it now with some earlier
+ * symbol version.  As result, we do not need to implement compat
+ * function freebsd11_scandir_b().
+ */
+
 #defineSELECT(x)   select(x)
-#endif
 
+void qsort_b(void *, size_t, size_t, void *);
+
 static int freebsd11_alphasort_thunk(void *thunk, const void *p1,
 const void *p2);
 
 int
-#ifdef I_AM_SCANDIR_B
-freebsd11_scandir_b(const char *dirname, struct freebsd11_dirent ***namelist,
-DECLARE_BLOCK(int, select, const struct freebsd11_dirent *),
-DECLARE_BLOCK(int, dcomp, const struct freebsd11_dirent **,
-const struct freebsd11_dirent **))
-#else
 freebsd11_scandir(const char *dirname, struct freebsd11_dirent ***namelist,
 int (*select)(const struct freebsd11_dirent *),
 int (*dcomp)(const struct freebsd11_dirent **,
const struct freebsd11_dirent **))
-#endif
 {
struct freebsd11_dirent *d, *p, **names = NULL;
size_t arraysz, numitems;
@@ -124,13 +117,8 @@ freebsd11_scandir(const char *dirname, struct freebsd1
}
closedir(dirp);
if (numitems && dcomp != NULL)
-#ifdef I_AM_SCANDIR_B
-   qsort_b(names, numitems, sizeof(struct freebsd11_dirent *),
-   (void*)dcomp);
-#else
qsort_r(names, numitems, sizeof(struct freebsd11_dirent *),
&dcomp, freebsd11_alphasort_thunk);
-#endif
*namelist = names;
return (numitems);
 
@@ -168,4 +156,3 @@ freebsd11_alphasort_thunk(void *thunk, const void *p1,
 
 __sym_compat(alphasort, freebsd11_alphasort, FBSD_1.0);
 __sym_compat(scandir, freebsd11_scandir, FBSD_1.0);
-__sym_compat(scandir_b, freebsd11_scandir_b, FBSD_1.4);

Modified: head/lib/libc/gen/scandir.c
==
--- head/lib/libc/gen/scandir.c Mon Aug 10 20:34:45 2020(r364090)
+++ head/lib/libc/gen/scandir.c Mon Aug 10 21:41:49 2020(r364091)
@@ -50,8 +50,7 @@ __FBSDID("$FreeBSD$");
 #include "block_abi.h"
 #defineSELECT(x)   CALL_BLOCK(select, x)
 #ifndef __BLOCKS__
-void
-qsort_b(void *, size_t, size_t, void*);
+void qsort_b(void *, size_t, size_t, void *);
 #endif
 #else
 #defineSELECT(x)   select(x)
@@ -134,6 +133,7 @@ fail:
return (-1);
 }
 
+#ifndef I_AM_SCANDIR_B
 /*
  * Alphabetic order comparison routine for those who want it.
  * POSIX 2008 requires that alphasort() uses strcoll().
@@ -153,3 +153,4 @@ alphasort_thunk(void *thunk, const void *p1, const voi
dc = *(in