Commit Graph

42 Commits

Author SHA1 Message Date
David Hart
66131c01d3 [SR-2626] Fix String to Float/Double “snan” conversion (#8036)
Adds an explicit check for `[+-]snan` to create an sNaN from a string.
2017-03-13 21:07:31 -04:00
Gonzalo Larralde
85f3fd1ebf [SR-4166] Change on how __mode__ attribute presence is checked to fix compilation issue. 2017-03-05 21:23:39 -03:00
Hugh Bellamy
6564a8b3b5 Use std::thread::hardware_concurrency instead of our own solution 2017-02-21 11:46:32 +07:00
Hugh Bellamy
3a96ded085 Don't use certain attributes in shims or stubs if the attribute doesn't exist 2017-02-20 10:16:30 +07:00
Hugh Bellamy
05a50fd978 Remove extern "C" from uses of SWIFT_RUNTIME_STDLIB_INTERFACE 2017-01-22 18:32:17 +00:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +01:00
Hugh Bellamy
eca5b3da34 Change _MSC_VER conditions to _WIN32 conditions in stubs 2016-12-13 14:15:39 +00:00
Saleem Abdulrasool
d4b5ceabfd stubs: match types in the stubs
The various uses where using `unsigned char` rather than `char`.  Adjust the one
instance accordingly.  Noticed when building the stubs for Windows.
2016-11-27 17:01:39 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01: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
practicalswift
7e89679404 [gardening] Fix recently introduced typos. 2016-07-24 22:32:40 +02:00
Saleem Abdulrasool
5e170ebcb5 build: support cross-compiling to windows 2016-07-13 21:37:04 -07:00
Saleem Abdulrasool
e3c2c863d1 stdlib: define WIN32_LEAN_AND_MEAN and NOMINMAX
`WIN32_LEAN_AND_MEAN` prevents "rarely-used" headers from being pulled in.  This
significantly reduced preprocessor pressure, speeding up compile.  It also
reduces the amount of cruft pulled in by the Windows.h.

`NOMINMAX` ensures that the `min` and `max` macros are not defined.  These
macros collide with the use of `min` and `max` from C++ in certain cases: e.g.
`std::limits<T>`.
2016-06-16 07:34:17 -07:00
Han Sangjin
e6ecc9a3ec Modified for some reviews 2016-06-10 06:26:47 +09:00
Han Sangjin
198441bee9 stdlib/msvc: Runtime with MSVC library
This patch is for libswiftCore.lib, linking with the library set of Visual Studio 2015. Clang with the option -fms-extension is used to build.
2016-06-04 05:16:41 +09:00
Bryan Chan
85fde8b1fb Add support for Linux s390x. LLVM's Swift calling convention support is used to ensure correct operations of C++ code in the runtime. This patch also includes some (incomplete) changes to enum handling to make enums work in most common cases. 2016-05-24 20:03:28 -04:00
Saleem Abdulrasool
81661fca61 stdlib: use the reserved attribute spellings
This is a purely mechanical change replacing the attributes with the reserved
spelling.  Compilers are to not error when they encounter a reserved spelling
for an attribute which they do not support.
2016-05-11 11:30:24 -07:00
John McCall
50d58b2732 Add a lot of calling-convention annotations to the standard library / runtime.
The general rule here is that something needs to be SWIFT_CC(swift)
if it's just declared in Swift code using _silgen_name, as opposed to
importing something via a header.

Of course, SWIFT_CC(swift) expands to nothing by default for now, and
I haven't made an effort yet to add the indirect-result / context
parameter ABI attributes.  This is just a best-effort first pass.

I also took the opportunity to shift a few files to just implement
their shims header and to demote a few things to be private stdlib
interfaces.
2016-05-04 10:31:23 -07:00
Zhuowei Zhang
7c502b6344 Port to Android
This adds an Android target for the stdlib. It is also the first
example of cross-compiling outside of Darwin.

Mailing list discussions:

1. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151207/000171.html
2. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000492.html

The Android variant of Swift may be built using the following `build-script`
invocation:

```
$ utils/build-script \
  -R \                                           # Build in ReleaseAssert mode.
  --android \                                    # Build for Android.
  --android-ndk ~/android-ndk-r10e \             # Path to an Android NDK.
  --android-ndk-version 21 \
  --android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \
  --android-icu-uc-include ~/libicu-android/armeabi-v7a/icu/source/common \
  --android-icu-i18n ~/libicu-android/armeabi-v7a/libicui18n.so \
  --android-icu-i18n-include ~/libicu-android/armeabi-v7a/icu/source/i18n/
```

Android builds have the following dependencies, as can be seen in
the build script invocation:

1. An Android NDK of version 21 or greater, available to download
   here: http://developer.android.com/ndk/downloads/index.html.
2. A libicu compatible with android-armv7.
2016-04-12 19:26:21 -04:00
practicalswift
ea0ac3ac67 [gardening] Remove all tabs in C++ code 2016-04-08 21:22:57 +02:00
Nadav Rotem
6a11924038 Revert "Revert "Build the Swift runtime using the locally built clang compliler."" 2016-03-30 17:26:35 -07:00
Nadav Rotem
0c1a8f308a Revert "Build the Swift runtime using the locally built clang compliler." 2016-03-30 11:08:21 -07:00
Nadav Rotem
dab0095932 Don't build muloti4 on Apple-ARM64.
It looks like it's already included in:
lib/clang/3.8.0/lib/darwin/libclang_rt.ios.a(muloti4.c.o)
2016-03-29 14:29:32 -07:00
practicalswift
b61b6c8f42 [gardening] Fix two recently introduced accidental double spaces 2016-02-23 16:53:17 +01:00
Han Sangjin
e06c7136cb Porting to Cygwin. rebased and squashed 2016-02-22 13:20:21 +09:00
Joe Groff
f7291b21ec Runtime: Build with -fvisibility=hidden.
...and explicitly mark symbols we export, either for use by executables or for runtime-stdlib interaction. Until the stdlib supports resilience we have to allow programs to link to these SPI symbols.
2016-02-08 08:06:02 -08:00
Anton Blanchard
b1827d8a8f Add powerpc64le Linux support
This patch adds powerpc64le Linux support. While the patch also adds
the matching powerpc64 bits, there are endian issues that need to be
sorted out.

The PowerPC LLVM changes for the swift ABI (eg returning three element
non-homogeneous aggregates) are still in the works, but a simple LLVM
fix to allow those aggregates results in swift passing all but 8
test cases.
2016-01-15 06:48:31 +00:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Daniel Duan
ae601d2744 replace NULL with nullptr 2015-12-20 13:28:21 -08:00
Dmitri Gribenko
10a8f4e3f9 Merge pull request #348 from wczekalski/bugfix/float-string-precision
Fix precision of float to string to max significant decimals
2015-12-15 02:41:49 -08:00
Wojtek Czekalski
10b61b7d8c Made floating point numbers conform to CustomDebugStringConvertible
debugDescription prints numbers with greater precision
2015-12-14 19:25:14 +01:00
Wojtek Czekalski
e4fe5f1508 Introduced debug parameter in floating point to string conversion 2015-12-14 19:25:13 +01:00
Wojtek Czekalski
1ed9da86db Fix precision of float to string to max significant decimals
The default precision which is used for converting floating point numbers to strings leads to many confusing results. If we take a Float32 1.00000000 value and 1.00000012 of the same type, these two, obviously are not equal. However, if we log them, we are displayed the same value. So a much more helpful display using 9 decimal digits is thus: [1.00000000 != 1.00000012] showing that the two values are in fact different.
(example taken from: http://www.boost.org/doc/libs/1_59_0/libs/test/doc/html/boost_test/test_output/log_floating_points.html)

I'm by no means a floating point number expert, however having investigated this issue I found numerous sources saying that "magic" numbers 9 and 17 for 32 and 64 bit values respectively are the correct format. Numbers 9 and 17 represent the maximum number of decimal digits that round trips. This means that number 0.100000000000000005 and 0.1000000000000000 are the same as their floating-point representations are concerned.
2015-12-14 13:48:41 +01:00
Dmitri Gribenko
83751888c7 Start porting Swift to Linux on aarch64 (arm64)
Hello world works, a non-trivial part of the testsuite passes.
2015-12-13 17:05:42 -07:00
William Dillon
4bf81e09da Build working on ARMv7l 2015-12-12 22:06:13 -08:00
Chris Willmore
fb6f4be77f Merge pull request #227 from LeoShimonaka/master
Fix typos in docs / comments / method name
2015-12-04 22:44:18 -08:00
Leo Shimonaka
70e66973ee Fix spelling error in documentation / comments / method name 2015-12-05 00:28:08 -05:00
Landon Fuller
30080ae2c4 FreeBSD hides getline()'s prototype by default.
The alternative to _WITH_GETLINE would be to define _POSIX_C_SOURCE
>= 200809.
2015-12-04 12:25:47 -07:00
Landon Fuller
23fee41713 Add missing va_list include. 2015-12-04 12:25:30 -07:00
Joe Groff
5e5cdc6be3 Runtime: Use 'once' instead of static local variable initialization.
The C++ ABI for static locals is a bit heavy compared to dispatch_once; doing this saves more than 1KB in runtime code size. Dispatch_once/call_once is also more likely to be hot because it's also used by Swift and ObjC code.

Alas, llvm::get_execution_seed() from llvm/ADT/Hashing.h still inflicts one static local initialization on us we can't override (without forking Hashing.h, anyway).
2015-11-30 12:08:12 -08:00
Joe Groff
69a206229d Runtime: Start splitting out stubs only needed by the standard library.
Set up a separate libSwiftStubs.a archive for C++ stub functionality that's needed by the standard library but not part of the core runtime interface. Seed it with the Stubs.cpp and LibcShims.cpp files, which consist only of stubs, though a few stubs are still strewn across the runtime code base.
2015-11-11 17:28:57 -08:00