[PATCH] Allow usage of union wait for wait() functions and macros
Christian Franke
Christian.Franke@t-online.de
Wed Oct 5 21:18:00 GMT 2011
Christopher Faylor wrote:
> On Wed, Oct 05, 2011 at 12:57:44PM +0200, Christian Franke wrote:
>> ...
>> diff --git a/winsup/cygwin/include/cygwin/wait.h b/winsup/cygwin/include/cygwin/wait.h
>> index bed81b7..e4edba2 100644
>> --- a/winsup/cygwin/include/cygwin/wait.h
>> +++ b/winsup/cygwin/include/cygwin/wait.h
>> @@ -1,6 +1,6 @@
>> /* cygwin/wait.h
>>
>> - Copyright 2006, 2009 Red Hat, Inc.
>> + Copyright 2006, 2009, 2011 Red Hat, Inc.
>>
>> This file is part of Cygwin.
>>
>> @@ -16,6 +16,9 @@ details. */
>> #define WCONTINUED 8
>> #define __W_CONTINUED 0xffff
>>
>> +/* Will be redefined in sys/wait.h. */
>> +#define __wait_status_to_int(w) (w)
>> +
> Why is this necessary? It doesn't look like it is ever expanded in cygwin/wait.h.
This would be needed if cygwin/wait.h is included separately without
sys/wait.h
(e.g. stdlib.h -> cygwin/stdlib.h -> cygwin/wait.h)
and some W*() macro is actually used.
> If a redefinition is necessary why not put it all in one place?
The W*() macros and union wait are closely related. So a probably better
approach would be to move union wait to cygwin/wait.h and define
__wait_status_to_int() only there.
But then C++ compile may fail because cygwin/wait.h is sometimes
included indirectly inside an extern "C" block:
w32api/shlobj.h -> extern "C" { w32api/ole2.h ...-> stdlib.h ...->
cygwin/wait.h }
> And why is redefinition needed inside Cygwin?
It is not redefined in the __INSIDE_CYGWIN__ case.
>> ...
>> +
>> +#endif
> Could you add a comment here and at the #else indicating what they refer to
> like #else /* !(defined(__cplusplus) || defined(__INSIDE_CYGWIN__)) and
> #endif (defined(__cplusplus) || defined(__INSIDE_CYGWIN__) ?
OK.
> Also since Cygwin is C++ why do you need the __INSIDE_CYGWIN__ here?
There are still ten *.c files in winsup/cygwin :-)
New patch attached. Also includes the comment fix suggested by Eric Blake.
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin-union_wait-2.patch
Type: text/x-diff
Size: 4883 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20111005/ed9c0d7f/attachment.bin>
More information about the Cygwin-patches
mailing list