dst = 0_u64
exit = 60_u64
asm("syscall" : "={rax}"(dst)
: "{rax}"(exit), "{rdi}"(0)
: "rcx", "r11", "memory"
: "volatile")
$ crystal tool format algorithms/asm_print.cr
Error:, couldn't format 'algorithms/asm_print.cr',
please report a bug including the contents of it: https://github.com/crystal-lang/crystal/issues
@faustinoaq How do you want to format asm statement?
@MakeNowJust I don't want to format asm :sweat_smile: but other code around :point_down:
class String
def to_unsafe
pointerof(@c) # = > Can't be formatted because the bug
end
end
dst = 0_u64
exit = 60_u64
asm("syscall" : "={rax}"(dst)
: "{rax}"(exit), "{rdi}"(0)
: "rcx", "r11", "memory"
: "volatile")
There's asm used in the stdlib and the formatter doesn't fail, therefore there must be a bug in how the formatter in particular parses that asm because it uses more asm syntax than the stdlib does.
Currently crystal tool format formats asm with colon alignment, so I believe below is correct formatted code:
dst = 0_u64
exit = 60_u64
asm("syscall" : "={rax}"(dst)
: "{rax}"(exit), "{rdi}"(0)
: "rcx", "r11", "memory"
: "volatile")
/cc @asterite
Most helpful comment
@MakeNowJust I don't want to format asm :sweat_smile: but other code around :point_down: