bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avoid two GCC11 warnings


From: Bruno Haible
Subject: Re: avoid two GCC11 warnings
Date: Thu, 26 Nov 2020 17:11:07 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; )

Hi Jim,

> 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  <bruno@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.

diff --git a/doc/posix-functions/_exit.texi b/doc/posix-functions/_exit.texi
index 93d7c4f..8d96a52 100644
--- a/doc/posix-functions/_exit.texi
+++ b/doc/posix-functions/_exit.texi
@@ -4,10 +4,14 @@
 
 POSIX specification:@* 
@url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/_exit.html}
 
-Gnulib module: ---
+Gnulib module: unistd
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is declared in a different header file (namely, 
@code{<stdlib.h>})
+on some platforms:
+mingw, MSVC 14.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/modules/raise-tests b/modules/raise-tests
index 257f9e3..4804cad 100644
--- a/modules/raise-tests
+++ b/modules/raise-tests
@@ -4,6 +4,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+unistd
 
 configure.ac:
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]