| author | |
| committer | |
| log | 621c08e692256af9b0cc5ef6438b0ecf547e2b38 |
| tree | ec6b53315205aa48eb1c048971faa9cf0c083efe |
| parent | 20bcdab462dc21dc912da3ce4deb432a81cbc3c5 |
| signature | Commit is signed but in an unrecognized format. |
4 files changed, 8 insertions(+), 8 deletions(-)
lib/std/special/start.zig+1-1| ... | ... | @@ -23,7 +23,7 @@ comptime { |
| 23 | 23 | .Unknown => unreachable, |
| 24 | 24 | .Exe => { |
| 25 | 25 | if (builtin.link_libc) { |
| 26 | if (!@hasDecl(root, "main") or | |
| 26 | if (@hasDecl(root, "main") and | |
| 27 | 27 | @typeInfo(@typeOf(root.main)).Fn.calling_convention != .C) |
| 28 | 28 | { |
| 29 | 29 | @export("main", main, .Weak); |
test/compare_output.zig+4-4| ... | ... | @@ -6,7 +6,7 @@ const tests = @import("tests.zig"); |
| 6 | 6 | pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 7 | 7 | cases.addC("hello world with libc", |
| 8 | 8 | \\const c = @cImport(@cInclude("stdio.h")); |
| 9 | \\export fn main(argc: c_int, argv: [*][*]u8) c_int { | |
| 9 | \\pub export fn main(argc: c_int, argv: [*][*]u8) c_int { | |
| 10 | 10 | \\ _ = c.puts("Hello, world!"); |
| 11 | 11 | \\ return 0; |
| 12 | 12 | \\} |
| ... | ... | @@ -139,7 +139,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 139 | 139 | \\ @cInclude("stdio.h"); |
| 140 | 140 | \\}); |
| 141 | 141 | \\ |
| 142 | \\export fn main(argc: c_int, argv: [*][*]u8) c_int { | |
| 142 | \\pub export fn main(argc: c_int, argv: [*][*]u8) c_int { | |
| 143 | 143 | \\ if (is_windows) { |
| 144 | 144 | \\ // we want actual \n, not \r\n |
| 145 | 145 | \\ _ = c._setmode(1, c._O_BINARY); |
| ... | ... | @@ -286,7 +286,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 286 | 286 | \\ } |
| 287 | 287 | \\} |
| 288 | 288 | \\ |
| 289 | \\export fn main() c_int { | |
| 289 | \\pub export fn main() c_int { | |
| 290 | 290 | \\ var array = [_]u32{ 1, 7, 3, 2, 0, 9, 4, 8, 6, 5 }; |
| 291 | 291 | \\ |
| 292 | 292 | \\ c.qsort(@ptrCast(?*c_void, array[0..].ptr), @intCast(c_ulong, array.len), @sizeOf(i32), compare_fn); |
| ... | ... | @@ -314,7 +314,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 314 | 314 | \\ @cInclude("stdio.h"); |
| 315 | 315 | \\}); |
| 316 | 316 | \\ |
| 317 | \\export fn main(argc: c_int, argv: [*][*]u8) c_int { | |
| 317 | \\pub export fn main(argc: c_int, argv: [*][*]u8) c_int { | |
| 318 | 318 | \\ if (is_windows) { |
| 319 | 319 | \\ // we want actual \n, not \r\n |
| 320 | 320 | \\ _ = c._setmode(1, c._O_BINARY); |
test/stage2/compare_output.zig+2-2| ... | ... | @@ -5,7 +5,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 5 | 5 | // hello world |
| 6 | 6 | try ctx.testCompareOutputLibC( |
| 7 | 7 | \\extern fn puts([*]const u8) void; |
| 8 | \\export fn main() c_int { | |
| 8 | \\pub export fn main() c_int { | |
| 9 | 9 | \\ puts("Hello, world!"); |
| 10 | 10 | \\ return 0; |
| 11 | 11 | \\} |
| ... | ... | @@ -14,7 +14,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 14 | 14 | // function calling another function |
| 15 | 15 | try ctx.testCompareOutputLibC( |
| 16 | 16 | \\extern fn puts(s: [*]const u8) void; |
| 17 | \\export fn main() c_int { | |
| 17 | \\pub export fn main() c_int { | |
| 18 | 18 | \\ return foo("OK"); |
| 19 | 19 | \\} |
| 20 | 20 | \\fn foo(s: [*]const u8) c_int { |
test/standalone/hello_world/hello_libc.zig+1-1| ... | ... | @@ -7,7 +7,7 @@ const c = @cImport({ |
| 7 | 7 | |
| 8 | 8 | const msg = "Hello, world!\n"; |
| 9 | 9 | |
| 10 | export fn main(argc: c_int, argv: **u8) c_int { | |
| 10 | pub export fn main(argc: c_int, argv: **u8) c_int { | |
| 11 | 11 | if (c.printf(msg) != @intCast(c_int, c.strlen(msg))) return -1; |
| 12 | 12 | return 0; |
| 13 | 13 | } |