authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-06 18:20:31-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-06 18:20:31-05:00
logbe2483c576850c038d84cade26c1a509a940f047
tree1bcf6e76b791751c88c7648df360c6969ac86b06
parent5ada610e098b8f4ada2c64c2e0a7b93bd7a5f9b0
signature Commit is signed but in an unrecognized format.

fix test suite regressions


3 files changed, 8 insertions(+), 10 deletions(-)

doc/langref.html.in+1-1
......@@ -7735,7 +7735,7 @@ const Derp = @OpaqueType();
77357735const Wat = @OpaqueType();
77367736
77377737extern fn bar(d: *Derp) void;
7738export fn foo(w: *Wat) void {
7738fn foo(w: *Wat) callconv(.C) void {
77397739 bar(w);
77407740}
77417741
src/analyze.cpp+4-6
......@@ -1010,8 +1010,6 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
10101010
10111011 // populate the name of the type
10121012 buf_resize(&fn_type->name, 0);
1013 if (fn_type->data.fn.fn_type_id.cc == CallingConventionC)
1014 buf_append_str(&fn_type->name, "extern ");
10151013 buf_appendf(&fn_type->name, "fn(");
10161014 for (size_t i = 0; i < fn_type_id->param_count; i += 1) {
10171015 FnTypeParamInfo *param_info = &fn_type_id->param_info[i];
......@@ -1030,8 +1028,8 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
10301028 if (fn_type_id->alignment != 0) {
10311029 buf_appendf(&fn_type->name, " align(%" PRIu32 ")", fn_type_id->alignment);
10321030 }
1033 if (fn_type_id->cc != CallingConventionUnspecified && fn_type_id->cc != CallingConventionC) {
1034 buf_appendf(&fn_type->name, " callconv(%s)", calling_convention_name(fn_type_id->cc));
1031 if (fn_type_id->cc != CallingConventionUnspecified) {
1032 buf_appendf(&fn_type->name, " callconv(.%s)", calling_convention_name(fn_type_id->cc));
10351033 }
10361034 buf_appendf(&fn_type->name, " %s", buf_ptr(&fn_type_id->return_type->name));
10371035
......@@ -1464,7 +1462,7 @@ ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
14641462 }
14651463 buf_append_str(&fn_type->name, ")");
14661464 if (fn_type_id->cc != CallingConventionUnspecified) {
1467 buf_appendf(&fn_type->name, " callconv(%s)", calling_convention_name(fn_type_id->cc));
1465 buf_appendf(&fn_type->name, " callconv(.%s)", calling_convention_name(fn_type_id->cc));
14681466 }
14691467 buf_append_str(&fn_type->name, " var");
14701468
......@@ -4385,7 +4383,7 @@ uint32_t get_ptr_align(CodeGen *g, ZigType *type) {
43854383 } else if (ptr_type->id == ZigTypeIdFn) {
43864384 // I tried making this use LLVMABIAlignmentOfType but it trips this assertion in LLVM:
43874385 // "Cannot getTypeInfo() on a type that is unsized!"
4388 // when getting the alignment of `?extern fn() void`.
4386 // when getting the alignment of `?fn() callconv(.C) void`.
43894387 // See http://lists.llvm.org/pipermail/llvm-dev/2018-September/126142.html
43904388 return (ptr_type->data.fn.fn_type_id.alignment == 0) ? 1 : ptr_type->data.fn.fn_type_id.alignment;
43914389 } else if (ptr_type->id == ZigTypeIdAnyFrame) {
test/compile_errors.zig+3-3
......@@ -2843,7 +2843,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
28432843 \\export fn entry() void {
28442844 \\ foo();
28452845 \\}
2846 \\nakedcc fn foo() void { }
2846 \\fn foo() callconv(.Naked) void { }
28472847 , &[_][]const u8{
28482848 "tmp.zig:2:5: error: unable to call function with naked calling convention",
28492849 "tmp.zig:4:1: note: declared here",
......@@ -2978,7 +2978,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
29782978 \\}
29792979 , &[_][]const u8{
29802980 "tmp.zig:1:30: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",
2981 "tmp.zig:7:18: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",
2981 "tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",
29822982 });
29832983
29842984 cases.add("implicit semicolon - block statement",
......@@ -5663,7 +5663,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
56635663 });
56645664
56655665 cases.add("@setAlignStack in naked function",
5666 \\export nakedcc fn entry() void {
5666 \\export fn entry() callconv(.Naked) void {
56675667 \\ @setAlignStack(16);
56685668 \\}
56695669 , &[_][]const u8{