mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Run new `check-swift-embedded-wasi` target from `test/CMakeLists.txt`, tweak `lit.cfg` to support both `-wasi` and `-wasip1` triples, exclude unsupported tests based on `CPU=wasm32` instead of `OS=wasi`.
38 lines
952 B
Swift
38 lines
952 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %{python} %utils/split_file.py -o %t %s
|
|
|
|
// RUN: %target-swift-emit-ir %t/Main.swift -import-bridging-header %t/BridgingHeader.h -parse-as-library -enable-experimental-feature Embedded -wmo \
|
|
// RUN: -target armv7em-none-none-eabi -Xcc -mthumb -Xcc -mcpu=cortex-m7 -Xcc -mfloat-abi=hard -Xcc -mfpu=fpv5-sp-d16 -Xcc -D__FPU_USED=1 -Xcc -falign-functions=16
|
|
|
|
// UNSUPPORTED: CPU=wasm32
|
|
// REQUIRES: swift_in_compiler
|
|
// REQUIRES: optimized_stdlib
|
|
// REQUIRES: CODEGENERATOR=ARM
|
|
// REQUIRES: embedded_stdlib_cross_compiling
|
|
// REQUIRES: swift_feature_Embedded
|
|
|
|
// BEGIN BridgingHeader.h
|
|
|
|
typedef struct
|
|
{
|
|
float x;
|
|
float y;
|
|
float width;
|
|
float height;
|
|
} Rect;
|
|
|
|
typedef void FunctionType(Rect, Rect);
|
|
void (* _Nonnull callback)(FunctionType * _Nonnull func);
|
|
void c_function(Rect, Rect);
|
|
|
|
// BEGIN Main.swift
|
|
|
|
@main
|
|
struct Main {
|
|
static func main() {
|
|
callback({ a, b in
|
|
c_function(a, b)
|
|
})
|
|
}
|
|
}
|