| 1 | const lang = @import("std").lang; |
| 2 | |
| 3 | fn al() comptime_int { |
| 4 | return 16; |
| 5 | } |
| 6 | |
| 7 | fn as() lang.AddressSpace { |
| 8 | return .generic; |
| 9 | } |
| 10 | |
| 11 | fn ls() []const u8 { |
| 12 | return "text"; |
| 13 | } |
| 14 | |
| 15 | fn cc() lang.CallingConvention { |
| 16 | return .c; |
| 17 | } |
| 18 | |
| 19 | fn rv() type { |
| 20 | return void; |
| 21 | } |
| 22 | |
| 23 | extern var a: u64 align(al()) addrspace(as()) linksection(ls()); |
| 24 | extern fn b() align(al()) addrspace(as()) linksection(ls()) callconv(cc()) rv(); |
| 25 | // Intentionally not `export` so it is never analyzed since the qualifiers are |
| 26 | // not valid for all targets. The main point of this test is checking that Zir |
| 27 | // generation is done correctly for these, so the above is not an issue. |
| 28 | fn c() align(al()) addrspace(as()) linksection(ls()) callconv(cc()) rv() { |
| 29 | const v: struct { |
| 30 | x: u32, |
| 31 | y: u32, |
| 32 | } align(al()) = undefined; |
| 33 | const ta: u64, const tb: struct { |
| 34 | x: u32, |
| 35 | y: u32, |
| 36 | } align(al()) = .{ 0, .{ .x = 10, .y = 20 } }; |
| 37 | _ = v; |
| 38 | _ = a; |
| 39 | _ = b; |
| 40 | _ = ta; |
| 41 | _ = tb; |
| 42 | } |
| 43 | |
| 44 | // compile |
| 45 | // output_mode=Obj |