mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Allow specifying an import module using @wasm #1305.
This commit is contained in:
26
test/test_suite/attributes/attributes_repeat_param.c3t
Normal file
26
test/test_suite/attributes/attributes_repeat_param.c3t
Normal file
@@ -0,0 +1,26 @@
|
||||
// #target: macos-aarch64
|
||||
module test;
|
||||
|
||||
def @Test(x) = { @extern("Foo" +++ x) };
|
||||
|
||||
fn void hello_world() @Test("Megaman")
|
||||
{}
|
||||
|
||||
fn void ello_world() @Test("Pegasus")
|
||||
{}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
hello_world();
|
||||
ello_world();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
call void @FooMegaman()
|
||||
call void @FooPegasus()
|
||||
ret i32 0
|
||||
}
|
||||
8
test/test_suite/attributes/wasm_import.c3t
Normal file
8
test/test_suite/attributes/wasm_import.c3t
Normal file
@@ -0,0 +1,8 @@
|
||||
// #target: wasm32
|
||||
module test;
|
||||
extern fn void test() @wasm("hello", "world");
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
declare void @world() #0
|
||||
attributes #0 = { nounwind uwtable "no-trapping-math"="true" "stack-protector-buffer-size"="8" "wasm-export-name"="world" "wasm-import-module"="hello" "wasm-import-name"="world" }
|
||||
5
test/test_suite/attributes/wasm_module.c3
Normal file
5
test/test_suite/attributes/wasm_module.c3
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
fn void test() @wasm("hello", "world") { } // #error: Specifying a wasm import module
|
||||
extern fn void test2() @wasm("a", "b", "c"); // #error: Too many arguments to
|
||||
extern fn void test3() @extern("hello") @wasm("a"); // #error: An external name
|
||||
extern fn void test4() @extern("hello") @wasm("a", "b"); // #error: An external name
|
||||
Reference in New Issue
Block a user