| ... | @@ -25,6 +25,9 @@ fn noop1() align(1) void {} | ... | @@ -25,6 +25,9 @@ fn noop1() align(1) void {} |
| 25 | fn noop4() align(4) void {} | 25 | fn noop4() align(4) void {} |
| 26 | | 26 | |
| 27 | test "function alignment" { | 27 | test "function alignment" { |
| | 28 | // function alignment is a compile error on wasm32/wasm64 |
| | 29 | if (builtin.arch == .wasm32 or builtin.arch == .wasm64) return error.SkipZigTest; |
| | 30 | |
| 28 | expect(derp() == 1234); | 31 | expect(derp() == 1234); |
| 29 | expect(@TypeOf(noop1) == fn () align(1) void); | 32 | expect(@TypeOf(noop1) == fn () align(1) void); |
| 30 | expect(@TypeOf(noop4) == fn () align(4) void); | 33 | expect(@TypeOf(noop4) == fn () align(4) void); |
| ... | @@ -117,6 +120,9 @@ fn sliceExpects4(slice: []align(4) u32) void { | ... | @@ -117,6 +120,9 @@ fn sliceExpects4(slice: []align(4) u32) void { |
| 117 | } | 120 | } |
| 118 | | 121 | |
| 119 | test "implicitly decreasing fn alignment" { | 122 | test "implicitly decreasing fn alignment" { |
| | 123 | // function alignment is a compile error on wasm32/wasm64 |
| | 124 | if (builtin.arch == .wasm32 or builtin.arch == .wasm64) return error.SkipZigTest; |
| | 125 | |
| 120 | testImplicitlyDecreaseFnAlign(alignedSmall, 1234); | 126 | testImplicitlyDecreaseFnAlign(alignedSmall, 1234); |
| 121 | testImplicitlyDecreaseFnAlign(alignedBig, 5678); | 127 | testImplicitlyDecreaseFnAlign(alignedBig, 5678); |
| 122 | } | 128 | } |
| ... | @@ -133,8 +139,8 @@ fn alignedBig() align(16) i32 { | ... | @@ -133,8 +139,8 @@ fn alignedBig() align(16) i32 { |
| 133 | } | 139 | } |
| 134 | | 140 | |
| 135 | test "@alignCast functions" { | 141 | test "@alignCast functions" { |
| 136 | // TODO investigate why this fails when cross-compiled to wasm. | 142 | // function alignment is a compile error on wasm32/wasm64 |
| 137 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | 143 | if (builtin.arch == .wasm32 or builtin.arch == .wasm64) return error.SkipZigTest; |
| 138 | | 144 | |
| 139 | expect(fnExpectsOnly1(simple4) == 0x19); | 145 | expect(fnExpectsOnly1(simple4) == 0x19); |
| 140 | } | 146 | } |
| ... | @@ -149,6 +155,9 @@ fn simple4() align(4) i32 { | ... | @@ -149,6 +155,9 @@ fn simple4() align(4) i32 { |
| 149 | } | 155 | } |
| 150 | | 156 | |
| 151 | test "generic function with align param" { | 157 | test "generic function with align param" { |
| | 158 | // function alignment is a compile error on wasm32/wasm64 |
| | 159 | if (builtin.arch == .wasm32 or builtin.arch == .wasm64) return error.SkipZigTest; |
| | 160 | |
| 152 | expect(whyWouldYouEverDoThis(1) == 0x1); | 161 | expect(whyWouldYouEverDoThis(1) == 0x1); |
| 153 | expect(whyWouldYouEverDoThis(4) == 0x1); | 162 | expect(whyWouldYouEverDoThis(4) == 0x1); |
| 154 | expect(whyWouldYouEverDoThis(8) == 0x1); | 163 | expect(whyWouldYouEverDoThis(8) == 0x1); |
| ... | @@ -327,8 +336,8 @@ test "align(@alignOf(T)) T does not force resolution of T" { | ... | @@ -327,8 +336,8 @@ test "align(@alignOf(T)) T does not force resolution of T" { |
| 327 | } | 336 | } |
| 328 | | 337 | |
| 329 | test "align(N) on functions" { | 338 | test "align(N) on functions" { |
| 330 | // TODO investigate why this fails when cross-compiled to wasm. | 339 | // function alignment is a compile error on wasm32/wasm64 |
| 331 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | 340 | if (builtin.arch == .wasm32 or builtin.arch == .wasm64) return error.SkipZigTest; |
| 332 | | 341 | |
| 333 | expect((@ptrToInt(overaligned_fn) & (0x1000 - 1)) == 0); | 342 | expect((@ptrToInt(overaligned_fn) & (0x1000 - 1)) == 0); |
| 334 | } | 343 | } |