Commit Graph

218 Commits

Author SHA1 Message Date
Thomas Roughton
b4391f35de Fix comment on #endif for defined(_Win32) 2017-12-04 11:39:22 +13:00
troughton
a1518031ec Fix Windows errno() and _stdlib_open 2017-12-04 11:12:11 +13:00
Greg Parker
da14cd79a6 [runtime] Clean up symbol exports in libc functions. (#13202) 2017-12-01 17:49:11 -08:00
David Zarzycki
6a93b07cfb NFC: Use standardized locale header
On Linux, glibc removed xlocale.h, which was non-standard.
2017-11-25 13:09:06 -05:00
Greg Parker
1e894cd80b [runtime] Clean up symbols in error machinery. (#12853)
* [runtime] Clean up symbols in error machinery.

* [runtime] Clean up symbols in Foundation overlay.

* [runtime] Clean up symbols in collections and hashing.

* [runtime] Remove symbol controls from the Linux definition of swift_allocError.

* [tests] Add more stub functions for tests that link directly to the runtime.
2017-11-15 22:20:11 -08:00
David Zarzycki
56a3aa97ac [Cross compile] Add missing standard include from C++ 2017-11-11 14:55:15 -05:00
Greg Parker
bba9d4c652 [runtime] Delete unused _swift_fmod*().
These were once used by some func %() implementations.
2017-10-24 02:22:01 -07:00
Greg Parker
0fa818ed6b [runtime] Make ivars in the runtime's ObjC classes private. 2017-10-23 18:30:28 -07:00
Saleem Abdulrasool
f3680a2783 stdlib: re-add include paths for swift headers
This adds the swift include path manually to the builds for the stubs
and the runtime.  This has no impact for the build currently.  However,
adding the additional include directory will enable a standalone build
for the stdlib.
2017-10-22 21:01:28 -07:00
Arnold Schwaighofer
b6eef4fc75 Merge pull request #12312 from aschwaighofer/fix_hashvalue_leak
runtime: Move String implementation stubs that want need the auto-rel…
2017-10-08 08:12:21 -07:00
Arnold Schwaighofer
f9c004945f Update comments 2017-10-07 09:15:55 -07:00
Saleem Abdulrasool
d7fc6a0359 stdlib: initialize va_list variables (NFC)
This silences `-Wuninitialized` warnings from clang when building the
swift stdlib for Windows ARM.  NFC.
2017-10-06 15:33:43 -07:00
Arnold Schwaighofer
f691657f3e Use an autorelease pool on i386 instead 2017-10-06 14:41:56 -07:00
Arnold Schwaighofer
362f91052a Not a doc comment 2017-10-06 14:11:38 -07:00
Arnold Schwaighofer
16552c003c Fix linux build 2017-10-06 13:04:03 -07:00
Arnold Schwaighofer
513303fd63 Also fix and test uppercased and lowercased 2017-10-06 13:04:03 -07:00
Arnold Schwaighofer
ec5f40f12f runtime: Move String implementation stubs that want need the auto-released return value optimization to an ARC compiled file
String's hashValue function is implemented in terms of Foundation's hash
function in a runtime function on darwin platforms. For non-ASCII strings we
will call str.decomposedStringWithCanonicalMapping inside this runtime function
which will allocate a new NSString and return the result in the current
autorelease pool. We implemented this function in a file compiled without ARC.
This meant that we would leak said NSString into the current active autorelease
pool.
This patch moves the implementation to a file compiled with ARC. ARC will insert
objc_retainAutoreleasedReturnValue call and on platforms that require it an
marker for the hand-off of the autoreleased return value optimization.

SR-4889
rdar://32199117
2017-10-06 11:12:22 -07:00
Saleem Abdulrasool
62c9a3dd54 Merge pull request #12134 from compnerd/windows-icu
stubs: fix Windows link
2017-09-27 18:59:58 -07:00
Karoy Lorentey
cce185e257 Merge pull request #12129 from lorentey/retainCount
[stdlib] Implement -retainCount in _SwiftNativeNS*Base
2017-09-26 18:32:04 -07:00
Saleem Abdulrasool
05edabff5e stubs: fix Windows link
There is no icucore.lib in the official ICU distribution for Windows.
Remove the autolink directive for now.
2017-09-26 16:13:47 -07:00
Saleem Abdulrasool
13213efe6a stubs: fix architecture check for Windows
Fix a typo in the architecture check.  The missing `I` in the x86 check
prevented the x86 build from succeeding.
2017-09-26 16:11:34 -07:00
Karoy Lorentey
ed5b202c8f [stdlib] Implement -retainCount in _SwiftNativeNS*Base
Fixes rdar://problem/28002554.
2017-09-26 14:32:20 -07:00
Calvin Hill
aee81d272f Add Initial platform support for Haiku. (#11583) 2017-09-22 21:06:56 -04:00
Saleem Abdulrasool
42c98e63d0 stubs: fix Windows x86 TLS callback CC violation
Windows x86 requires that the TLS destructor callback uses the "stdcall"
calling convention.  Provide a shim which will adjust the calling
convention and call back into the swift portion of the code code with
the expected calling convention.
2017-09-21 11:29:56 -07:00
Saleem Abdulrasool
b38ed2f8fc Merge pull request #11949 from compnerd/windows-tls
stdlib: generalise TLS to support Windows
2017-09-18 14:21:13 -07:00
Saleem Abdulrasool
de687ac245 Merge pull request #11960 from compnerd/stub-unicode-complexity
Stub unicode complexity
2017-09-18 13:53:50 -07:00
swift-ci
9fc2f8ad8a Merge pull request #11959 from compnerd/stub-unicode-spacing 2017-09-15 17:45:57 -07:00
Saleem Abdulrasool
e1f98943ba stubs: simplify the Unicode stubs
Force the autolinking on Windows and Darwin as both have mechanisms to
support this.  ELFish targets are unfortunately not supported yet as
there is no portable mechanism to do this.

Remove the unnecessary handling of specific targets.  Always perform the
cast as it adds no overhead and will always be correct (worst case is
that the type is cast to itself).  This simplifies the logic.

Move the forward declarations to avoid inclusion to the same location as
the inclusion.
2017-09-15 15:59:27 -07:00
Saleem Abdulrasool
21d407529f stdlib: clean up some whitespace issues
Clean up incorrect whitespace.  NFC.
2017-09-15 15:58:38 -07:00
Saleem Abdulrasool
ba8cbe137c stdlib: generalise TLS to support Windows
Rename the explicit `pthread` to `thread` to indicate that this is not
`pthread` specifically.  This allows us to implement the TLS support for
Windows using Fibers.
2017-09-15 10:56:50 -07:00
Joe Groff
b7566dacdb IRGen: Lowering for key paths with indices. 2017-09-15 10:24:28 -07:00
Greg Parker
dd38ace506 [runtime] Fix more const cast warnings. (#11725)
* [runtime] Fix more const cast warnings.
2017-09-05 13:13:01 -07:00
Kuba (Brecka) Mracek
d03a575279 Unify the capitalization across all user-visible error messages (#11599)
* Unify the capitalization across all user-visible error messages (fatal errors, assertion failures, precondition failures) produced by the runtime, standard library and the compiler.

* Update some more tests to the new expectations.
2017-08-29 12:16:04 -07:00
Adrian Popescu
b61c51b7b6 Fixed clang 4.0 compilation under Arch Linux with icu59.1-1 (#10361)
ICU headers prefer use of `char16_t` instead of `uint16_t` for `UChar` in C++, where it is treated as a distinct type. This fixes associated warnings and errors.
2017-08-17 13:26:22 -07:00
Michael Ilseman
2415a4df52 [stdlib] Drop Unicode 8 tries in stdlib (entirely)
This drops the last vestage of Unicode 8 tries from the standard
library. Switches everything over to use ICU.
2017-08-09 19:17:56 -07:00
Kuba (Brecka) Mracek
d046f3f959 Set _swift_reportFatalErrorsToDebugger to true by default and remove all the staging parts (frontend flag, irgen changes). (#11329) 2017-08-03 15:23:23 -07:00
Saleem Abdulrasool
8b3bff8277 stubs: match return type to header declaration
Because of differences in the definition of ssize_t, swift uses
`__swift_ssize_t` in the headers.  Make the definition match the
declaration.  NFC.
2017-07-18 10:36:23 -07:00
Jordan Rose
9c10398514 [runtime] Expose reportToDebugger as swift_reportToDebugger.
...so that the overlays can use it. See next commit.
2017-07-13 11:18:41 -07:00
Joe Groff
101788dbd4 IRGen: Support for computed properties with dependent generic context.
Use the KeyPath implementation's new support for instantiating and dealing with captures to lower the generic context required to dispatch computed accessors with dependent generics.
2017-07-06 20:07:41 -07:00
Kuba (Brecka) Mracek
4b88da2a2c Use the debugger hook, reportToDebugger, for all calls to _swift_stdlib_reportFatalError[InFile]. Only do this when a hidden frontend flag, -report-errors-to-debugger, is used. (#10617) 2017-06-29 09:12:26 -07:00
Arnold Schwaighofer
62c1f215ce Fix layering violation I introduced by putting _EmptyBoxStorage into the stubs library (#10373)
* Fix layering violation I introduced by putting _EmptyBoxStorage into the stubs library

Should fix the linkage issue on linux
2017-06-19 10:59:05 -07:00
Arnold Schwaighofer
e5aca4124b Cleanup - remove dead code from previous EmptyBoxType change 2017-06-17 09:35:21 -07:00
Arnold Schwaighofer
48e889b51b IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums (#10326)
* IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums

We map nil to the .None case of Optional. Instead use a singleton object.

SR-5148
rdar://32618580
2017-06-17 09:33:41 -07:00
Michael Ilseman
8e0362e2c1 [stubs] Autolink against icucore on Darwin.
Programs using a statically linked build of the standard library need
to explicitly link against icucore. There are various potential
hacks^Wsolutions to this problem, and this is an attempt at a lesser
of evils approach.

Emit a linker directive to perform autolinking against icucore on
Darwin systems. This allows us to avoid hacking the compiler driver
and propagating that hack onto any build systems that don't go through
the driver.
2017-05-19 10:39:24 -07:00
Michael Ilseman
d1b2cbef39 [stdlib] Add prototypes to avoid dependency
Avoid a dependency on ICU headers on Apple platforms, rather than rely
on corelibs-foundation being checked out. This simplifies the
dependencies and unblocks build bots.
2017-05-16 20:30:03 -07:00
Michael Ilseman
ebe391cf5d [stdlib stubs] Fix up Linux build to know about pthread types.
Adds in Linux platform support for our pthread TLS. Replace usage of
PTHREAD_KEYS_MAX with a sentinel value, as it's tricky to define
cross-platform and was only lightly used inside sanity checks.
2017-05-16 20:30:02 -07:00
Michael Ilseman
5eb5e34897 [stdlib] Shims for UBreakIterator and thread local storage.
Introduce shims for using UBreakIterators from ICU. Also introduce
shims for using thread local storage via pthreads.

We will be relying on ICU and UBreakIterators for grapheme
breaking. But, UBreakIterators are very expensive to create,
especially for the way we do grapheme breaking, which is relatively
stateless. Thus, we will stash one or more into thread local storage
and reset it as needed.

Note: Currently, pthread_key_t is hard coded for a single platform
(Darwin), but I have a static_assert alongside directions on how to
adapt it to any future platforms who differ in key type.
2017-05-16 20:28:31 -07:00
Michael Ilseman
f0abff5539 Revert "Merge pull request #9265 from milseman/tls_ftw"
This reverts commit 26f7659efe, reversing
changes made to 7b927e55e8.
2017-05-11 10:39:58 -07:00
Michael Ilseman
75741a9dde [stdlib stubs] Fix up Linux build to know about pthread types.
Adds in Linux platform support for our pthread TLS. Replace usage of
PTHREAD_KEYS_MAX with a sentinel value, as it's tricky to define
cross-platform and was only lightly used inside sanity checks.
2017-05-10 15:23:12 -07:00
Michael Ilseman
4a17449d02 [stdlib] Shims for UBreakIterator and thread local storage.
Introduce shims for using UBreakIterators from ICU. Also introduce
shims for using thread local storage via pthreads.

We will be relying on ICU and UBreakIterators for grapheme
breaking. But, UBreakIterators are very expensive to create,
especially for the way we do grapheme breaking, which is relatively
stateless. Thus, we will stash one or more into thread local storage
and reset it as needed.

Note: Currently, pthread_key_t is hard coded for a single platform
(Darwin), but I have a static_assert alongside directions on how to
adapt it to any future platforms who differ in key type.
2017-05-10 15:21:07 -07:00