diff --git a/vlib/v/fmt/attrs.v b/vlib/v/fmt/attrs.v index 58cdbe4ebe..4b31fd1ea7 100644 --- a/vlib/v/fmt/attrs.v +++ b/vlib/v/fmt/attrs.v @@ -7,8 +7,11 @@ import v.ast pub fn (mut f Fmt) attrs(attrs []ast.Attr) { mut sorted_attrs := attrs.clone() - // Sort the attributes. The ones with arguments come first. - sorted_attrs.sort(a.arg.len > b.arg.len) + // Sort the attributes. The ones with arguments come first + sorted_attrs.sort_with_compare(fn (a &ast.Attr, b &ast.Attr) int { + d := b.arg.len - a.arg.len + return if d != 0 { d } else { compare_strings(b.arg, a.arg) } + }) for i, attr in sorted_attrs { if attr.arg.len == 0 { f.single_line_attrs(sorted_attrs[i..]) diff --git a/vlib/v/tests/create_dll/create_win_dll.v b/vlib/v/tests/create_dll/create_win_dll.v index c8a966aa46..b6684dbde9 100644 --- a/vlib/v/tests/create_dll/create_win_dll.v +++ b/vlib/v/tests/create_dll/create_win_dll.v @@ -13,8 +13,8 @@ pub fn test_tatltuae() int { return test.foo + test.bar } -[export: DllMain] [callconv: stdcall] +[export: DllMain] fn main(hinst voidptr, fdw_reason int, lp_reserved voidptr) bool { match fdw_reason { C.DLL_PROCESS_ATTACH {