diff --git a/lib/std/Target.zig b/lib/std/Target.zig index ca00403142..200cc537ac 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -1612,7 +1612,7 @@ pub const Cpu = struct { /// Returns the array of `Arch` to which a specific `std.builtin.CallingConvention` applies. /// Asserts that `cc` is not `.auto`, `.@"async"`, `.naked`, or `.@"inline"`. - pub fn fromCallconv(cc: std.builtin.CallingConvention) []const Arch { + pub fn fromCallconv(cc: std.builtin.CallingConvention.Tag) []const Arch { return switch (cc) { .auto, .@"async", diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 0753417f58..d016a4f136 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -173,7 +173,7 @@ pub const CallingConvention = union(enum(u8)) { /// Functions marked as `extern` or `export` are given this calling convention by default. pub const c = builtin.target.defaultCCallingConvention().?; - pub const winapi: CallingConvention = switch (builtin.target.arch) { + pub const winapi: CallingConvention = switch (builtin.target.cpu.arch) { .x86_64 => .{ .x86_64_win = .{} }, .x86 => .{ .x86_stdcall = .{} }, .aarch64, .aarch64_be => .{ .aarch64_aapcs_win = .{} }, @@ -481,7 +481,9 @@ pub const CallingConvention = union(enum(u8)) { /// Returns the array of `std.Target.Cpu.Arch` to which this `CallingConvention` applies. /// Asserts that `cc` is not `.auto`, `.@"async"`, `.naked`, or `.@"inline"`. - pub const archs = std.Target.Cpu.Arch.fromCallconv; + pub fn archs(cc: CallingConvention) []const std.Target.Cpu.Arch { + return std.Target.Cpu.Arch.fromCallconv(cc); + } pub fn eql(a: CallingConvention, b: CallingConvention) bool { return std.meta.eql(a, b); @@ -490,7 +492,7 @@ pub const CallingConvention = union(enum(u8)) { pub fn withStackAlign(cc: CallingConvention, incoming_stack_alignment: u64) CallingConvention { const tag: CallingConvention.Tag = cc; var result = cc; - @field(result, tag).incoming_stack_alignment = incoming_stack_alignment; + @field(result, @tagName(tag)).incoming_stack_alignment = incoming_stack_alignment; return result; } }; diff --git a/src/Sema.zig b/src/Sema.zig index eea49b4713..630101fd07 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -9711,25 +9711,32 @@ fn callConvSupportsVarArgs(cc: std.builtin.CallingConvention.Tag) bool { } fn checkCallConvSupportsVarArgs(sema: *Sema, block: *Block, src: LazySrcLoc, cc: std.builtin.CallingConvention.Tag) CompileError!void { const CallingConventionsSupportingVarArgsList = struct { - pub fn format(_: @This(), comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { + arch: std.Target.Cpu.Arch, + pub fn format(ctx: @This(), comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { _ = fmt; _ = options; - for (calling_conventions_supporting_var_args, 0..) |cc_inner, i| { - if (i != 0) + var first = true; + for (calling_conventions_supporting_var_args) |cc_inner| { + for (std.Target.Cpu.Arch.fromCallconv(cc_inner)) |supported_arch| { + if (supported_arch == ctx.arch) break; + } else continue; // callconv not supported by this arch + if (!first) { try writer.writeAll(", "); - try writer.print("'.{s}'", .{@tagName(cc_inner)}); + } + first = false; + try writer.print("'{s}'", .{@tagName(cc_inner)}); } } }; if (!callConvSupportsVarArgs(cc)) { - const msg = msg: { - const msg = try sema.errMsg(src, "variadic function does not support '.{s}' calling convention", .{@tagName(cc)}); + return sema.failWithOwnedErrorMsg(block, msg: { + const msg = try sema.errMsg(src, "variadic function does not support '{s}' calling convention", .{@tagName(cc)}); errdefer msg.destroy(sema.gpa); - try sema.errNote(src, msg, "supported calling conventions: {}", .{CallingConventionsSupportingVarArgsList{}}); + const target = sema.pt.zcu.getTarget(); + try sema.errNote(src, msg, "supported calling conventions: {}", .{CallingConventionsSupportingVarArgsList{ .arch = target.cpu.arch }}); break :msg msg; - }; - return sema.failWithOwnedErrorMsg(block, msg); + }); } } @@ -9857,9 +9864,9 @@ fn funcCommon( .x86_64_interrupt, .x86_interrupt => { const err_code_size = target.ptrBitWidth(); switch (i) { - 0 => if (param_ty.zigTypeTag(zcu) != .pointer) return sema.fail(block, param_src, "first parameter of function with 'Interrupt' calling convention must be a pointer type", .{}), - 1 => if (param_ty.bitSize(zcu) != err_code_size) return sema.fail(block, param_src, "second parameter of function with 'Interrupt' calling convention must be a {d}-bit integer", .{err_code_size}), - else => return sema.fail(block, param_src, "'Interrupt' calling convention supports up to 2 parameters, found {d}", .{i + 1}), + 0 => if (param_ty.zigTypeTag(zcu) != .pointer) return sema.fail(block, param_src, "first parameter of function with '{s}' calling convention must be a pointer type", .{@tagName(cc_resolved)}), + 1 => if (param_ty.bitSize(zcu) != err_code_size) return sema.fail(block, param_src, "second parameter of function with '{s}' calling convention must be a {d}-bit integer", .{ @tagName(cc_resolved), err_code_size }), + else => return sema.fail(block, param_src, "'{s}' calling convention supports up to 2 parameters, found {d}", .{ @tagName(cc_resolved), i + 1 }), } }, .arm_interrupt, @@ -9870,8 +9877,8 @@ fn funcCommon( .avr_interrupt, .csky_interrupt, .m68k_interrupt, - => return sema.fail(block, param_src, "parameters are not allowed with 'Interrupt' calling convention", .{}), - .avr_signal => return sema.fail(block, param_src, "parameters are not allowed with 'Signal' calling convention", .{}), + => return sema.fail(block, param_src, "parameters are not allowed with '{s}' calling convention", .{@tagName(cc_resolved)}), + .avr_signal => return sema.fail(block, param_src, "parameters are not allowed with '{s}' calling convention", .{@tagName(cc_resolved)}), else => {}, } } @@ -10220,7 +10227,7 @@ fn finishFunc( for (formatter.archs, 0..) |arch, i| { if (i != 0) try writer.writeAll(", "); - try writer.print("'.{s}'", .{@tagName(arch)}); + try writer.print("'{s}'", .{@tagName(arch)}); } } }; diff --git a/src/Type.zig b/src/Type.zig index 9c44e69657..509c0325bc 100644 --- a/src/Type.zig +++ b/src/Type.zig @@ -397,7 +397,10 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error break :print_cc; } } - try writer.print("callconv({any}) ", .{fn_info.cc}); + switch (fn_info.cc) { + .auto, .@"async", .naked, .@"inline" => try writer.print("callconv(.{}) ", .{std.zig.fmtId(@tagName(fn_info.cc))}), + else => try writer.print("callconv({any}) ", .{fn_info.cc}), + } } if (fn_info.return_type == .generic_poison_type) { try writer.writeAll("anytype"); diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig index 88d8839db2..c7f3d6a9e3 100644 --- a/src/arch/riscv64/CodeGen.zig +++ b/src/arch/riscv64/CodeGen.zig @@ -18,6 +18,7 @@ const Zcu = @import("../../Zcu.zig"); const Package = @import("../../Package.zig"); const InternPool = @import("../../InternPool.zig"); const Compilation = @import("../../Compilation.zig"); +const target_util = @import("../../target.zig"); const trace = @import("../../tracy.zig").trace; const codegen = @import("../../codegen.zig"); @@ -821,7 +822,7 @@ pub fn generate( @intFromEnum(FrameIndex.stack_frame), FrameAlloc.init(.{ .size = 0, - .alignment = func.analysisUnordered(ip).stack_alignment.max(.@"1"), + .alignment = .fromByteUnits(target_util.stackAlignment(function.target.*, fn_type.fnCallingConvention(zcu))), }), ); function.frame_allocs.set( diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 0b3ccc7ecc..13486c8660 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -873,7 +873,7 @@ pub fn generate( @intFromEnum(FrameIndex.stack_frame), FrameAlloc.init(.{ .size = 0, - .alignment = target_util.stackAlignment(function.target.*, fn_type.fnCallingConvention(zcu)), + .alignment = .fromByteUnits(target_util.stackAlignment(function.target.*, fn_type.fnCallingConvention(zcu))), }), ); function.frame_allocs.set( diff --git a/test/behavior/align.zig b/test/behavior/align.zig index e0d7634c38..25a2d992af 100644 --- a/test/behavior/align.zig +++ b/test/behavior/align.zig @@ -210,15 +210,6 @@ test "alignment and size of structs with 128-bit fields" { } } -test "alignstack" { - try expect(fnWithAlignedStack() == 1234); -} - -fn fnWithAlignedStack() i32 { - @setAlignStack(256); - return 1234; -} - test "implicitly decreasing slice alignment" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO diff --git a/test/behavior/builtin_functions_returning_void_or_noreturn.zig b/test/behavior/builtin_functions_returning_void_or_noreturn.zig index 52a3094f3b..e20e1ed9bf 100644 --- a/test/behavior/builtin_functions_returning_void_or_noreturn.zig +++ b/test/behavior/builtin_functions_returning_void_or_noreturn.zig @@ -20,7 +20,6 @@ test { try testing.expectEqual({}, @memset(@as([*]u8, @ptrFromInt(1))[0..0], undefined)); try testing.expectEqual(noreturn, @TypeOf(if (true) @panic("") else {})); try testing.expectEqual({}, @prefetch(&val, .{})); - try testing.expectEqual({}, @setAlignStack(16)); try testing.expectEqual({}, @setEvalBranchQuota(0)); try testing.expectEqual({}, @setFloatMode(.optimized)); try testing.expectEqual({}, @setRuntimeSafety(true)); diff --git a/test/behavior/type_info.zig b/test/behavior/type_info.zig index d74c03e436..44df101c98 100644 --- a/test/behavior/type_info.zig +++ b/test/behavior/type_info.zig @@ -358,7 +358,7 @@ test "type info: function type info" { fn testFunction() !void { const foo_fn_type = @TypeOf(typeInfoFoo); const foo_fn_info = @typeInfo(foo_fn_type); - try expect(foo_fn_info.@"fn".calling_convention == .C); + try expect(foo_fn_info.@"fn".calling_convention.eql(.c)); try expect(!foo_fn_info.@"fn".is_generic); try expect(foo_fn_info.@"fn".params.len == 2); try expect(foo_fn_info.@"fn".is_var_args); @@ -374,7 +374,7 @@ fn testFunction() !void { const aligned_foo_fn_type = @TypeOf(typeInfoFooAligned); const aligned_foo_fn_info = @typeInfo(aligned_foo_fn_type); - try expect(aligned_foo_fn_info.@"fn".calling_convention == .C); + try expect(aligned_foo_fn_info.@"fn".calling_convention.eql(.c)); try expect(!aligned_foo_fn_info.@"fn".is_generic); try expect(aligned_foo_fn_info.@"fn".params.len == 2); try expect(aligned_foo_fn_info.@"fn".is_var_args); @@ -390,8 +390,8 @@ fn testFunction() !void { try expect(aligned_foo_ptr_fn_info.pointer.sentinel == null); } -extern fn typeInfoFoo(a: usize, b: bool, ...) callconv(.C) usize; -extern fn typeInfoFooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize; +extern fn typeInfoFoo(a: usize, b: bool, ...) callconv(.c) usize; +extern fn typeInfoFooAligned(a: usize, b: bool, ...) align(4) callconv(.c) usize; test "type info: generic function types" { const G1 = @typeInfo(@TypeOf(generic1)); diff --git a/test/behavior/typename.zig b/test/behavior/typename.zig index dd11723952..6682b99f4d 100644 --- a/test/behavior/typename.zig +++ b/test/behavior/typename.zig @@ -79,9 +79,9 @@ test "basic" { try expectEqualStrings("fn (comptime u32) void", @typeName(fn (comptime u32) void)); try expectEqualStrings("fn (noalias []u8) void", @typeName(fn (noalias []u8) void)); - try expectEqualStrings("fn () callconv(.C) void", @typeName(fn () callconv(.C) void)); - try expectEqualStrings("fn (...) callconv(.C) void", @typeName(fn (...) callconv(.C) void)); - try expectEqualStrings("fn (u32, ...) callconv(.C) void", @typeName(fn (u32, ...) callconv(.C) void)); + try expectEqualStrings("fn () callconv(.c) void", @typeName(fn () callconv(.c) void)); + try expectEqualStrings("fn (...) callconv(.c) void", @typeName(fn (...) callconv(.c) void)); + try expectEqualStrings("fn (u32, ...) callconv(.c) void", @typeName(fn (u32, ...) callconv(.c) void)); } test "top level decl" { diff --git a/test/cases/compile_errors/array_in_c_exported_function.zig b/test/cases/compile_errors/array_in_c_exported_function.zig index e938b6afd4..384f020893 100644 --- a/test/cases/compile_errors/array_in_c_exported_function.zig +++ b/test/cases/compile_errors/array_in_c_exported_function.zig @@ -7,10 +7,9 @@ export fn zig_return_array() [10]u8 { } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :1:21: error: parameter of type '[10]u8' not allowed in function with calling convention 'C' +// :1:21: error: parameter of type '[10]u8' not allowed in function with calling convention 'x86_64_sysv' // :1:21: note: arrays are not allowed as a parameter type -// :5:30: error: return type '[10]u8' not allowed in function with calling convention 'C' +// :5:30: error: return type '[10]u8' not allowed in function with calling convention 'x86_64_sysv' // :5:30: note: arrays are not allowed as a return type diff --git a/test/cases/compile_errors/assign_inline_fn_to_non-comptime_var.zig b/test/cases/compile_errors/assign_inline_fn_to_non-comptime_var.zig index 155df733fb..38360e7ed5 100644 --- a/test/cases/compile_errors/assign_inline_fn_to_non-comptime_var.zig +++ b/test/cases/compile_errors/assign_inline_fn_to_non-comptime_var.zig @@ -8,5 +8,5 @@ inline fn b() void {} // backend=stage2 // target=native // -// :2:9: error: variable of type '*const fn () callconv(.Inline) void' must be const or comptime +// :2:9: error: variable of type '*const fn () callconv(.@"inline") void' must be const or comptime // :2:9: note: function has inline calling convention diff --git a/test/cases/compile_errors/bitsize_of_packed_struct_checks_backing_int_ty.zig b/test/cases/compile_errors/bitsize_of_packed_struct_checks_backing_int_ty.zig index 774a9c3376..e0bf5c2624 100644 --- a/test/cases/compile_errors/bitsize_of_packed_struct_checks_backing_int_ty.zig +++ b/test/cases/compile_errors/bitsize_of_packed_struct_checks_backing_int_ty.zig @@ -1,7 +1,7 @@ const Foo = packed struct(u32) { x: u1, }; -fn bar(_: Foo) callconv(.C) void {} +fn bar(_: Foo) callconv(.c) void {} pub export fn entry() void { bar(.{ .x = 0 }); } diff --git a/test/cases/compile_errors/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig b/test/cases/compile_errors/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig index cc6fc59a1a..78315f7ba2 100644 --- a/test/cases/compile_errors/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig +++ b/test/cases/compile_errors/callconv_apcs_aapcs_aapcsvfp_on_unsupported_platform.zig @@ -3,9 +3,8 @@ export fn entry2() callconv(.AAPCS) void {} export fn entry3() callconv(.AAPCSVFP) void {} // error -// backend=stage2 // target=x86_64-linux-none // -// :1:30: error: callconv 'APCS' is only available on ARM, not x86_64 -// :2:30: error: callconv 'AAPCS' is only available on ARM, not x86_64 -// :3:30: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64 +// :1:30: error: callconv 'arm_apcs' only available on architectures 'arm', 'armeb', 'thumb', 'thumbeb' +// :2:30: error: callconv 'arm_aapcs' only available on architectures 'arm', 'armeb', 'thumb', 'thumbeb' +// :3:30: error: callconv 'arm_aapcs_vfp' only available on architectures 'arm', 'armeb', 'thumb', 'thumbeb' diff --git a/test/cases/compile_errors/callconv_signal_on_unsupported_platform.zig b/test/cases/compile_errors/callconv_signal_on_unsupported_platform.zig index 9233655e35..4dfb098eae 100644 --- a/test/cases/compile_errors/callconv_signal_on_unsupported_platform.zig +++ b/test/cases/compile_errors/callconv_signal_on_unsupported_platform.zig @@ -1,7 +1,7 @@ -export fn entry() callconv(.Signal) void {} +export fn entry() callconv(.avr_signal) void {} // error // backend=stage2 // target=x86_64-linux-none // -// :1:29: error: callconv 'Signal' is only available on AVR, not x86_64 +// :1:29: error: callconv 'avr_signal' only available on architectures 'avr' diff --git a/test/cases/compile_errors/callconv_stdcall_fastcall_thiscall_on_unsupported_platform.zig b/test/cases/compile_errors/callconv_stdcall_fastcall_thiscall_on_unsupported_platform.zig index 3480dc8aa7..08149cc123 100644 --- a/test/cases/compile_errors/callconv_stdcall_fastcall_thiscall_on_unsupported_platform.zig +++ b/test/cases/compile_errors/callconv_stdcall_fastcall_thiscall_on_unsupported_platform.zig @@ -1,6 +1,6 @@ -const F1 = fn () callconv(.Stdcall) void; -const F2 = fn () callconv(.Fastcall) void; -const F3 = fn () callconv(.Thiscall) void; +const F1 = fn () callconv(.{ .x86_stdcall = .{} }) void; +const F2 = fn () callconv(.{ .x86_fastcall = .{} }) void; +const F3 = fn () callconv(.{ .x86_thiscall = .{} }) void; export fn entry1() void { const a: F1 = undefined; _ = a; @@ -18,6 +18,6 @@ export fn entry3() void { // backend=stage2 // target=x86_64-linux-none // -// :1:28: error: callconv 'Stdcall' is only available on x86, not x86_64 -// :2:28: error: callconv 'Fastcall' is only available on x86, not x86_64 -// :3:28: error: callconv 'Thiscall' is only available on x86, not x86_64 +// :1:28: error: callconv 'x86_stdcall' only available on architectures 'x86' +// :2:28: error: callconv 'x86_fastcall' only available on architectures 'x86' +// :3:28: error: callconv 'x86_thiscall' only available on architectures 'x86' diff --git a/test/cases/compile_errors/callconv_vectorcall_on_unsupported_platform.zig b/test/cases/compile_errors/callconv_vectorcall_on_unsupported_platform.zig deleted file mode 100644 index 9c0d982b3f..0000000000 --- a/test/cases/compile_errors/callconv_vectorcall_on_unsupported_platform.zig +++ /dev/null @@ -1,7 +0,0 @@ -export fn entry() callconv(.Vectorcall) void {} - -// error -// backend=stage2 -// target=x86_64-linux-none -// -// :1:29: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64 diff --git a/test/cases/compile_errors/closure_get_depends_on_failed_decl.zig b/test/cases/compile_errors/closure_get_depends_on_failed_decl.zig index be451d2fc8..afe7319f0b 100644 --- a/test/cases/compile_errors/closure_get_depends_on_failed_decl.zig +++ b/test/cases/compile_errors/closure_get_depends_on_failed_decl.zig @@ -4,7 +4,7 @@ pub inline fn requestAdapter( comptime callbackArg: fn () callconv(.Inline) void, ) void { _ = &(struct { - pub fn callback() callconv(.C) void { + pub fn callback() callconv(.c) void { callbackArg(); } }).callback; diff --git a/test/cases/compile_errors/export_function_with_comptime_parameter.zig b/test/cases/compile_errors/export_function_with_comptime_parameter.zig index 8d5dbef1c3..8a360d1629 100644 --- a/test/cases/compile_errors/export_function_with_comptime_parameter.zig +++ b/test/cases/compile_errors/export_function_with_comptime_parameter.zig @@ -3,7 +3,6 @@ export fn foo(comptime x: anytype, y: i32) i32 { } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :1:15: error: comptime parameters not allowed in function with calling convention 'C' +// :1:15: error: comptime parameters not allowed in function with calling convention 'x86_64_sysv' diff --git a/test/cases/compile_errors/export_generic_function.zig b/test/cases/compile_errors/export_generic_function.zig index 4ffbad9df7..075e9b23da 100644 --- a/test/cases/compile_errors/export_generic_function.zig +++ b/test/cases/compile_errors/export_generic_function.zig @@ -4,7 +4,6 @@ export fn foo(num: anytype) i32 { } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :1:15: error: generic parameters not allowed in function with calling convention 'C' +// :1:15: error: generic parameters not allowed in function with calling convention 'x86_64_sysv' diff --git a/test/cases/compile_errors/extern_function_pointer_mismatch.zig b/test/cases/compile_errors/extern_function_pointer_mismatch.zig index 36a548ceb9..204d2dd282 100644 --- a/test/cases/compile_errors/extern_function_pointer_mismatch.zig +++ b/test/cases/compile_errors/extern_function_pointer_mismatch.zig @@ -14,8 +14,7 @@ export fn entry() usize { } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :1:38: error: expected type 'fn (i32) i32', found 'fn (i32) callconv(.C) i32' -// :1:38: note: calling convention 'C' cannot cast into calling convention 'Unspecified' +// :1:38: error: expected type 'fn (i32) i32', found 'fn (i32) callconv(.c) i32' +// :1:38: note: calling convention 'x86_64_sysv' cannot cast into calling convention 'auto' diff --git a/test/cases/compile_errors/extern_function_with_comptime_parameter.zig b/test/cases/compile_errors/extern_function_with_comptime_parameter.zig index 07fe34ad7f..a0c3d347f1 100644 --- a/test/cases/compile_errors/extern_function_with_comptime_parameter.zig +++ b/test/cases/compile_errors/extern_function_with_comptime_parameter.zig @@ -15,9 +15,8 @@ comptime { } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :1:15: error: comptime parameters not allowed in function with calling convention 'C' -// :5:30: error: comptime parameters not allowed in function with calling convention 'C' -// :6:30: error: generic parameters not allowed in function with calling convention 'C' +// :1:15: error: comptime parameters not allowed in function with calling convention 'x86_64_sysv' +// :5:30: error: comptime parameters not allowed in function with calling convention 'x86_64_sysv' +// :6:30: error: generic parameters not allowed in function with calling convention 'x86_64_sysv' diff --git a/test/cases/compile_errors/function-only_builtins_outside_function.zig b/test/cases/compile_errors/function-only_builtins_outside_function.zig index a9871e2b59..8178ee51fa 100644 --- a/test/cases/compile_errors/function-only_builtins_outside_function.zig +++ b/test/cases/compile_errors/function-only_builtins_outside_function.zig @@ -1,7 +1,3 @@ -comptime { - @setAlignStack(1); -} - comptime { @branchHint(.cold); } @@ -54,16 +50,15 @@ comptime { // backend=stage2 // target=native // -// :2:5: error: '@setAlignStack' outside function scope -// :6:5: error: '@branchHint' outside function scope -// :10:5: error: '@src' outside function scope -// :14:5: error: '@returnAddress' outside function scope -// :18:5: error: '@frameAddress' outside function scope -// :22:5: error: '@breakpoint' outside function scope -// :26:5: error: '@cVaArg' outside function scope -// :30:5: error: '@cVaCopy' outside function scope -// :34:5: error: '@cVaEnd' outside function scope -// :38:5: error: '@cVaStart' outside function scope -// :42:5: error: '@workItemId' outside function scope -// :46:5: error: '@workGroupSize' outside function scope -// :50:5: error: '@workGroupId' outside function scope +// :2:5: error: '@branchHint' outside function scope +// :6:5: error: '@src' outside function scope +// :10:5: error: '@returnAddress' outside function scope +// :14:5: error: '@frameAddress' outside function scope +// :18:5: error: '@breakpoint' outside function scope +// :22:5: error: '@cVaArg' outside function scope +// :26:5: error: '@cVaCopy' outside function scope +// :30:5: error: '@cVaEnd' outside function scope +// :34:5: error: '@cVaStart' outside function scope +// :38:5: error: '@workItemId' outside function scope +// :42:5: error: '@workGroupSize' outside function scope +// :46:5: error: '@workGroupId' outside function scope diff --git a/test/cases/compile_errors/function_with_non-extern_non-packed_enum_parameter.zig b/test/cases/compile_errors/function_with_non-extern_non-packed_enum_parameter.zig index ab257ead71..8122a89adc 100644 --- a/test/cases/compile_errors/function_with_non-extern_non-packed_enum_parameter.zig +++ b/test/cases/compile_errors/function_with_non-extern_non-packed_enum_parameter.zig @@ -4,10 +4,9 @@ export fn entry(foo: Foo) void { } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :2:17: error: parameter of type 'tmp.Foo' not allowed in function with calling convention 'C' +// :2:17: error: parameter of type 'tmp.Foo' not allowed in function with calling convention 'x86_64_sysv' // :2:17: note: enum tag type 'u2' is not extern compatible // :2:17: note: only integers with 0, 8, 16, 32, 64 and 128 bits are extern compatible // :1:13: note: enum declared here diff --git a/test/cases/compile_errors/function_with_non-extern_non-packed_struct_parameter.zig b/test/cases/compile_errors/function_with_non-extern_non-packed_struct_parameter.zig index 137037f9e7..bb41a2ddb9 100644 --- a/test/cases/compile_errors/function_with_non-extern_non-packed_struct_parameter.zig +++ b/test/cases/compile_errors/function_with_non-extern_non-packed_struct_parameter.zig @@ -8,9 +8,8 @@ export fn entry(foo: Foo) void { } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :6:17: error: parameter of type 'tmp.Foo' not allowed in function with calling convention 'C' +// :6:17: error: parameter of type 'tmp.Foo' not allowed in function with calling convention 'x86_64_sysv' // :6:17: note: only extern structs and ABI sized packed structs are extern compatible // :1:13: note: struct declared here diff --git a/test/cases/compile_errors/function_with_non-extern_non-packed_union_parameter.zig b/test/cases/compile_errors/function_with_non-extern_non-packed_union_parameter.zig index d651329f72..220dbd146d 100644 --- a/test/cases/compile_errors/function_with_non-extern_non-packed_union_parameter.zig +++ b/test/cases/compile_errors/function_with_non-extern_non-packed_union_parameter.zig @@ -8,9 +8,8 @@ export fn entry(foo: Foo) void { } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :6:17: error: parameter of type 'tmp.Foo' not allowed in function with calling convention 'C' +// :6:17: error: parameter of type 'tmp.Foo' not allowed in function with calling convention 'x86_64_sysv' // :6:17: note: only extern unions and ABI sized packed unions are extern compatible // :1:13: note: union declared here diff --git a/test/cases/compile_errors/invalid_extern_function_call.zig b/test/cases/compile_errors/invalid_extern_function_call.zig index 986b39c498..c270c3bf48 100644 --- a/test/cases/compile_errors/invalid_extern_function_call.zig +++ b/test/cases/compile_errors/invalid_extern_function_call.zig @@ -1,4 +1,4 @@ -const x = @extern(*const fn () callconv(.C) void, .{ .name = "foo" }); +const x = @extern(*const fn () callconv(.c) void, .{ .name = "foo" }); export fn entry0() void { comptime x(); diff --git a/test/cases/compile_errors/invalid_func_for_callconv.zig b/test/cases/compile_errors/invalid_func_for_callconv.zig index 490b87bc4b..f82b3a63b4 100644 --- a/test/cases/compile_errors/invalid_func_for_callconv.zig +++ b/test/cases/compile_errors/invalid_func_for_callconv.zig @@ -9,12 +9,11 @@ export fn signal_param(_: u32) callconv(.Signal) void {} export fn signal_ret() callconv(.Signal) noreturn {} // error -// backend=stage2 // target=x86_64-linux -// -// :1:28: error: first parameter of function with 'Interrupt' calling convention must be a pointer type -// :2:43: error: second parameter of function with 'Interrupt' calling convention must be a 64-bit integer -// :3:51: error: 'Interrupt' calling convention supports up to 2 parameters, found 3 -// :4:69: error: function with calling convention 'Interrupt' must return 'void' or 'noreturn' -// :8:24: error: parameters are not allowed with 'Signal' calling convention -// :9:34: error: callconv 'Signal' is only available on AVR, not x86_64 +// +// :1:28: error: first parameter of function with 'x86_64_interrupt' calling convention must be a pointer type +// :2:43: error: second parameter of function with 'x86_64_interrupt' calling convention must be a 64-bit integer +// :3:51: error: 'x86_64_interrupt' calling convention supports up to 2 parameters, found 3 +// :4:69: error: function with calling convention 'x86_64_interrupt' must return 'void' or 'noreturn' +// :8:24: error: parameters are not allowed with 'avr_signal' calling convention +// :9:34: error: callconv 'avr_signal' only available on architectures 'avr' diff --git a/test/cases/compile_errors/invalid_tail_call.zig b/test/cases/compile_errors/invalid_tail_call.zig index 3d327b948b..77b7ce1177 100644 --- a/test/cases/compile_errors/invalid_tail_call.zig +++ b/test/cases/compile_errors/invalid_tail_call.zig @@ -9,4 +9,4 @@ pub export fn entry() void { // backend=llvm // target=native // -// :5:5: error: unable to perform tail call: type of function being called 'fn (usize) void' does not match type of calling function 'fn () callconv(.C) void' +// :5:5: error: unable to perform tail call: type of function being called 'fn (usize) void' does not match type of calling function 'fn () callconv(.c) void' diff --git a/test/cases/compile_errors/invalid_variadic_function.zig b/test/cases/compile_errors/invalid_variadic_function.zig index ee8fc3439e..9b7a4b40f3 100644 --- a/test/cases/compile_errors/invalid_variadic_function.zig +++ b/test/cases/compile_errors/invalid_variadic_function.zig @@ -13,11 +13,10 @@ comptime { } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :1:1: error: variadic function does not support '.Unspecified' calling convention -// :1:1: note: supported calling conventions: '.C' -// :1:1: error: variadic function does not support '.Inline' calling convention -// :1:1: note: supported calling conventions: '.C' +// :1:1: error: variadic function does not support 'auto' calling convention +// :1:1: note: supported calling conventions: 'x86_64_sysv', 'x86_64_win' +// :1:1: error: variadic function does not support 'inline' calling convention +// :1:1: note: supported calling conventions: 'x86_64_sysv', 'x86_64_win' // :2:1: error: generic function cannot be variadic diff --git a/test/cases/compile_errors/noinline_fn_cc_inline.zig b/test/cases/compile_errors/noinline_fn_cc_inline.zig index 3a2d6440c3..ac7e93fcdb 100644 --- a/test/cases/compile_errors/noinline_fn_cc_inline.zig +++ b/test/cases/compile_errors/noinline_fn_cc_inline.zig @@ -1,5 +1,4 @@ -const cc = .Inline; -noinline fn foo() callconv(cc) void {} +noinline fn foo() callconv(.@"inline") void {} comptime { _ = foo; @@ -9,4 +8,4 @@ comptime { // backend=stage2 // target=native // -// :2:28: error: 'noinline' function cannot have callconv 'Inline' +// :1:29: error: 'noinline' function cannot have callconv 'inline' diff --git a/test/cases/compile_errors/old_fn_ptr_in_extern_context.zig b/test/cases/compile_errors/old_fn_ptr_in_extern_context.zig index 7d747ec616..9bd63b6451 100644 --- a/test/cases/compile_errors/old_fn_ptr_in_extern_context.zig +++ b/test/cases/compile_errors/old_fn_ptr_in_extern_context.zig @@ -1,20 +1,20 @@ const S = extern struct { - a: fn () callconv(.C) void, + a: fn () callconv(.c) void, }; comptime { _ = @sizeOf(S) == 1; } comptime { - _ = [*c][4]fn () callconv(.C) void; + _ = [*c][4]fn () callconv(.c) void; } // error // backend=stage2 // target=native // -// :2:8: error: extern structs cannot contain fields of type 'fn () callconv(.C) void' +// :2:8: error: extern structs cannot contain fields of type 'fn () callconv(.c) void' // :2:8: note: type has no guaranteed in-memory representation // :2:8: note: use '*const ' to make a function pointer type -// :8:13: error: C pointers cannot point to non-C-ABI-compatible type '[4]fn () callconv(.C) void' +// :8:13: error: C pointers cannot point to non-C-ABI-compatible type '[4]fn () callconv(.c) void' // :8:13: note: type has no guaranteed in-memory representation // :8:13: note: use '*const ' to make a function pointer type diff --git a/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig b/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig index ee53938389..7986f2ef3f 100644 --- a/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig +++ b/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig @@ -12,8 +12,7 @@ comptime { } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :1:13: error: variadic function does not support '.Unspecified' calling convention -// :1:13: note: supported calling conventions: '.C' +// :1:13: error: variadic function does not support 'auto' calling convention +// :1:13: note: supported calling conventions: 'x86_64_sysv', 'x86_64_win' diff --git a/test/cases/compile_errors/runtime_@ptrFromInt_to_comptime_only_type.zig b/test/cases/compile_errors/runtime_@ptrFromInt_to_comptime_only_type.zig index 0c4e844e76..fb35590369 100644 --- a/test/cases/compile_errors/runtime_@ptrFromInt_to_comptime_only_type.zig +++ b/test/cases/compile_errors/runtime_@ptrFromInt_to_comptime_only_type.zig @@ -1,5 +1,5 @@ const GuSettings = struct { - fin: ?fn (c_int) callconv(.C) void, + fin: ?fn (c_int) callconv(.c) void, }; pub export fn callbackFin(id: c_int, arg: ?*anyopaque) void { const settings: ?*GuSettings = @as(?*GuSettings, @ptrFromInt(@intFromPtr(arg))); @@ -13,4 +13,4 @@ pub export fn callbackFin(id: c_int, arg: ?*anyopaque) void { // // :5:54: error: pointer to comptime-only type '?*tmp.GuSettings' must be comptime-known, but operand is runtime-known // :2:10: note: struct requires comptime because of this field -// :2:10: note: use '*const fn (c_int) callconv(.C) void' for a function pointer type +// :2:10: note: use '*const fn (c_int) callconv(.c) void' for a function pointer type diff --git a/test/cases/compile_errors/setAlignStack_in_naked_function.zig b/test/cases/compile_errors/setAlignStack_in_naked_function.zig deleted file mode 100644 index 79c4ba6f5b..0000000000 --- a/test/cases/compile_errors/setAlignStack_in_naked_function.zig +++ /dev/null @@ -1,9 +0,0 @@ -export fn entry() callconv(.Naked) void { - @setAlignStack(16); -} - -// error -// backend=stage2 -// target=native -// -// :2:5: error: @setAlignStack in naked function diff --git a/test/cases/compile_errors/setAlignStack_too_big.zig b/test/cases/compile_errors/setAlignStack_too_big.zig deleted file mode 100644 index 5ee96041e0..0000000000 --- a/test/cases/compile_errors/setAlignStack_too_big.zig +++ /dev/null @@ -1,9 +0,0 @@ -export fn entry() void { - @setAlignStack(511 + 1); -} - -// error -// backend=stage2 -// target=native -// -// :2:5: error: attempt to @setAlignStack(512); maximum is 256 diff --git a/test/cases/compile_errors/slice_used_as_extern_fn_param.zig b/test/cases/compile_errors/slice_used_as_extern_fn_param.zig index e6b065cd62..522e4eba8c 100644 --- a/test/cases/compile_errors/slice_used_as_extern_fn_param.zig +++ b/test/cases/compile_errors/slice_used_as_extern_fn_param.zig @@ -1,11 +1,10 @@ -extern fn Text(str: []const u8, num: i32) callconv(.C) void; +extern fn Text(str: []const u8, num: i32) callconv(.c) void; export fn entry() void { _ = Text; } // error -// backend=stage2 -// target=native +// target=x86_64-linux // -// :1:16: error: parameter of type '[]const u8' not allowed in function with calling convention 'C' +// :1:16: error: parameter of type '[]const u8' not allowed in function with calling convention 'x86_64_sysv' // :1:16: note: slices have no guaranteed in-memory representation diff --git a/test/cases/compile_errors/type_mismatch_in_C_prototype_with_varargs.zig b/test/cases/compile_errors/type_mismatch_in_C_prototype_with_varargs.zig index f64dbc6ee4..3ac73fcb54 100644 --- a/test/cases/compile_errors/type_mismatch_in_C_prototype_with_varargs.zig +++ b/test/cases/compile_errors/type_mismatch_in_C_prototype_with_varargs.zig @@ -1,4 +1,4 @@ -const fn_ty = ?fn ([*c]u8, ...) callconv(.C) void; +const fn_ty = ?fn ([*c]u8, ...) callconv(.c) void; extern fn fn_decl(fmt: [*:0]u8, ...) void; export fn main() void { @@ -10,6 +10,6 @@ export fn main() void { // backend=stage2 // target=native // -// :5:22: error: expected type '?fn ([*c]u8, ...) callconv(.C) void', found 'fn ([*:0]u8, ...) callconv(.C) void' +// :5:22: error: expected type '?fn ([*c]u8, ...) callconv(.c) void', found 'fn ([*:0]u8, ...) callconv(.c) void' // :5:22: note: parameter 0 '[*:0]u8' cannot cast into '[*c]u8' // :5:22: note: '[*c]u8' could have null values which are illegal in type '[*:0]u8' diff --git a/test/cases/compile_errors/wrong_types_given_to_export.zig b/test/cases/compile_errors/wrong_types_given_to_export.zig index 5fe7b6906b..daf03044f8 100644 --- a/test/cases/compile_errors/wrong_types_given_to_export.zig +++ b/test/cases/compile_errors/wrong_types_given_to_export.zig @@ -1,4 +1,4 @@ -fn entry() callconv(.C) void {} +fn entry() callconv(.c) void {} comptime { @export(&entry, .{ .name = "entry", .linkage = @as(u32, 1234) }); } diff --git a/test/cases/translate_c/static empty struct.c b/test/cases/translate_c/static empty struct.c index 8300b7c673..222fa48707 100644 --- a/test/cases/translate_c/static empty struct.c +++ b/test/cases/translate_c/static empty struct.c @@ -9,7 +9,7 @@ static inline void foo() { // c_frontend=clang // // pub const struct_empty_struct = extern struct {}; -// pub fn foo() callconv(.C) void { +// pub fn foo() callconv(.c) void { // const bar = struct { // var static: struct_empty_struct = @import("std").mem.zeroes(struct_empty_struct); // }; diff --git a/test/translate_c.zig b/test/translate_c.zig index 431289f9e3..933983c364 100644 --- a/test/translate_c.zig +++ b/test/translate_c.zig @@ -484,11 +484,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\ fnptr_attr_ty qux; \\}; , &[_][]const u8{ - \\pub const fnptr_ty = ?*const fn () callconv(.C) void; - \\pub const fnptr_attr_ty = ?*const fn () callconv(.C) void; + \\pub const fnptr_ty = ?*const fn () callconv(.c) void; + \\pub const fnptr_attr_ty = ?*const fn () callconv(.c) void; \\pub const struct_foo = extern struct { - \\ foo: ?*const fn () callconv(.C) void = @import("std").mem.zeroes(?*const fn () callconv(.C) void), - \\ bar: ?*const fn () callconv(.C) void = @import("std").mem.zeroes(?*const fn () callconv(.C) void), + \\ foo: ?*const fn () callconv(.c) void = @import("std").mem.zeroes(?*const fn () callconv(.c) void), + \\ bar: ?*const fn () callconv(.c) void = @import("std").mem.zeroes(?*const fn () callconv(.c) void), \\ baz: fnptr_ty = @import("std").mem.zeroes(fnptr_ty), \\ qux: fnptr_attr_ty = @import("std").mem.zeroes(fnptr_attr_ty), \\}; @@ -735,7 +735,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\static void bar(void) {} , &[_][]const u8{ \\pub export fn foo() void {} - \\pub fn bar() callconv(.C) void {} + \\pub fn bar() callconv(.c) void {} }); cases.add("typedef void", @@ -769,7 +769,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\pub export fn bar() void { \\ var func_ptr: ?*anyopaque = @as(?*anyopaque, @ptrCast(&foo)); \\ _ = &func_ptr; - \\ var typed_func_ptr: ?*const fn () callconv(.C) void = @as(?*const fn () callconv(.C) void, @ptrFromInt(@as(c_ulong, @intCast(@intFromPtr(func_ptr))))); + \\ var typed_func_ptr: ?*const fn () callconv(.c) void = @as(?*const fn () callconv(.c) void, @ptrFromInt(@as(c_ulong, @intCast(@intFromPtr(func_ptr))))); \\ _ = &typed_func_ptr; \\} }); @@ -839,9 +839,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\ lws_callback_function *callback_http; \\}; , &[_][]const u8{ - \\pub const lws_callback_function = fn () callconv(.C) void; + \\pub const lws_callback_function = fn () callconv(.c) void; \\pub const struct_Foo = extern struct { - \\ func: ?*const fn () callconv(.C) void = @import("std").mem.zeroes(?*const fn () callconv(.C) void), + \\ func: ?*const fn () callconv(.c) void = @import("std").mem.zeroes(?*const fn () callconv(.c) void), \\ callback_http: ?*const lws_callback_function = @import("std").mem.zeroes(?*const lws_callback_function), \\}; }); @@ -867,7 +867,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\}; , &[_][]const u8{ \\pub const struct_Foo = extern struct { - \\ derp: ?*const fn ([*c]struct_Foo) callconv(.C) void = @import("std").mem.zeroes(?*const fn ([*c]struct_Foo) callconv(.C) void), + \\ derp: ?*const fn ([*c]struct_Foo) callconv(.c) void = @import("std").mem.zeroes(?*const fn ([*c]struct_Foo) callconv(.c) void), \\}; , \\pub const Foo = struct_Foo; @@ -1111,7 +1111,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { cases.add("__cdecl doesn't mess up function pointers", \\void foo(void (__cdecl *fn_ptr)(void)); , &[_][]const u8{ - \\pub extern fn foo(fn_ptr: ?*const fn () callconv(.C) void) void; + \\pub extern fn foo(fn_ptr: ?*const fn () callconv(.c) void) void; }); cases.add("void cast", @@ -1477,8 +1477,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\typedef void (*fn0)(); \\typedef void (*fn1)(char); , &[_][]const u8{ - \\pub const fn0 = ?*const fn (...) callconv(.C) void; - \\pub const fn1 = ?*const fn (u8) callconv(.C) void; + \\pub const fn0 = ?*const fn (...) callconv(.c) void; + \\pub const fn1 = ?*const fn (u8) callconv(.c) void; }); cases.addWithTarget("Calling convention", .{ @@ -1492,11 +1492,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\void __attribute__((cdecl)) foo4(float *a); \\void __attribute__((thiscall)) foo5(float *a); , &[_][]const u8{ - \\pub extern fn foo1(a: [*c]f32) callconv(.Fastcall) void; - \\pub extern fn foo2(a: [*c]f32) callconv(.Stdcall) void; - \\pub extern fn foo3(a: [*c]f32) callconv(.Vectorcall) void; + \\pub extern fn foo1(a: [*c]f32) callconv(.{ .x86_fastcall = .{} }) void; + \\pub extern fn foo2(a: [*c]f32) callconv(.{ .x86_stdcall = .{} }) void; + \\pub extern fn foo3(a: [*c]f32) callconv(.{ .x86_vectorcall = .{} }) void; \\pub extern fn foo4(a: [*c]f32) void; - \\pub extern fn foo5(a: [*c]f32) callconv(.Thiscall) void; + \\pub extern fn foo5(a: [*c]f32) callconv(.{ .x86_thiscall = .{} }) void; }); cases.addWithTarget("Calling convention", std.Target.Query.parse(.{ @@ -1506,8 +1506,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\void __attribute__((pcs("aapcs"))) foo1(float *a); \\void __attribute__((pcs("aapcs-vfp"))) foo2(float *a); , &[_][]const u8{ - \\pub extern fn foo1(a: [*c]f32) callconv(.AAPCS) void; - \\pub extern fn foo2(a: [*c]f32) callconv(.AAPCSVFP) void; + \\pub extern fn foo1(a: [*c]f32) callconv(.{ .arm_aapcs = .{} }) void; + \\pub extern fn foo2(a: [*c]f32) callconv(.{ .arm_aapcs_vfp = .{} }) void; }); cases.addWithTarget("Calling convention", std.Target.Query.parse(.{ @@ -1516,7 +1516,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { }) catch unreachable, \\void __attribute__((aarch64_vector_pcs)) foo1(float *a); , &[_][]const u8{ - \\pub extern fn foo1(a: [*c]f32) callconv(.Vectorcall) void; + \\pub extern fn foo1(a: [*c]f32) callconv(.{ .aarch64_vfabi = .{} }) void; }); cases.add("Parameterless function prototypes", @@ -1533,8 +1533,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\pub export fn b() void {} \\pub extern fn c(...) void; \\pub extern fn d() void; - \\pub fn e() callconv(.C) void {} - \\pub fn f() callconv(.C) void {} + \\pub fn e() callconv(.c) void {} + \\pub fn f() callconv(.c) void {} \\pub extern fn g() void; \\pub extern fn h() void; }); @@ -1555,7 +1555,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\ char *arr1[10] ={0}; \\} , &[_][]const u8{ - \\pub fn foo() callconv(.C) void { + \\pub fn foo() callconv(.c) void { \\ var arr: [10]u8 = [1]u8{ \\ 1, \\ } ++ [1]u8{0} ** 9; @@ -1686,13 +1686,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\extern char (*fn_ptr2)(int, float); \\#define bar fn_ptr2 , &[_][]const u8{ - \\pub extern var fn_ptr: ?*const fn () callconv(.C) void; + \\pub extern var fn_ptr: ?*const fn () callconv(.c) void; , \\pub inline fn foo() void { \\ return fn_ptr.?(); \\} , - \\pub extern var fn_ptr2: ?*const fn (c_int, f32) callconv(.C) u8; + \\pub extern var fn_ptr2: ?*const fn (c_int, f32) callconv(.c) u8; , \\pub inline fn bar(arg_1: c_int, arg_2: f32) u8 { \\ return fn_ptr2.?(arg_1, arg_2); @@ -1714,8 +1714,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\#define glClearPFN PFNGLCLEARPROC , &[_][]const u8{ \\pub const GLbitfield = c_uint; - \\pub const PFNGLCLEARPROC = ?*const fn (GLbitfield) callconv(.C) void; - \\pub const OpenGLProc = ?*const fn () callconv(.C) void; + \\pub const PFNGLCLEARPROC = ?*const fn (GLbitfield) callconv(.c) void; + \\pub const OpenGLProc = ?*const fn () callconv(.c) void; \\const struct_unnamed_1 = extern struct { \\ Clear: PFNGLCLEARPROC = @import("std").mem.zeroes(PFNGLCLEARPROC), \\}; @@ -2691,9 +2691,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\ return 0; \\} \\pub export fn bar() void { - \\ var f: ?*const fn () callconv(.C) void = &foo; + \\ var f: ?*const fn () callconv(.c) void = &foo; \\ _ = &f; - \\ var b: ?*const fn () callconv(.C) c_int = &baz; + \\ var b: ?*const fn () callconv(.c) c_int = &baz; \\ _ = &b; \\ f.?(); \\ f.?(); @@ -3048,8 +3048,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\ baz(); \\} , &[_][]const u8{ - \\pub fn bar() callconv(.C) void {} - \\pub export fn foo(arg_baz: ?*const fn () callconv(.C) [*c]c_int) void { + \\pub fn bar() callconv(.c) void {} + \\pub export fn foo(arg_baz: ?*const fn () callconv(.c) [*c]c_int) void { \\ var baz = arg_baz; \\ _ = &baz; \\ bar(); @@ -3112,7 +3112,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\ do {} while (0); \\} , &[_][]const u8{ - \\pub fn foo() callconv(.C) void { + \\pub fn foo() callconv(.c) void { \\ if (true) while (true) { \\ if (!false) break; \\ }; @@ -3212,10 +3212,10 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\void c(void) {} \\static void foo() {} , &[_][]const u8{ - \\pub fn a() callconv(.C) void {} - \\pub fn b() callconv(.C) void {} + \\pub fn a() callconv(.c) void {} + \\pub fn b() callconv(.c) void {} \\pub export fn c() void {} - \\pub fn foo() callconv(.C) void {} + \\pub fn foo() callconv(.c) void {} }); cases.add("casting away const and volatile",