Skip to content
Merged
2 changes: 1 addition & 1 deletion lib/ClangImporter/ImportType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ namespace {
}

static const llvm::StringLiteral vaListNames[] = {
"va_list", "__gnuc_va_list", "__va_list"
"va_list", "__gnuc_va_list", "__isoc_va_list", "__va_list"
};

ImportHint hint = ImportHint::None;
Expand Down
1 change: 1 addition & 0 deletions lib/ClangImporter/MappedTypes.def
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ MAP_STDLIB_TYPE("u_int64_t", UnsignedInt, 64, "UInt64", false, DoNothing)
// There's an explicit workaround in ImportType.cpp's VisitDecayedType for that.
MAP_STDLIB_TYPE("va_list", VaList, 0, "CVaListPointer", false, DoNothing)
MAP_STDLIB_TYPE("__gnuc_va_list", VaList, 0, "CVaListPointer", false, DoNothing)
MAP_STDLIB_TYPE("__isoc_va_list", VaList, 0, "CVaListPointer", false, DoNothing)
MAP_STDLIB_TYPE("__va_list", VaList, 0, "CVaListPointer", false, DoNothing)

// libkern/OSTypes.h types.
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/VarArgs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ final internal class __VaListBuilder {
// supported vararg type is greater than the alignment of Int, such
// as non-iOS ARM. Note that we can't use alignof because it
// differs from ABI alignment on some architectures.
#if arch(arm) && !os(iOS)
#if (arch(arm) && !os(iOS)) || arch(wasm32)
if let arg = arg as? _CVarArgAligned {
let alignmentInWords = arg._cVarArgAlignment / MemoryLayout<Int>.size
let misalignmentInWords = count % alignmentInWords
Expand Down
2 changes: 1 addition & 1 deletion test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ elif run_os == 'wasi':
config.swift_test_options, config.swift_frontend_test_options)
subst_target_swift_frontend_mock_sdk = config.target_swift_frontend
subst_target_swift_frontend_mock_sdk_after = ""
config.target_run = 'wasmtime --'
config.target_run = 'wasmer run --backend cranelift --'
if 'interpret' in lit_config.params:
use_interpreter_for_simple_runs()
config.target_sil_opt = (
Expand Down
4 changes: 4 additions & 0 deletions test/stdlib/Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ ErrorTests.test("default domain and code") {

enum SillyError: Error { case JazzHands }

#if !os(WASI)
ErrorTests.test("try!")
.skip(.custom({ _isFastAssertConfiguration() },
reason: "trap is not guaranteed to happen in -Ounchecked"))
Expand All @@ -127,6 +128,7 @@ ErrorTests.test("try!/location")
expectCrashLater()
let _: () = try! { throw SillyError.JazzHands }()
}
#endif

ErrorTests.test("try?") {
var value = try? { () throws -> Int in return 1 }()
Expand Down Expand Up @@ -191,6 +193,7 @@ ErrorTests.test("test dealloc empty error box") {
}
}

#if !os(WASI)
var errors: [Error] = []
ErrorTests.test("willThrow") {
if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) {
Expand All @@ -215,6 +218,7 @@ ErrorTests.test("willThrow") {
expectEqual(SillyError.self, type(of: errors.last!))
}
}
#endif

runAllTests()

2 changes: 1 addition & 1 deletion test/stdlib/FlatMapDeprecation.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %swift -swift-version 4 -typecheck -verify %s
// RUN: %target-typecheck-verify-swift -swift-version 4

func flatMapOnSequence<
S : Sequence
Expand Down
1 change: 1 addition & 0 deletions test/stdlib/InputStream.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// -*- swift -*-
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
// UNSUPPORTED: OS=wasi

import StdlibUnittest

Expand Down
2 changes: 2 additions & 0 deletions test/stdlib/Mirror.swift
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ mirrors.test("Addressing") {
expectNil(m.descendant(1, 1, "bork"))
}

#if !os(WASI)
mirrors.test("Invalid Path Type")
.skip(.custom(
{ _isFastAssertConfiguration() },
Expand All @@ -968,6 +969,7 @@ mirrors.test("Invalid Path Type")
expectCrashLater()
_ = m.descendant(X())
}
#endif

mirrors.test("PlaygroundQuickLook") {
// Customization works.
Expand Down
4 changes: 2 additions & 2 deletions test/stdlib/Runtime.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ Reflection.test("multiprotocolTypes") {
var BitTwiddlingTestSuite = TestSuite("BitTwiddling")

BitTwiddlingTestSuite.test("_pointerSize") {
#if arch(i386) || arch(arm)
#if arch(i386) || arch(arm) || arch(wasm32)
expectEqual(4, MemoryLayout<Optional<AnyObject>>.size)
#elseif arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)
expectEqual(8, MemoryLayout<Optional<AnyObject>>.size)
Expand All @@ -730,7 +730,7 @@ BitTwiddlingTestSuite.test("_isPowerOf2/Int") {
expectTrue(_isPowerOf2(asInt(2)))
expectFalse(_isPowerOf2(asInt(3)))
expectTrue(_isPowerOf2(asInt(1024)))
#if arch(i386) || arch(arm)
#if arch(i386) || arch(arm) || arch(wasm32)
// Not applicable to 32-bit architectures.
#elseif arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)
expectTrue(_isPowerOf2(asInt(0x8000_0000)))
Expand Down
2 changes: 2 additions & 0 deletions test/stdlib/StringAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ StringTests.test("SameTypeComparisons") {
expectFalse(xs != xs)
}

#if !os(WASI)
StringTests.test("CompareStringsWithUnpairedSurrogates")
.xfail(
.always("<rdar://problem/18029104> Strings referring to underlying " +
Expand All @@ -334,6 +335,7 @@ StringTests.test("CompareStringsWithUnpairedSurrogates")
]
)
}
#endif

StringTests.test("[String].joined() -> String") {
let s = ["hello", "world"].joined()
Expand Down
7 changes: 2 additions & 5 deletions utils/webassembly/linux/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ cd $SWIFT_PATH

./utils/update-checkout --clone --scheme wasm --skip-repository swift

# Install wasmtime
# Install wasmer

sudo mkdir /opt/wasmtime && cd /opt/wasmtime
wget -O - "https://github.com/bytecodealliance/wasmtime/releases/download/v0.8.0/wasmtime-v0.8.0-x86_64-linux.tar.xz" | \
sudo tar Jx --strip-components 1
sudo ln -sf /opt/wasmtime/* /usr/local/bin
curl https://get.wasmer.io -sSfL | sh

cd $SOURCE_PATH

Expand Down
9 changes: 1 addition & 8 deletions utils/webassembly/macos/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,14 @@
set -ex

brew uninstall python@2 || true
brew install cmake ninja llvm sccache
brew install cmake ninja llvm sccache wasmer

SOURCE_PATH="$( cd "$(dirname $0)/../../../../" && pwd )"
SWIFT_PATH=$SOURCE_PATH/swift
cd $SWIFT_PATH

./utils/update-checkout --clone --scheme wasm --skip-repository swift

# Install wasmtime

sudo mkdir /opt/wasmtime && cd /opt/wasmtime
wget -O - "https://github.com/bytecodealliance/wasmtime/releases/download/v0.8.0/wasmtime-v0.8.0-x86_64-macos.tar.xz" | \
sudo tar Jx --strip-components 1
sudo ln -sf /opt/wasmtime/* /usr/local/bin

cd $SOURCE_PATH

wget -O dist-wasi-sdk.tgz.zip "https://github.com/swiftwasm/wasi-sdk/releases/download/0.2.0-swiftwasm/dist-macos-latest.tgz.zip"
Expand Down