| ... | @@ -617,6 +617,8 @@ fn printCpusForArch(arch_name: []const u8, show_dependencies: bool) !void { | ... | @@ -617,6 +617,8 @@ fn printCpusForArch(arch_name: []const u8, show_dependencies: bool) !void { |
| 617 | } | 617 | } |
| 618 | } | 618 | } |
| 619 | | 619 | |
| | 620 | const null_terminated_empty_string = (&[_]u8 { 0 })[0..0 :0]; |
| | 621 | |
| 620 | fn toNullTerminatedStringAlloc(allocator: *std.mem.Allocator, str: []const u8) ![:0]const u8 { | 622 | fn toNullTerminatedStringAlloc(allocator: *std.mem.Allocator, str: []const u8) ![:0]const u8 { |
| 621 | var buffer = try std.Buffer.init(allocator, str); | 623 | var buffer = try std.Buffer.init(allocator, str); |
| 622 | | 624 | |
| ... | @@ -653,7 +655,7 @@ const Stage2TargetDetails = struct { | ... | @@ -653,7 +655,7 @@ const Stage2TargetDetails = struct { |
| 653 | .cpu = cpu, | 655 | .cpu = cpu, |
| 654 | }, | 656 | }, |
| 655 | .llvm_cpu_str = try toNullTerminatedStringAlloc(allocator, cpu.name), | 657 | .llvm_cpu_str = try toNullTerminatedStringAlloc(allocator, cpu.name), |
| 656 | .llvm_features_str = try toNullTerminatedStringAlloc(allocator, ""), | 658 | .llvm_features_str = null_terminated_empty_string, |
| 657 | .builtin_str = builtin_str_buffer.toOwnedSlice(), | 659 | .builtin_str = builtin_str_buffer.toOwnedSlice(), |
| 658 | }; | 660 | }; |
| 659 | } | 661 | } |
| ... | @@ -697,7 +699,7 @@ const Stage2TargetDetails = struct { | ... | @@ -697,7 +699,7 @@ const Stage2TargetDetails = struct { |
| 697 | .target_details = std.target.TargetDetails{ | 699 | .target_details = std.target.TargetDetails{ |
| 698 | .features = features, | 700 | .features = features, |
| 699 | }, | 701 | }, |
| 700 | .llvm_cpu_str = try toNullTerminatedStringAlloc(allocator, ""), | 702 | .llvm_cpu_str = null_terminated_empty_string, |
| 701 | .llvm_features_str = llvm_features_buffer.toOwnedSlice()[0..llvm_features_buffer_len :0], | 703 | .llvm_features_str = llvm_features_buffer.toOwnedSlice()[0..llvm_features_buffer_len :0], |
| 702 | .builtin_str = builtin_str_buffer.toOwnedSlice(), | 704 | .builtin_str = builtin_str_buffer.toOwnedSlice(), |
| 703 | }; | 705 | }; |
| ... | @@ -801,7 +803,7 @@ export fn stage2_target_details_get_cache_str(target_details: ?*const Stage2Targ | ... | @@ -801,7 +803,7 @@ export fn stage2_target_details_get_cache_str(target_details: ?*const Stage2Targ |
| 801 | }); | 803 | }); |
| 802 | } | 804 | } |
| 803 | | 805 | |
| 804 | return @as([*:0]const u8, ""); | 806 | return @as([*:0]const u8, null_terminated_empty_string); |
| 805 | } | 807 | } |
| 806 | | 808 | |
| 807 | // ABI warning | 809 | // ABI warning |
| ... | @@ -810,7 +812,7 @@ export fn stage2_target_details_get_llvm_cpu(target_details: ?*const Stage2Targe | ... | @@ -810,7 +812,7 @@ export fn stage2_target_details_get_llvm_cpu(target_details: ?*const Stage2Targe |
| 810 | return @as([*:0]const u8, td.llvm_cpu_str); | 812 | return @as([*:0]const u8, td.llvm_cpu_str); |
| 811 | } | 813 | } |
| 812 | | 814 | |
| 813 | return @as([*:0]const u8, ""); | 815 | return @as([*:0]const u8, null_terminated_empty_string); |
| 814 | } | 816 | } |
| 815 | | 817 | |
| 816 | // ABI warning | 818 | // ABI warning |
| ... | @@ -819,7 +821,7 @@ export fn stage2_target_details_get_llvm_features(target_details: ?*const Stage2 | ... | @@ -819,7 +821,7 @@ export fn stage2_target_details_get_llvm_features(target_details: ?*const Stage2 |
| 819 | return @as([*:0]const u8, td.llvm_features_str); | 821 | return @as([*:0]const u8, td.llvm_features_str); |
| 820 | } | 822 | } |
| 821 | | 823 | |
| 822 | return @as([*:0]const u8, ""); | 824 | return @as([*:0]const u8, null_terminated_empty_string); |
| 823 | } | 825 | } |
| 824 | | 826 | |
| 825 | // ABI warning | 827 | // ABI warning |
| ... | @@ -828,7 +830,7 @@ export fn stage2_target_details_get_builtin_str(target_details: ?*const Stage2Ta | ... | @@ -828,7 +830,7 @@ export fn stage2_target_details_get_builtin_str(target_details: ?*const Stage2Ta |
| 828 | return @as([*:0]const u8, td.builtin_str); | 830 | return @as([*:0]const u8, td.builtin_str); |
| 829 | } | 831 | } |
| 830 | | 832 | |
| 831 | return @as([*:0]const u8, ""); | 833 | return @as([*:0]const u8, null_terminated_empty_string); |
| 832 | } | 834 | } |
| 833 | | 835 | |
| 834 | const riscv_default_features: []*const std.target.Feature = &[_]*const std.target.Feature { | 836 | const riscv_default_features: []*const std.target.Feature = &[_]*const std.target.Feature { |