mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
zig fmt: Keep callconv(.Inline) on function pointer types
Co-authored-by: Philipp Lühmann <mail@philipp.lu>
This commit is contained in:
parent
264acfdf3c
commit
d1908c9f66
@ -2879,6 +2879,9 @@ test "zig fmt: functions" {
|
||||
\\pub export fn puts(s: *const u8) align(2 + 2) c_int;
|
||||
\\pub inline fn puts(s: *const u8) align(2 + 2) c_int;
|
||||
\\pub noinline fn puts(s: *const u8) align(2 + 2) c_int;
|
||||
\\pub fn callInlineFn(func: fn () callconv(.Inline) void) void {
|
||||
\\ func();
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
@ -1417,9 +1417,9 @@ fn renderFnProto(gpa: *Allocator, ais: *Ais, tree: Ast, fn_proto: Ast.full.FnPro
|
||||
try renderToken(ais, tree, section_rparen, .space); // )
|
||||
}
|
||||
|
||||
if (fn_proto.ast.callconv_expr != 0 and
|
||||
!mem.eql(u8, "Inline", tree.tokenSlice(tree.nodes.items(.main_token)[fn_proto.ast.callconv_expr])))
|
||||
{
|
||||
const is_callconv_inline = mem.eql(u8, "Inline", tree.tokenSlice(tree.nodes.items(.main_token)[fn_proto.ast.callconv_expr]));
|
||||
const is_declaration = fn_proto.name_token != null;
|
||||
if (fn_proto.ast.callconv_expr != 0 and !(is_declaration and is_callconv_inline)) {
|
||||
const callconv_lparen = tree.firstToken(fn_proto.ast.callconv_expr) - 1;
|
||||
const callconv_rparen = tree.lastToken(fn_proto.ast.callconv_expr) + 1;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user