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();...@@ -7735,7 +7735,7 @@ const Derp = @OpaqueType();
7735const Wat = @OpaqueType();7735const Wat = @OpaqueType();
77367736
7737extern fn bar(d: *Derp) void;7737extern fn bar(d: *Derp) void;
7738export fn foo(w: *Wat) void {7738fn foo(w: *Wat) callconv(.C) void {
7739 bar(w);7739 bar(w);
7740}7740}
77417741
src/analyze.cpp+4-6
...@@ -1010,8 +1010,6 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {...@@ -1010,8 +1010,6 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
10101010
1011 // populate the name of the type1011 // populate the name of the type
1012 buf_resize(&fn_type->name, 0);1012 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 ");
1015 buf_appendf(&fn_type->name, "fn(");1013 buf_appendf(&fn_type->name, "fn(");
1016 for (size_t i = 0; i < fn_type_id->param_count; i += 1) {1014 for (size_t i = 0; i < fn_type_id->param_count; i += 1) {
1017 FnTypeParamInfo *param_info = &fn_type_id->param_info[i];1015 FnTypeParamInfo *param_info = &fn_type_id->param_info[i];
...@@ -1030,8 +1028,8 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {...@@ -1030,8 +1028,8 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
1030 if (fn_type_id->alignment != 0) {1028 if (fn_type_id->alignment != 0) {
1031 buf_appendf(&fn_type->name, " align(%" PRIu32 ")", fn_type_id->alignment);1029 buf_appendf(&fn_type->name, " align(%" PRIu32 ")", fn_type_id->alignment);
1032 }1030 }
1033 if (fn_type_id->cc != CallingConventionUnspecified && fn_type_id->cc != CallingConventionC) {1031 if (fn_type_id->cc != CallingConventionUnspecified) {
1034 buf_appendf(&fn_type->name, " callconv(%s)", calling_convention_name(fn_type_id->cc));1032 buf_appendf(&fn_type->name, " callconv(.%s)", calling_convention_name(fn_type_id->cc));
1035 }1033 }
1036 buf_appendf(&fn_type->name, " %s", buf_ptr(&fn_type_id->return_type->name));1034 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) {...@@ -1464,7 +1462,7 @@ ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
1464 }1462 }
1465 buf_append_str(&fn_type->name, ")");1463 buf_append_str(&fn_type->name, ")");
1466 if (fn_type_id->cc != CallingConventionUnspecified) {1464 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));
1468 }1466 }
1469 buf_append_str(&fn_type->name, " var");1467 buf_append_str(&fn_type->name, " var");
14701468
...@@ -4385,7 +4383,7 @@ uint32_t get_ptr_align(CodeGen *g, ZigType *type) {...@@ -4385,7 +4383,7 @@ uint32_t get_ptr_align(CodeGen *g, ZigType *type) {
4385 } else if (ptr_type->id == ZigTypeIdFn) {4383 } else if (ptr_type->id == ZigTypeIdFn) {
4386 // I tried making this use LLVMABIAlignmentOfType but it trips this assertion in LLVM:4384 // I tried making this use LLVMABIAlignmentOfType but it trips this assertion in LLVM:
4387 // "Cannot getTypeInfo() on a type that is unsized!"4385 // "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`.
4389 // See http://lists.llvm.org/pipermail/llvm-dev/2018-September/126142.html4387 // See http://lists.llvm.org/pipermail/llvm-dev/2018-September/126142.html
4390 return (ptr_type->data.fn.fn_type_id.alignment == 0) ? 1 : ptr_type->data.fn.fn_type_id.alignment;4388 return (ptr_type->data.fn.fn_type_id.alignment == 0) ? 1 : ptr_type->data.fn.fn_type_id.alignment;
4391 } else if (ptr_type->id == ZigTypeIdAnyFrame) {4389 } else if (ptr_type->id == ZigTypeIdAnyFrame) {
test/compile_errors.zig+3-3
...@@ -2843,7 +2843,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -2843,7 +2843,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
2843 \\export fn entry() void {2843 \\export fn entry() void {
2844 \\ foo();2844 \\ foo();
2845 \\}2845 \\}
2846 \\nakedcc fn foo() void { }2846 \\fn foo() callconv(.Naked) void { }
2847 , &[_][]const u8{2847 , &[_][]const u8{
2848 "tmp.zig:2:5: error: unable to call function with naked calling convention",2848 "tmp.zig:2:5: error: unable to call function with naked calling convention",
2849 "tmp.zig:4:1: note: declared here",2849 "tmp.zig:4:1: note: declared here",
...@@ -2978,7 +2978,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -2978,7 +2978,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
2978 \\}2978 \\}
2979 , &[_][]const u8{2979 , &[_][]const u8{
2980 "tmp.zig:1:30: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'",2980 "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'",
2982 });2982 });
29832983
2984 cases.add("implicit semicolon - block statement",2984 cases.add("implicit semicolon - block statement",
...@@ -5663,7 +5663,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -5663,7 +5663,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
5663 });5663 });
56645664
5665 cases.add("@setAlignStack in naked function",5665 cases.add("@setAlignStack in naked function",
5666 \\export nakedcc fn entry() void {5666 \\export fn entry() callconv(.Naked) void {
5667 \\ @setAlignStack(16);5667 \\ @setAlignStack(16);
5668 \\}5668 \\}
5669 , &[_][]const u8{5669 , &[_][]const u8{