<div dir="ltr"><div>Hi K,</div><div><br></div><div>I met similar problem in Cygwin porting.</div><div><br></div><div>I think it will be resolved by defining the typealias with #if/#endif, <span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre-wrap;background-color:rgb(234,255,234)">_stdlib_pthread_attr_t </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre-wrap;background-color:rgb(234,255,234)">=</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre-wrap;background-color:rgb(234,255,234)"> </span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre-wrap;background-color:rgb(234,255,234)">UnsafePointer</span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre-wrap;background-color:rgb(234,255,234)"><</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre-wrap;background-color:rgb(234,255,234)">pthread_attr_t?</span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre-wrap;background-color:rgb(234,255,234)">>.</span></div><div><br></div><div>Please reference my PR for Cygwin. <a href="https://github.com/apple/swift/pull/3886/files#diff-99fd89ad44c4466de8ad6b8aab9c207d">https://github.com/apple/swift/pull/3886/files#diff-99fd89ad44c4466de8ad6b8aab9c207d</a></div><div><br></div><div>Thanks</div><div>Han Sangjin<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-09-19 5:08 GMT+09:00 K Staring via swift-dev <span dir="ltr"><<a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
While trying to port the current swift code to FreeBSD, some swift code fails to compile. The failures are concentrated in SwiftPrivatePthreadExtras.<wbr>swift and code which depends on it.<br>
<br>
Can someone shed some light on the following errors? I am having some difficulty understanding why the C headers would be interpreted so slightly differently than expected?<br>
<br>
--(start compile failure)<br>
/home/qdk/src/swift-source/<wbr>swift/stdlib/private/<wbr>SwiftPrivatePthreadExtras/<wbr>SwiftPrivatePthreadExtras.<wbr>swift:75:42: error: cannot convert value of type 'UnsafePointer<pthread_attr_t><wbr>?' to expected argument type 'UnsafePointer<pthread_attr_t?<wbr>>!'<br>
let result = pthread_create(&threadID, attr,<br>
^~~~<br>
/home/qdk/src/swift-source/<wbr>swift/stdlib/private/<wbr>SwiftPrivatePthreadExtras/<wbr>PthreadBarriers.swift:72:46: error: cannot convert value of type 'UnsafeMutablePointer<pthread_<wbr>mutex_t>' (aka 'UnsafeMutablePointer<<wbr>OpaquePointer>') to expected argument type 'UnsafeMutablePointer<pthread_<wbr>mutex_t?>' (aka 'UnsafeMutablePointer<<wbr>Optional<OpaquePointer>>')<br>
if pthread_mutex_init(barrier.<wbr>pointee.mutex!, nil) != 0 {<br>
~~~~~~~~~~~~~~~~~~~~~^<br>
/home/qdk/src/swift-source/<wbr>swift/stdlib/private/<wbr>SwiftPrivatePthreadExtras/<wbr>PthreadBarriers.swift:77:44: error: cannot convert value of type 'UnsafeMutablePointer<pthread_<wbr>cond_t>' (aka 'UnsafeMutablePointer<<wbr>OpaquePointer>') to expected argument type 'UnsafeMutablePointer<pthread_<wbr>cond_t?>' (aka 'UnsafeMutablePointer<<wbr>Optional<OpaquePointer>>')<br>
if pthread_cond_init(barrier.<wbr>pointee.cond!, nil) != 0 {<br>
~~~~~~~~~~~~~~~~~~~~^<br>
<br>
--(end compile failure)<br>
<br>
Thanks for any suggestions or pointers!<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Kind regards,<br>
<br>
K Staring <<a href="mailto:qdk@quickdekay.net">qdk@quickdekay.net</a>><br>
<br>
<br>
______________________________<wbr>_________________<br>
swift-dev mailing list<br>
<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-dev" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-dev</a><br>
</font></span></blockquote></div><br></div></div>