This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] --std=c89 error in sys/signal.h


Compiling a file which #include's <sys/signal.h> in C89 mode fails:

$ 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 #ifdef __CYGWIN__ 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.

I see two possible solutions:

1) Unconditionally #include <sys/types.h> in <sys/signal.h> (newlib), OR
2) #include <sys/types.h> in <cygwin/signal.h>.

Since this appears to be Cygwin specific, I went for the latter. Patch attached.


Yaakov


2009-09-29  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>

	* include/cygwin/signal.h: #include <sys/types.h> to fix compilation
	with --std=c89.

Index: include/cygwin/signal.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/signal.h,v
retrieving revision 1.17
diff -u -r1.17 signal.h
--- include/cygwin/signal.h	11 Sep 2008 06:22:31 -0000	1.17
+++ include/cygwin/signal.h	29 Sep 2009 19:28:10 -0000
@@ -14,6 +14,9 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+
+#include <sys/types.h>
+
 struct _fpstate
 {
   unsigned long cw;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]