Cygwin 3.6: clang cannot use /usr/include/unistd.h, issue with |setproctitle_init()| ...
Dimitry Andric
dimitry@unified-streaming.com
Wed Mar 5 19:10:16 GMT 2025
Maybe it's because -Wsystem-headers is not enabled? I'm unsure what gcc's default behavior is with -Wall, but if you add an explicit -Wsystem-headers you might still get that warning.
-Dimitry
> On 5 Mar 2025, at 19:58, Corinna Vinschen via Cygwin <cygwin@cygwin.com> wrote:
>
> On Mar 5 17:16, Christian Franke via Cygwin wrote:
>> Roland Mainz via Cygwin wrote:
>>> Small issue with Cygwin 3.6 (3.6.0-0.419.g3c1308ed890e.x86_64) system
>>> /usr/include/unistd.h and clang:
>>> ---- snip ----
>>> $ clang --version
>>> clang version 8.0.1 (tags/RELEASE_801/final)
>>> Target: x86_64-unknown-windows-cygnus
>>> Thread model: posix
>>> InstalledDir: /usr/bin
>>> $ clang -std=gnu17 -Wall -Wextra -g foo.c -lntdll -o foo.i686.exe
>>> In file included from foo.c:37:
>>> In file included from /usr/include/unistd.h:4:
>>> /usr/include/sys/unistd.h:218:42: error: parameter name omitted
>>> static inline void setproctitle_init (int, char *[], char *[]) {}
>>
>> The error is valid because the addition of this very old C++ feature took a
>> very long time :-)
>>
>> clang 15 says:
>> warning: omitting the parameter name in a function definition is a C2x
>> extension [-Wc2x-extensions]
>>
>> gcc 12 requires '-pedantic' option:
>> warning: ISO C does not support omitting parameter names in function
>> definitions before C2X [-Wpedantic]
>
> Weird, I can't reproduce this, neither with gcc 12 nor with gcc 15.
>
> $ cat <<EOF >x.c
> #define _BSD_SOURCE
> #include <unistd.h>
>
> int
> main (int argc, char **argv, char **envp)
> {
> setproctitle_init (argc, argv, envp);
> }
> EOF
> $ gcc -g -O2 -Wall -pedantic -std=c99 x.c -o x
> $
>
> No warning. What am I missing?
>
> We should still fix it. We could change this to a macro instead:
>
> -static inline void setproctitle_init (int, char *[], char *[]) {}
> +#define setproctitle_init(c, a, e)
>
> Would that help?
>
>
> Corinna
>
> --
> Problem reports: https://cygwin.com/problems.html
> FAQ: https://cygwin.com/faq/
> Documentation: https://cygwin.com/docs.html
> Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list