Commit Graph

338 Commits

Author SHA1 Message Date
Alexis Beingessner
21405f1ac1 [runtime] statically construct the Dictionary and Set singletons 2016-11-18 13:56:57 -05:00
K Staring
5462fb235d different solution for detecting icu (not needed on Darwin, required on other platforms) 2016-11-17 21:08:44 +01:00
K Staring
536c1ac6ce Merge branch 'master' of https://github.com/apple/swift 2016-10-31 07:10:16 +01:00
practicalswift
f44686d825 [gardening] Fix trailing whitespace in *.cfg.in, *.html, *.mm and *.sil files 2016-10-29 14:06:43 +02:00
K Staring
5384630a18 don't require ICU on Darwin as per jrose-apple's comment 2016-10-25 20:42:17 +02:00
K Staring
f3b612a835 Merge branch 'master' of https://github.com/apple/swift 2016-10-21 22:37:25 +02:00
K Staring
22c0b4a9c8 fix ICU include paths. Please check this commit and verify that the previous solution simply coudn't have worked *at all*. The usage of slightly differently named variables (e.g. *LIB vs *LIBS) and lower-case module in the include for loop while a TOUPPER variable should have been used, caused the INCLUDE variables to never be filled. Apart from that, a find_package() was missing in the stubs CMakeFiles.txt . 2016-10-21 22:25:19 +02:00
K Staring
db8878e3e8 incoorporate @landonf and @dcci's suggestions wrt dynamic sysct KERN_PROC_ARGS buffer 2016-10-21 22:23:44 +02:00
Saleem Abdulrasool
7f088d3fe0 stdlib: mark shims with the visibility attribute
Ensure that the header and the implementation matches the ABI interface
annotations.
2016-10-18 11:36:15 -07:00
K Staring
8bda672c70 Merge branch 'master' of https://github.com/apple/swift 2016-10-15 18:36:36 +02:00
K Staring
ede70f2513 rolled back FreeBSD /proc changes and rewrote as per @landonf suggestion, through sysctl() call. Kept the function as similar to the other functions as possible. 2016-10-04 08:47:26 +02:00
Brian Gesiak
49248a44c2 [stubs] Prevent CMake from linking with object lib
Attempting to link against an object library results in a CMake error.
Prevent such an error by removing a line I mistakenly added in b86125ac.
2016-10-02 19:51:45 -04:00
K Staring
69085ae4eb Merge branch 'master' of https://github.com/apple/swift 2016-09-29 07:24:25 +02:00
Brian Gesiak
b86125accf [stubs] Update CMake to use TARGET_SDKS (NFC)
The `add_swift_library` CMake function takes an optional `TARGET_SDKS`
parameter. When used, only CMake targets for the specified SDKs are added.

Refactor `stdlib/public/stubs` to use this parameter. This also eliminates
logic that determines additional flags or source files to include based on
`SWIFT_HOST_VARIANT`, which makes it easier for hosts to add targets for
different platforms.
2016-09-28 22:41:15 -04:00
Brian Gesiak
7fc8d14630 Merge pull request #4862 from modocache/stubs_link_libraries
[stubs] Remove empty CMake variable
2016-09-26 08:08:40 -04:00
Joe Groff
2bfe9214ed Merge pull request #4869 from jckarter/optional-bridging
(take 2) SR-0140: Bridge Optionals to nonnull ObjC objects by bridging their payload, or using a sentinel.
2016-09-20 14:35:13 -07:00
Joe Groff
1a52e3f2c2 SR-0140: Bridge Optionals to nonnull ObjC objects by bridging their payload, or using a sentinel.
id-as-Any lets you pass Optional to an ObjC API that takes `nonnull id`, and also lets you bridge containers of `Optional` to `NSArray` etc. When this occurs, we can unwrap the value and bridge it so that inhabited optionals still pass into ObjC in the expected way, but we need something to represent `none` other than the `nil` pointer. Cocoa provides `NSNull` as the canonical "null for containers" object, which is the least bad of many possible answers. If we happen to have the rare nested optional `T??`, there is no precedented analog for these in Cocoa, so just generate a unique sentinel object to preserve the `nil`-ness depth so we at least don't lose information round-tripping across the ObjC-Swift bridge.

