Commit Graph

430 Commits

Author SHA1 Message Date
Umberto Raimondi
fe6007efae Exported ioctl() 2016-06-09 08:45:05 +02:00
Arsen Gasparyan
2c634e7fca Change all uses of 'CInt' to 'Int32' in the SDK overlay 2016-06-05 20:52:23 +03:00
practicalswift
8df3859ce7 [gardening] Fix recently introduced typos. 2016-06-05 11:11:44 +02:00
SpringsUp
673a8ecb26 Generate native glibc.modulemap when cross-compiling 2016-05-27 15:35:57 +02:00
Dmitri Gribenko
d591f9cf7a stdlib: remove most uses of @warn_unused_result, which does nothing now
I kept the one on sorted(), because that one requires a less trivial
change.
2016-05-19 18:39:39 -07:00
Stephen Canon
6429eabf74 Implement the new FloatingPoint protocols from SE-0067.
There are a couple of features that are not yet implemented, because they require additions to the Builtin module.  Specifically, this implementation does not have:

- formRemainder(dividingBy:)
- formSquareRoot()
- addProduct(_:,_:)

Also missing are the generic initializers and comparisons whose implementation depends on having new Integer protocols.

The last remaining feature of SE-0067 is that while the basic operators +,-,*,/, etc are moved onto the FloatingPoint protocol, they are still required on the concrete types in order to disambiguate overloads.  Fixing this seems to require either modifying the overload resolution rules or removing these operators from some other protocols.  Or it might just require that someone smarter than me looks at the problem.

