[PATCH] fix gcc -std=c89 in <sys/signal.h>

View: New views
3 Messages — Rating Filter:   Alert me  

[PATCH] fix gcc -std=c89 in <sys/signal.h>

by Yaakov (Cygwin/X) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On latest Cygwin:

$ echo "#include <sys/signal.h>" > test.c
$ gcc -c test.c
$ gcc -c -std=c89 test.c
In file included from /usr/include/sys/signal.h:107,
                   from test.c:1:
/usr/include/cygwin/signal.h:74: error: expected
specifier-qualifier-list before 'pthread_attr_t'
/usr/include/cygwin/signal.h:80: error: expected
specifier-qualifier-list before '__uint32_t'
/usr/include/cygwin/signal.h:96: error: expected
specifier-qualifier-list before 'pid_t'
/usr/include/cygwin/signal.h:270: error: expected ')' before 'int'
In file included from test.c:1:
/usr/include/sys/signal.h:152: error: expected ')' before 'int'

The problem is that both <cygwin/signal.h> and an (__CYGWIN__ ||
__rtems__) section of <sys/signal.h> need those typedefs from
<sys/types.h>, but the latter is only #include'd #ifdef _POSIX_THREADS,
which is off in C89 mode.

Patch attached.


Yaakov
Cygwin/X


Index: libc/include/sys/signal.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/signal.h,v
retrieving revision 1.18
diff -u -r1.18 signal.h
--- libc/include/sys/signal.h 18 Apr 2006 20:06:09 -0000 1.18
+++ libc/include/sys/signal.h 5 Oct 2009 14:20:13 -0000
@@ -8,13 +8,10 @@
 
 #include "_ansi.h"
 #include <sys/features.h>
+#include <sys/types.h>
 
 /* #ifndef __STRICT_ANSI__*/
 
-#if defined(_POSIX_THREADS)
-#include <sys/types.h>   /* for pthread data types */
-#endif
-
 typedef unsigned long sigset_t;
 
 #if defined(__rtems__)
@@ -144,11 +141,8 @@
 #undef sigemptyset
 #undef sigfillset
 #undef sigismember
-/* The first argument to kill should be pid_t.  Right now
-   <sys/types.h> always defines pid_t to be int.  If that ever
-   changes, then we will need to do something else, perhaps along the
-   lines of <machine/types.h>.  */
-int _EXFUN(kill, (int, int));
+
+int _EXFUN(kill, (pid_t, int));
 int _EXFUN(killpg, (pid_t, int));
 int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
 int _EXFUN(sigaddset, (sigset_t *, const int));

Re: [PATCH] fix gcc -std=c89 in <sys/signal.h>

by Yaakov (Cygwin/X) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ping?

On 05/10/2009 09:21, Yaakov (Cygwin/X) wrote:

> On latest Cygwin:
>
> $ echo "#include <sys/signal.h>" > test.c
> $ gcc -c test.c
> $ gcc -c -std=c89 test.c
> In file included from /usr/include/sys/signal.h:107,
> from test.c:1:
> /usr/include/cygwin/signal.h:74: error: expected
> specifier-qualifier-list before 'pthread_attr_t'
> /usr/include/cygwin/signal.h:80: error: expected
> specifier-qualifier-list before '__uint32_t'
> /usr/include/cygwin/signal.h:96: error: expected
> specifier-qualifier-list before 'pid_t'
> /usr/include/cygwin/signal.h:270: error: expected ')' before 'int'
> In file included from test.c:1:
> /usr/include/sys/signal.h:152: error: expected ')' before 'int'
>
> The problem is that both <cygwin/signal.h> and an (__CYGWIN__ ||
> __rtems__) section of <sys/signal.h> need those typedefs from
> <sys/types.h>, but the latter is only #include'd #ifdef _POSIX_THREADS,
> which is off in C89 mode.
>
> Patch attached.
>
>
> Yaakov
> Cygwin/X
>

Re: [PATCH] fix gcc -std=c89 in <sys/signal.h>

by Jeff Johnston :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Patch checked in.

-- Jeff J.

On 05/10/09 10:21 AM, Yaakov (Cygwin/X) wrote:

> On latest Cygwin:
>
> $ echo "#include <sys/signal.h>" > test.c
> $ gcc -c test.c
> $ gcc -c -std=c89 test.c
> In file included from /usr/include/sys/signal.h:107,
> from test.c:1:
> /usr/include/cygwin/signal.h:74: error: expected
> specifier-qualifier-list before 'pthread_attr_t'
> /usr/include/cygwin/signal.h:80: error: expected
> specifier-qualifier-list before '__uint32_t'
> /usr/include/cygwin/signal.h:96: error: expected
> specifier-qualifier-list before 'pid_t'
> /usr/include/cygwin/signal.h:270: error: expected ')' before 'int'
> In file included from test.c:1:
> /usr/include/sys/signal.h:152: error: expected ')' before 'int'
>
> The problem is that both <cygwin/signal.h> and an (__CYGWIN__ ||
> __rtems__) section of <sys/signal.h> need those typedefs from
> <sys/types.h>, but the latter is only #include'd #ifdef _POSIX_THREADS,
> which is off in C89 mode.
>
> Patch attached.
>
>
> Yaakov
> Cygwin/X
>