diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-01-06 18:20:31 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-01-06 18:20:31 -0500 |
| commit | be2483c576850c038d84cade26c1a509a940f047 (patch) | |
| tree | 1bcf6e76b791751c88c7648df360c6969ac86b06 | |
| parent | 5ada610e098b8f4ada2c64c2e0a7b93bd7a5f9b0 (diff) | |
| download | zig-be2483c576850c038d84cade26c1a509a940f047.tar.gz zig-be2483c576850c038d84cade26c1a509a940f047.zip | |
fix test suite regressions
| -rw-r--r-- | doc/langref.html.in | 2 | ||||
| -rw-r--r-- | src/analyze.cpp | 10 | ||||
| -rw-r--r-- | test/compile_errors.zig | 6 |
3 files changed, 8 insertions, 10 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in index 476e370358..f934f923f0 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -7735,7 +7735,7 @@ const Derp = @OpaqueType(); const Wat = @OpaqueType(); extern fn bar(d: *Derp) void; -export fn foo(w: *Wat) void { +fn foo(w: *Wat) callconv(.C) void { bar(w); } diff --git a/src/analyze.cpp b/src/analyze.cpp index a7763fea61..b15d986558 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1010,8 +1010,6 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) { // populate the name of the type buf_resize(&fn_type->name, 0); - if (fn_type->data.fn.fn_type_id.cc == CallingConventionC) - buf_append_str(&fn_type->name, "extern "); buf_appendf(&fn_type->name, "fn("); for (size_t i = 0; i < fn_type_id->param_count; i += 1) { FnTypeParamInfo *param_info = &fn_type_id->param_info[i]; @@ -1030,8 +1028,8 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) { if (fn_type_id->alignment != 0) { buf_appendf(&fn_type->name, " align(%" PRIu32 ")", fn_type_id->alignment); } - if (fn_type_id->cc != CallingConventionUnspecified && fn_type_id->cc != CallingConventionC) { - buf_appendf(&fn_type->name, " callconv(%s)", calling_convention_name(fn_type_id->cc)); + if (fn_type_id->cc != CallingConventionUnspecified) { + buf_appendf(&fn_type->name, " callconv(.%s)", calling_convention_name(fn_type_id->cc)); } buf_appendf(&fn_type->name, " %s", buf_ptr(&fn_type_id->return_type->name)); @@ -1464,7 +1462,7 @@ ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id) { } buf_append_str(&fn_type->name, ")"); if (fn_type_id->cc != CallingConventionUnspecified) { - buf_appendf(&fn_type->name, " callconv(%s)", calling_convention_name(fn_type_id->cc)); + buf_appendf(&fn_type->name, " callconv(.%s)", calling_convention_name(fn_type_id->cc)); } buf_append_str(&fn_type->name, " var"); @@ -4385,7 +4383,7 @@ uint32_t get_ptr_align(CodeGen *g, ZigType *type) { } else if (ptr_type->id == ZigTypeIdFn) { // I tried making this use LLVMABIAlignmentOfType but it trips this assertion in LLVM: // "Cannot getTypeInfo() on a type that is unsized!" - // when getting the alignment of `?extern fn() void`. + // when getting the alignment of `?fn() callconv(.C) void`. // See http://lists.llvm.org/pipermail/llvm-dev/2018-September/126142.html return (ptr_type->data.fn.fn_type_id.alignment == 0) ? 1 : ptr_type->data.fn.fn_type_id.alignment; } else if (ptr_type->id == ZigTypeIdAnyFrame) { diff --git a/test/compile_errors.zig b/test/compile_errors.zig index bf3ee14bec..fb1cf88e74 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2843,7 +2843,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\export fn entry() void { \\ foo(); \\} - \\nakedcc fn foo() void { } + \\fn foo() callconv(.Naked) void { } , &[_][]const u8{ "tmp.zig:2:5: error: unable to call function with naked calling convention", "tmp.zig:4:1: note: declared here", @@ -2978,7 +2978,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\} , &[_][]const u8{ "tmp.zig:1:30: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'", - "tmp.zig:7:18: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'", + "tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'", }); cases.add("implicit semicolon - block statement", @@ -5663,7 +5663,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { }); cases.add("@setAlignStack in naked function", - \\export nakedcc fn entry() void { + \\export fn entry() callconv(.Naked) void { \\ @setAlignStack(16); \\} , &[_][]const u8{ |
