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]

Re: Problem with: Re: [PATCH] Allow usage of union wait for wait() functions and macros


Christopher Faylor wrote:
On Thu, Dec 08, 2011 at 12:17:11AM +0100, Christian Franke wrote:
Christopher Faylor wrote:
...
/usr/local/src/trunk/objdir.withada/./prev-gcc/g++
-B/usr/local/src/trunk/objdir.withada/./prev-gcc/
...
-I/usr/local/src/trunk/gcc/gcc/../libdecnumber/bid -I../libdecnumber
    /usr/local/src/trunk/gcc/gcc/ada/adaint.c -o ada/adaint.o
In file included from /usr/local/src/trunk/gcc/gcc/system.h:346:0,
                   from /usr/local/src/trunk/gcc/gcc/ada/adaint.c:107:
/usr/include/sys/wait.h: In function 'int __wait_status_to_int(const wait&)':
/usr/include/sys/wait.h:77:61: error: declaration of C function 'int
__wait_status_to_int(const wait&)' conflicts with
/usr/include/sys/wait.h:75:12: error: previous declaration 'int
__wait_status_to_int(int)' here
This suggests that sys/wait.h is included within an extern "C" { ... }
block.
If this is the case then an extern "C++" {...} block around the C++
inline functions of sys/wait.h should fix this.
See:
http://cygwin.com/ml/cygwin-patches/2011-q4/msg00005.html
Yes, I'm responding to this very thread.

But, I don't see how extern "c++" fixes anything. #ifdef __cplusplus maybe...

No, #ifdef __cplusplus won't help. Example:


foo.h:
extern "C" {
#include <sys/wait.h>
}


sys/wait.h: ... #ifdef __cplusplus ... inline int __wait_status_to_int(int __status) { .... } // This fails because both are interpreted as C-functions: inline int __wait_status_to_int(const union wait &__status) { .... } ... #endif


Fix: #ifdef __cplusplus +extern "C++" { ... inline int __wait_status_to_int(int __status) { .... } inline int __wait_status_to_int(const union wait &__status) { .... } ... +} #endif


Christian



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