On Thu, Nov 26, 2020 at 6:11 AM Bruno Haible <br...@clisp.org> wrote: > > Building grep with GCC11, I noticed some new warnings. > > Fixed with the just-pushed attached patches. > > Thanks. It's interesting to see GCC's inference capabilities to grow. > > But the second patch causes a compilation error on MSVC: > > test-raise.c(20): fatal error C1083: Cannot open include file: 'unistd.h': No > such file or directory > make[4]: *** [Makefile:718: test-raise.obj] Error 2 > > This could be fixed in two ways: > > a) Change > > #include <unistd.h> > > to > > /* Get _exit. */ > #if defined _WIN32 && !defined __CYGWIN__ > # include <stdlib.h> > #else > # include <unistd.h> > #endif > > b) Adding a module dependency to 'unistd', since that guarantees that '_exit' > is declared in <unistd.h> (see > <https://www.gnu.org/software/gnulib/manual/html_node/unistd_002eh.html>). > > The latter is obviously preferred. > > > 2020-11-26 Bruno Haible <br...@clisp.org> > > raise-tests: Fix compilation error on MSVC (regression 2020-11-25). > * modules/raise-tests (Depends-on): Add unistd. > * doc/posix-functions/_exit.texi: Mention the 'unistd' module.
Hi Bruno, Thanks for adding that. I did wonder, and even looked at doc/posix-functions/_exit.texi. Quite a few modules of _exit-using code will have to add that new dependency. You've probably already started working on this, but I had to check... Here's a first crack at the list of modules with a use of _exit, yet no dependency on unistd: $ grep -L '^unistd$' $(git grep -wlf<(git grep -wl _exit|grep -vE '^(ChangeLog|doc)') modules) modules/_Exit modules/closein modules/closeout modules/forkpty modules/grantpt modules/memmem-simple modules/nanosleep modules/nanosleep-tests modules/nocrash modules/posix_spawn modules/posix_spawn-internal modules/posix_spawn_file_actions_addclose modules/posix_spawn_file_actions_adddup2 modules/posix_spawn_file_actions_addopen modules/posix_spawn_file_actions_destroy modules/posix_spawn_file_actions_init modules/posix_spawnattr_destroy modules/posix_spawnattr_getflags modules/posix_spawnattr_getpgroup modules/posix_spawnattr_getschedparam modules/posix_spawnattr_getschedpolicy modules/posix_spawnattr_getsigdefault modules/posix_spawnattr_getsigmask modules/posix_spawnattr_init modules/posix_spawnattr_setflags modules/posix_spawnattr_setpgroup modules/posix_spawnattr_setschedparam modules/posix_spawnattr_setschedpolicy modules/posix_spawnattr_setsigdefault modules/posix_spawnattr_setsigmask modules/posix_spawnp modules/savewd modules/sleep-tests modules/stat-time-tests modules/strcasestr-simple modules/strstr-simple modules/tmpfile-safer modules/unistd