Passes all the existing tests (with the included changes).  I'm working on additional tests for the new features.
2016-05-09 10:34:13 -04:00
practicalswift
c262b42ae0 [gardening] Fix recently introduced whitespace typos. (#2443) 2016-05-06 23:49:39 -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
practicalswift
8e3ba900b0 [gardening] Fix recently introduced headers. 2016-05-01 12:59:13 +02:00
rintaro ishizaki
458e68900a [Platform] Simplify glibc.modulemap generation
Get rid of cmake configure_file and gyb combination.
2016-04-26 11:59:03 +09:00
Han Sangjin
bf9413316e stdlib/cygwin: Modified SwiftGlibc for Cygwin and some fix
'import SwiftGlibc' is now work in Cygwin.
Add workaround about USER_LABEL_PREFIX for Clang bug.
2016-04-18 07:49:57 +09:00
Chris Lattner
4fd8418ba7 move the stdlib to put noescape and autoclosure on the type, instead of
the parameter.  Progress towards SE-0049.
2016-04-14 23:13:43 -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
Jordan Rose
bc83940301 Make pointer nullability explicit using Optional.
Implements SE-0055: https://github.com/apple/swift-evolution/blob/master/proposals/0055-optional-unsafe-pointers.md

- Add NULL as an extra inhabitant of Builtin.RawPointer (currently
  hardcoded to 0 rather than being target-dependent).
- Import non-object pointers as Optional/IUO when nullable/null_unspecified
  (like everything else).
- Change the type checker's *-to-pointer conversions to handle a layer of
  optional.
- Use 'AutoreleasingUnsafeMutablePointer<NSError?>?' as the type of error
  parameters exported to Objective-C.
- Drop NilLiteralConvertible conformance for all pointer types.
- Update the standard library and then all the tests.

I've decided to leave this commit only updating existing tests; any new
tests will come in the following commits. (That may mean some additional
implementation work to follow.)

The other major piece that's missing here is migration. I'm hoping we get
a lot of that with Swift 1.1's work for optional object references, but
I still need to investigate.
2016-04-11 20:06:38 -07:00
Brian Gesiak
1fbdaee4d0 [Platform] Unify Linux/FreeBSD modulemaps with gyb
A great deal of duplication exists across the Linux and FreeBSD
modulemaps. An Android modulemap would add even more duplication.

Use gyb to conditionally include certain exports for certain
platforms. Most of glibc.modulemap is common across Linux and FreeBSD,
and using gyb we can conditionally include the two exports that differ.
2016-04-07 11:25:40 -04:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Chris Lattner
b3263cb4e9 Merge pull request #2030 from danra/patch-6
Cosmetic fixes (NFC)
2016-04-03 14:56:16 -07:00
Chris Lattner
72ded75f6c Merge pull request #2032 from danra/patch-9
Cosmetic fixes (NFC)
2016-04-03 14:55:36 -07:00
danra
37024e6ea0 Cosmetic fixes (NFC)
- Add newlines where missing to match sys/errno.h error groups separation
- Prefer single-line comments to C-style comments
- Align most comments to same column
- Add comment following #endif at EOF to show what it ends
- Remove extraneous whitespace
2016-04-02 17:14:28 +03:00
danra
c3423529f9 Cosmetic fixes (NFC)
- Fix includes order
- Add  comments after endifs to indicate what they end
2016-04-02 16:49:43 +03:00
danra
7c15fc577e Cosmetic fixes (NFC)
- Added missing periods to end of comments
- Remove extra whitespace
- Add comment to endif at EOF indicating what it ends
2016-04-02 16:39:48 +03:00
Jordan Rose
6dd1f0a5f9 [stdlib] Apply @_fixed_layout to various stdlib and overlay types
This is a staging attribute that will eventually mean "fixed-contents"
for structs and "closed" for enums, as described in
docs/LibraryEvolution.rst.

This is pretty much the minimal set of types that must be fixed-layout,
because SILGen makes assumptions about their lowering.

If desired, some SILGen refactoring can allow some of these to be
resilient. For example, bridging value types could be made to work
with resilient types.
2016-04-01 13:07:18 -07:00
Slava Pestov
4a34aa7895 Re-apply "stdlib: Add minimum set of @_versioned attributes to build without -sil-serialize-all"
This reverts commit 22864721ca.
2016-03-28 20:08:12 -07:00
Slava Pestov
22864721ca Revert "stdlib: Add minimum set of @_versioned attributes to build without -sil-serialize-all"
Somehow this broke the Foundation build on Linux.

This reverts commit dce09c17c2.
2016-03-25 23:34:01 -07:00
Slava Pestov
dce09c17c2 stdlib: Add minimum set of @_versioned attributes to build without -sil-serialize-all
When we're not serializing SIL for all function bodies, @_transparent
functions can only reference internal functions that are declared
@_versioned, otherwise there's no serialized body and no public entry
point, so any client that inlines the @_transparent function will
not be able to link.

This patch adds the minimum set of @_versioned declarations to allow
a non-optimized build of the standard library and overlays.

Recall that this attribute is just a temporary hack to make progress
on building the standard library with resilience enabled.

Once availability and resilience learn about each other, @_versioned
will be replaced by having an availability annotation on an internal
declaration. Invariants will be diagnosed by Sema instead of asserting
in the SIL verifier.

Finally, the set of "internal but available" declarations will
eventually be audited instead of determined by experimentation.

This almost closes out https://bugs.swift.org/browse/SR-267.

The remaining issue is an interaction between SIL optimizations and
serialization that will be fixed with some upcoming changes to the
optimizer.
2016-03-25 22:45:50 -07:00
practicalswift
ac87f428ea [gardening] Fix formatting of recently introduced headers. 2016-03-22 21:36:09 +01:00
rintaro ishizaki
91108b4602 [stdlib] Implement tgmath in Glibc 2016-03-23 00:51:50 +09:00
rintaro ishizaki
9ce1387ee3 [stdlib] Merged Glibc code to Platform directory. 2016-03-23 00:51:37 +09:00
rintaro ishizaki
eecfb6e41d [stdlib] Renamed cross-platform C helper functions in Darwin so that we can share them with Glibc. 2016-03-22 16:07:48 +09:00
rintaro ishizaki
d875a56a75 [stdlib] Moved stdlib/public/SDK/Darwin to stdlib/public/Platform. NFC 2016-03-22 16:05:51 +09:00