| ... | ... | @@ -15,7 +15,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 15 | 15 | // Regular old hello world |
| 16 | 16 | case.addCompareOutput( |
| 17 | 17 | \\extern fn puts(s: [*:0]const u8) c_int; |
| 18 | | \\export fn main() c_int { |
| 18 | \\pub export fn main() c_int { |
| 19 | 19 | \\ _ = puts("hello world!"); |
| 20 | 20 | \\ return 0; |
| 21 | 21 | \\} |
| ... | ... | @@ -24,7 +24,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 24 | 24 | // Now change the message only |
| 25 | 25 | case.addCompareOutput( |
| 26 | 26 | \\extern fn puts(s: [*:0]const u8) c_int; |
| 27 | | \\export fn main() c_int { |
| 27 | \\pub export fn main() c_int { |
| 28 | 28 | \\ _ = puts("yo"); |
| 29 | 29 | \\ return 0; |
| 30 | 30 | \\} |
| ... | ... | @@ -33,7 +33,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 33 | 33 | // Add an unused Decl |
| 34 | 34 | case.addCompareOutput( |
| 35 | 35 | \\extern fn puts(s: [*:0]const u8) c_int; |
| 36 | | \\export fn main() c_int { |
| 36 | \\pub export fn main() c_int { |
| 37 | 37 | \\ _ = puts("yo!"); |
| 38 | 38 | \\ return 0; |
| 39 | 39 | \\} |
| ... | ... | @@ -43,7 +43,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 43 | 43 | // Comptime return type and calling convention expected. |
| 44 | 44 | case.addError( |
| 45 | 45 | \\var x: i32 = 1234; |
| 46 | | \\export fn main() x { |
| 46 | \\pub export fn main() x { |
| 47 | 47 | \\ return 0; |
| 48 | 48 | \\} |
| 49 | 49 | \\export fn foo() callconv(y) c_int { |
| ... | ... | @@ -62,7 +62,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 62 | 62 | case.addCompareOutput( |
| 63 | 63 | \\extern fn printf(format: [*:0]const u8, ...) c_int; |
| 64 | 64 | \\ |
| 65 | | \\export fn main() c_int { |
| 65 | \\pub export fn main() c_int { |
| 66 | 66 | \\ _ = printf("Hello, %s!\n", "world"); |
| 67 | 67 | \\ return 0; |
| 68 | 68 | \\} |
| ... | ... | @@ -119,14 +119,14 @@ pub fn addCases(ctx: *TestContext) !void { |
| 119 | 119 | \\ unreachable; |
| 120 | 120 | \\} |
| 121 | 121 | \\ |
| 122 | | \\export fn main() c_int { |
| 122 | \\pub export fn main() c_int { |
| 123 | 123 | \\ exitGood(); |
| 124 | 124 | \\} |
| 125 | 125 | , ""); |
| 126 | 126 | |
| 127 | 127 | // Pass a usize parameter to exit |
| 128 | 128 | case.addCompareOutput( |
| 129 | | \\export fn main() c_int { |
| 129 | \\pub export fn main() c_int { |
| 130 | 130 | \\ exit(0); |
| 131 | 131 | \\} |
| 132 | 132 | \\ |
| ... | ... | @@ -142,7 +142,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 142 | 142 | |
| 143 | 143 | // Change the parameter to u8 |
| 144 | 144 | case.addCompareOutput( |
| 145 | | \\export fn main() c_int { |
| 145 | \\pub export fn main() c_int { |
| 146 | 146 | \\ exit(0); |
| 147 | 147 | \\} |
| 148 | 148 | \\ |
| ... | ... | @@ -158,7 +158,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 158 | 158 | |
| 159 | 159 | // Do some arithmetic at the exit callsite |
| 160 | 160 | case.addCompareOutput( |
| 161 | | \\export fn main() c_int { |
| 161 | \\pub export fn main() c_int { |
| 162 | 162 | \\ exitMath(1); |
| 163 | 163 | \\} |
| 164 | 164 | \\ |
| ... | ... | @@ -179,7 +179,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 179 | 179 | |
| 180 | 180 | // Invert the arithmetic |
| 181 | 181 | case.addCompareOutput( |
| 182 | | \\export fn main() c_int { |
| 182 | \\pub export fn main() c_int { |
| 183 | 183 | \\ exitMath(1); |
| 184 | 184 | \\} |
| 185 | 185 | \\ |
| ... | ... | @@ -211,7 +211,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 211 | 211 | \\ return add(a, b); |
| 212 | 212 | \\} |
| 213 | 213 | \\ |
| 214 | | \\export fn main() c_int { |
| 214 | \\pub export fn main() c_int { |
| 215 | 215 | \\ return addIndirect(1, 2) - 3; |
| 216 | 216 | \\} |
| 217 | 217 | , ""); |
| ... | ... | @@ -225,7 +225,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 225 | 225 | \\ return a + b; |
| 226 | 226 | \\} |
| 227 | 227 | \\ |
| 228 | | \\export fn main() c_int { |
| 228 | \\pub export fn main() c_int { |
| 229 | 229 | \\ const x = add(1, 2); |
| 230 | 230 | \\ var y = add(3, 0); |
| 231 | 231 | \\ y -= x; |
| ... | ... | @@ -237,7 +237,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 237 | 237 | var case = ctx.exeFromCompiledC("@setEvalBranchQuota", .{}); |
| 238 | 238 | |
| 239 | 239 | case.addCompareOutput( |
| 240 | | \\export fn main() i32 { |
| 240 | \\pub export fn main() i32 { |
| 241 | 241 | \\ @setEvalBranchQuota(1001); |
| 242 | 242 | \\ const y = rec(1001); |
| 243 | 243 | \\ return y - 1; |
| ... | ... | @@ -254,14 +254,14 @@ pub fn addCases(ctx: *TestContext) !void { |
| 254 | 254 | |
| 255 | 255 | // Simple while loop |
| 256 | 256 | case.addCompareOutput( |
| 257 | | \\export fn main() c_int { |
| 257 | \\pub export fn main() c_int { |
| 258 | 258 | \\ var a: c_int = 0; |
| 259 | 259 | \\ while (a < 5) : (a+=1) {} |
| 260 | 260 | \\ return a - 5; |
| 261 | 261 | \\} |
| 262 | 262 | , ""); |
| 263 | 263 | case.addCompareOutput( |
| 264 | | \\export fn main() c_int { |
| 264 | \\pub export fn main() c_int { |
| 265 | 265 | \\ var a = true; |
| 266 | 266 | \\ while (!a) {} |
| 267 | 267 | \\ return 0; |
| ... | ... | @@ -270,7 +270,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 270 | 270 | |
| 271 | 271 | // If expression |
| 272 | 272 | case.addCompareOutput( |
| 273 | | \\export fn main() c_int { |
| 273 | \\pub export fn main() c_int { |
| 274 | 274 | \\ var cond: c_int = 0; |
| 275 | 275 | \\ var a: c_int = @as(c_int, if (cond == 0) |
| 276 | 276 | \\ 2 |
| ... | ... | @@ -282,7 +282,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 282 | 282 | |
| 283 | 283 | // If expression with breakpoint that does not get hit |
| 284 | 284 | case.addCompareOutput( |
| 285 | | \\export fn main() c_int { |
| 285 | \\pub export fn main() c_int { |
| 286 | 286 | \\ var x: i32 = 1; |
| 287 | 287 | \\ if (x != 1) @breakpoint(); |
| 288 | 288 | \\ return 0; |
| ... | ... | @@ -291,7 +291,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 291 | 291 | |
| 292 | 292 | // Switch expression |
| 293 | 293 | case.addCompareOutput( |
| 294 | | \\export fn main() c_int { |
| 294 | \\pub export fn main() c_int { |
| 295 | 295 | \\ var cond: c_int = 0; |
| 296 | 296 | \\ var a: c_int = switch (cond) { |
| 297 | 297 | \\ 1 => 1, |
| ... | ... | @@ -306,7 +306,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 306 | 306 | |
| 307 | 307 | // Switch expression missing else case. |
| 308 | 308 | case.addError( |
| 309 | | \\export fn main() c_int { |
| 309 | \\pub export fn main() c_int { |
| 310 | 310 | \\ var cond: c_int = 0; |
| 311 | 311 | \\ const a: c_int = switch (cond) { |
| 312 | 312 | \\ 1 => 1, |
| ... | ... | @@ -320,7 +320,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 320 | 320 | |
| 321 | 321 | // Switch expression, has an unreachable prong. |
| 322 | 322 | case.addCompareOutput( |
| 323 | | \\export fn main() c_int { |
| 323 | \\pub export fn main() c_int { |
| 324 | 324 | \\ var cond: c_int = 0; |
| 325 | 325 | \\ const a: c_int = switch (cond) { |
| 326 | 326 | \\ 1 => 1, |
| ... | ... | @@ -337,7 +337,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 337 | 337 | // Switch expression, has an unreachable prong and prongs write |
| 338 | 338 | // to result locations. |
| 339 | 339 | case.addCompareOutput( |
| 340 | | \\export fn main() c_int { |
| 340 | \\pub export fn main() c_int { |
| 341 | 341 | \\ var cond: c_int = 0; |
| 342 | 342 | \\ var a: c_int = switch (cond) { |
| 343 | 343 | \\ 1 => 1, |
| ... | ... | @@ -353,7 +353,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 353 | 353 | |
| 354 | 354 | // Integer switch expression has duplicate case value. |
| 355 | 355 | case.addError( |
| 356 | | \\export fn main() c_int { |
| 356 | \\pub export fn main() c_int { |
| 357 | 357 | \\ var cond: c_int = 0; |
| 358 | 358 | \\ const a: c_int = switch (cond) { |
| 359 | 359 | \\ 1 => 1, |
| ... | ... | @@ -372,7 +372,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 372 | 372 | |
| 373 | 373 | // Boolean switch expression has duplicate case value. |
| 374 | 374 | case.addError( |
| 375 | | \\export fn main() c_int { |
| 375 | \\pub export fn main() c_int { |
| 376 | 376 | \\ var a: bool = false; |
| 377 | 377 | \\ const b: c_int = switch (a) { |
| 378 | 378 | \\ false => 1, |
| ... | ... | @@ -386,7 +386,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 386 | 386 | |
| 387 | 387 | // Sparse (no range capable) switch expression has duplicate case value. |
| 388 | 388 | case.addError( |
| 389 | | \\export fn main() c_int { |
| 389 | \\pub export fn main() c_int { |
| 390 | 390 | \\ const A: type = i32; |
| 391 | 391 | \\ const b: c_int = switch (A) { |
| 392 | 392 | \\ i32 => 1, |
| ... | ... | @@ -402,7 +402,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 402 | 402 | |
| 403 | 403 | // Ranges not allowed for some kinds of switches. |
| 404 | 404 | case.addError( |
| 405 | | \\export fn main() c_int { |
| 405 | \\pub export fn main() c_int { |
| 406 | 406 | \\ const A: type = i32; |
| 407 | 407 | \\ const b: c_int = switch (A) { |
| 408 | 408 | \\ i32 => 1, |
| ... | ... | @@ -418,7 +418,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 418 | 418 | |
| 419 | 419 | // Switch expression has unreachable else prong. |
| 420 | 420 | case.addError( |
| 421 | | \\export fn main() c_int { |
| 421 | \\pub export fn main() c_int { |
| 422 | 422 | \\ var a: u2 = 0; |
| 423 | 423 | \\ const b: i32 = switch (a) { |
| 424 | 424 | \\ 0 => 10, |
| ... | ... | @@ -437,7 +437,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 437 | 437 | |
| 438 | 438 | // // Simple while loop |
| 439 | 439 | // case.addCompareOutput( |
| 440 | | // \\export fn main() c_int { |
| 440 | // \\pub export fn main() c_int { |
| 441 | 441 | // \\ var count: c_int = 0; |
| 442 | 442 | // \\ var opt_ptr: ?*c_int = &count; |
| 443 | 443 | // \\ while (opt_ptr) |_| : (count += 1) { |
| ... | ... | @@ -449,7 +449,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 449 | 449 | |
| 450 | 450 | // // Same with non pointer optionals |
| 451 | 451 | // case.addCompareOutput( |
| 452 | | // \\export fn main() c_int { |
| 452 | // \\pub export fn main() c_int { |
| 453 | 453 | // \\ var count: c_int = 0; |
| 454 | 454 | // \\ var opt_ptr: ?c_int = count; |
| 455 | 455 | // \\ while (opt_ptr) |_| : (count += 1) { |
| ... | ... | @@ -463,7 +463,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 463 | 463 | { |
| 464 | 464 | var case = ctx.exeFromCompiledC("errors", .{}); |
| 465 | 465 | case.addCompareOutput( |
| 466 | | \\export fn main() c_int { |
| 466 | \\pub export fn main() c_int { |
| 467 | 467 | \\ var e1 = error.Foo; |
| 468 | 468 | \\ var e2 = error.Bar; |
| 469 | 469 | \\ assert(e1 != e2); |
| ... | ... | @@ -476,14 +476,14 @@ pub fn addCases(ctx: *TestContext) !void { |
| 476 | 476 | \\} |
| 477 | 477 | , ""); |
| 478 | 478 | case.addCompareOutput( |
| 479 | | \\export fn main() c_int { |
| 479 | \\pub export fn main() c_int { |
| 480 | 480 | \\ var e: anyerror!c_int = 0; |
| 481 | 481 | \\ const i = e catch 69; |
| 482 | 482 | \\ return i; |
| 483 | 483 | \\} |
| 484 | 484 | , ""); |
| 485 | 485 | case.addCompareOutput( |
| 486 | | \\export fn main() c_int { |
| 486 | \\pub export fn main() c_int { |
| 487 | 487 | \\ var e: anyerror!c_int = error.Foo; |
| 488 | 488 | \\ const i = e catch 69; |
| 489 | 489 | \\ return 69 - i; |
| ... | ... | @@ -495,7 +495,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 495 | 495 | var case = ctx.exeFromCompiledC("structs", .{}); |
| 496 | 496 | case.addError( |
| 497 | 497 | \\const Point = struct { x: i32, y: i32 }; |
| 498 | | \\export fn main() c_int { |
| 498 | \\pub export fn main() c_int { |
| 499 | 499 | \\ var p: Point = .{ |
| 500 | 500 | \\ .y = 24, |
| 501 | 501 | \\ .x = 12, |
| ... | ... | @@ -509,7 +509,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 509 | 509 | }); |
| 510 | 510 | case.addError( |
| 511 | 511 | \\const Point = struct { x: i32, y: i32 }; |
| 512 | | \\export fn main() c_int { |
| 512 | \\pub export fn main() c_int { |
| 513 | 513 | \\ var p: Point = .{ |
| 514 | 514 | \\ .y = 24, |
| 515 | 515 | \\ }; |
| ... | ... | @@ -521,7 +521,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 521 | 521 | }); |
| 522 | 522 | case.addError( |
| 523 | 523 | \\const Point = struct { x: i32, y: i32 }; |
| 524 | | \\export fn main() c_int { |
| 524 | \\pub export fn main() c_int { |
| 525 | 525 | \\ var p: Point = .{ |
| 526 | 526 | \\ .x = 12, |
| 527 | 527 | \\ .y = 24, |
| ... | ... | @@ -535,7 +535,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 535 | 535 | }); |
| 536 | 536 | case.addCompareOutput( |
| 537 | 537 | \\const Point = struct { x: i32, y: i32 }; |
| 538 | | \\export fn main() c_int { |
| 538 | \\pub export fn main() c_int { |
| 539 | 539 | \\ var p: Point = .{ |
| 540 | 540 | \\ .x = 12, |
| 541 | 541 | \\ .y = 24, |
| ... | ... | @@ -589,7 +589,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 589 | 589 | case.addCompareOutput( |
| 590 | 590 | \\const Number = enum { One, Two, Three }; |
| 591 | 591 | \\ |
| 592 | | \\export fn main() c_int { |
| 592 | \\pub export fn main() c_int { |
| 593 | 593 | \\ var number1 = Number.One; |
| 594 | 594 | \\ var number2: Number = .Two; |
| 595 | 595 | \\ const number3 = @intToEnum(Number, 2); |