Making Optional conform to _ObjectiveCBridgeable is more or less enough to make this all work, though there are a few additional edge case things that need to be fixed up. We don't want to accept `AnyObject??` as an @objc-compatible type, so special-case Optional in `getForeignRepresentable`.

Implements SR-0140 (rdar://problem/27905315).
2016-09-20 13:04:09 -07:00
airspeedswift
ed5231b47c Numbered all FIXME(ABI) entries for tracking purposes. (#4868) 2016-09-19 16:41:41 -07:00
Brian Gesiak
4e552479b4 [stubs] Remove empty CMake variable
`swift_stubs_link_libraries` was removed in d227aeb64d. Remove the
`LINK_LIBRARIES` parameter, since its argument will always be empty.
2016-09-19 13:15:39 -04:00
K Staring
b267fda3c8 Merge branch 'master' of https://github.com/apple/swift 2016-09-18 13:09:34 +02:00
practicalswift
8d6251de66 [gardening] Fix accidental uses of \t 2016-09-17 13:15:26 +02:00
Greg Parker
cd9a8afd5d Revert "SR-0140: Bridge Optionals to nonnull ObjC objects by bridging their payload, or using a sentinel." (#4820) 2016-09-15 18:18:07 -07:00
Joe Groff
cfa9cd9a08 SR-0140: Bridge Optionals to nonnull ObjC objects by bridging their payload, or using a sentinel.
id-as-Any lets you pass Optional to an ObjC API that takes `nonnull id`, and also lets you bridge containers of `Optional` to `NSArray` etc. When this occurs, we can unwrap the value and bridge it so that inhabited optionals still pass into ObjC in the expected way, but we need something to represent `none` other than the `nil` pointer. Cocoa provides `NSNull` as the canonical "null for containers" object, which is the least bad of many possible answers. If we happen to have the rare nested optional `T??`, there is no precedented analog for these in Cocoa, so just generate a unique sentinel object to preserve the `nil`-ness depth so we at least don't lose information round-tripping across the ObjC-Swift bridge.

Making Optional conform to _ObjectiveCBridgeable is more or less enough to make this all work, though there are a few additional edge case things that need to be fixed up. We don't want to accept `AnyObject??` as an @objc-compatible type, so special-case Optional in `getForeignRepresentable`.

Implements SR-0140 (rdar://problem/27905315).
2016-09-14 15:50:13 -07:00
K Staring
f11d05717e CMAKE_SDK apparenty isn't always filled when cmake runs; always use /usr/local/include for now 2016-09-13 11:18:07 +02:00
K Staring
afc95a5e2a disable handy pthread wrappers on FreeBSD since they don't compile
Things like: PthreadBarriers.swift:114:50: error: cannot convert value of type 'UnsafeMutablePointer<pthread_mutex_t>' (aka 'UnsafeMutablePointer<OpaquePointer>') to expected argument type 'UnsafeMutablePointer<pthread_mutex_t?>' (aka 'UnsafeMutablePointer<Optional<OpaquePointer>>')
on barrier.pointee.mutex . I need to do more research to understand this
2016-09-13 11:08:00 +02:00
K Staring
6428295d70 Two fixes for FreeBSD build
add /usr/local/include to include path in stdlib/public/stubs
use FreeBSD procfs path to cmdline when building for FreeBSD
2016-09-14 20:00:33 +02:00
Dmitri Gribenko
e8e8b35610 stdlib: use SipHash-1-3 for string hashing on non-ObjC platforms
Part of rdar://problem/24109692
2016-09-06 20:41:03 -07:00
Dmitri Gribenko
daa7bfc281 stdlib: add a secret key for hashing 2016-09-06 20:41:03 -07:00
Dmitri Gribenko
e4aaba9ba6 stdlib: declare functions for assertion reporting in SwiftShims instead of using @_silgen_name 2016-09-05 22:47:24 -07:00
Dmitri Gribenko
e765091217 stdlib: remove an unused Unicode data table 2016-09-02 19:42:37 -07:00
Brian Gesiak
eda6e839ac [stdlib] Use _Nonnull over __nonnull in Foundation
The `__nonnull` keyword is deprecated in favor of `_Nonnull`.
2016-08-26 16:19:46 -04:00
Greg Parker
1c58cc20ba [stdlib] Remove workaround for an old clang bug (rdar://18950072). 2016-08-24 20:14:03 -07:00
Vivian Kong
416a36278f Removing SWIFT_CC annotation in SwiftShims 2016-08-10 08:33:24 -04:00
Dmitri Gribenko
b162f60070 runtime: make _SwiftNativeNSError use the Hashable conformance, if available
If the Swift error wrapped in a _SwiftNativeNSError box conforms to
Hashable, the box now uses the Swift's conformance to Hashable.

Part of rdar://problem/27574348.
2016-08-09 00:49:20 -07:00
Michael Gottesman
06a70d3942 [cmake] Add cmake support for only applying tsan to the swift stdlib/runtime. 2016-08-03 17:53:57 -07:00
Kevin Ballard
2530957bc6 Use shims for all calls to Dispatch APIs that take blocks
This ensures that blocks that come from `DispatchWorkItem`s will
function correctly.

The only exception is __dispatch_barrier_sync() as the block passed to
that call is not `@convention(block)` so it doesn't matter.

Fixes SR-2246.
2016-08-01 17:08:14 -07:00
Dmitri Gribenko
621d3b7c66 Merge pull request #3827 from mwwa/libdispatch-data-leak
[libdispatch-data-leak] DisaptchData never calls destructor
2016-07-29 14:58:37 -07:00
Andrew Trick
ed3813a876 Linux build fixes. 2016-07-28 21:06:40 -07:00
Andrew Trick
0b75ee975e Remove "illegal" UnsafePointer casts from the stdlib.
Update for SE-0107: UnsafeRawPointer

This adds a "mutating" initialize to UnsafePointer to make
Immutable -> Mutable conversions explicit.

These are quick fixes to stdlib, overlays, and test cases that are necessary
in order to remove arbitrary UnsafePointer conversions.

Many cases can be expressed better up by reworking the surrounding
code, but we first need a working starting point.
2016-07-28 20:42:23 -07:00
Matt Wright
a151db06cd [libdispatch-data-leak] DisaptchData never calls destructor
* _swift_dispatch_data_create should have been marked as returning a
    retained object, otherwise the object is never fully released and
    the destructor is never executed.

    Fixes: <rdar://problem/27577958>
2016-07-28 15:00:32 -07:00
Dmitri Gribenko
6e4ab972de Merge pull request #3820 from apple/stdlib-move-reflection-function
stdlib: move a function from runtime to stubs
2016-07-28 08:59:01 -07:00
Dmitri Gribenko
c1712cbdab stdlib: AnyHashable: remove a FIXME, no action required 2016-07-28 01:35:58 -07:00
Dmitri Gribenko
2d2c76f6ec stdlib: AnyHashable tests: finish tests for CF types 2016-07-28 01:35:58 -07:00
Dmitri Gribenko
561ac46679 stdlib: move a function from runtime to stubs
This function is not needed in the runtime.
2016-07-28 01:19:31 -07:00
Dmitri Gribenko
b0481b14f5 AnyHashable: add a runtime cache to speed up initialization
When initializing an AnyHashable instance we need to find a type that
introduces the Hashable conformance.  This commit adds a cache to
remember the result of this lookup.
2016-07-27 01:14:01 -07:00
Dmitri Gribenko
53c424409d stdlib: add AnyHashable
Implements SE-0131 "Add AnyHashable to the standard library".
2016-07-26 03:10:52 -07:00
swift-ci
395e967875 Merge pull request #3739 from practicalswift/normalize-headers 2016-07-25 04:55:55 -07:00
practicalswift
7e89679404 [gardening] Fix recently introduced typos. 2016-07-24 22:32:40 +02:00
practicalswift
a87d170b81 [gardening] Improve consistency in header formatting. 2016-07-24 21:36:25 +02:00
Matt Wright
56a579763f [libdispatch-data-fixes] Appending UnsafeBufferPointers to data is unsafe
* The buffer-pointer based init methods were passing the dispatch
    data default destructor in such a way that the
    @convention(block)-ness was lost. This leads to a thunk being passed
    to dispatch instead of NULL. Subsequently, dispatch would reference
    rather than copy the provided data.

    Fixes:
	SR-2050 (<rdar://problem/27293973>)
2016-07-20 16:46:31 -07:00