Do not print column of a runtime.Source_Code_Location if the column == 0

This commit is contained in:
gingerBill
2024-04-19 13:32:55 +01:00
parent 20223345a4
commit 059175de3b
2 changed files with 16 additions and 8 deletions
+8 -4
View File
@@ -228,14 +228,18 @@ print_caller_location :: #force_no_inline proc "contextless" (loc: Source_Code_L
when ODIN_ERROR_POS_STYLE == .Default {
print_byte('(')
print_u64(u64(loc.line))
print_byte(':')
print_u64(u64(loc.column))
if loc.column != 0 {
print_byte(':')
print_u64(u64(loc.column))
}
print_byte(')')
} else when ODIN_ERROR_POS_STYLE == .Unix {
print_byte(':')
print_u64(u64(loc.line))
print_byte(':')
print_u64(u64(loc.column))
if loc.column != 0 {
print_byte(':')
print_u64(u64(loc.column))
}
print_byte(':')
} else {
#panic("unhandled ODIN_ERROR_POS_STYLE")
+8 -4
View File
@@ -2156,14 +2156,18 @@ fmt_named :: proc(fi: ^Info, v: any, verb: rune, info: runtime.Type_Info_Named)
when ODIN_ERROR_POS_STYLE == .Default {
io.write_byte(fi.writer, '(', &fi.n)
io.write_int(fi.writer, int(a.line), 10, &fi.n)
io.write_byte(fi.writer, ':', &fi.n)
io.write_int(fi.writer, int(a.column), 10, &fi.n)
if a.column != 0 {
io.write_byte(fi.writer, ':', &fi.n)
io.write_int(fi.writer, int(a.column), 10, &fi.n)
}
io.write_byte(fi.writer, ')', &fi.n)
} else when ODIN_ERROR_POS_STYLE == .Unix {
io.write_byte(fi.writer, ':', &fi.n)
io.write_int(fi.writer, int(a.line), 10, &fi.n)
io.write_byte(fi.writer, ':', &fi.n)
io.write_int(fi.writer, int(a.column), 10, &fi.n)
if a.column != 0 {
io.write_byte(fi.writer, ':', &fi.n)
io.write_int(fi.writer, int(a.column), 10, &fi.n)
}
io.write_byte(fi.writer, ':', &fi.n)
} else {
#panic("Unhandled ODIN_ERROR_POS_STYLE")