| author | |
| committer | |
| log | 0f88f9c66444406879bf133895f3c21ab3b85418 |
| tree | 7a17c0f8f4ef439bbf0fdf071201c7ca6bd81656 |
| parent | 21f5f06f1f66c9f849ae39d868c2d4548078231f |
3 files changed, 16 insertions(+), 15 deletions(-)
lib/compiler/aro/aro/Driver/Multilib.zig+8-8| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const Filesystem = @import("Filesystem.zig").Filesystem; |
| 3 | 3 | |
| 4 | pub const Flags = std.BoundedArray([]const u8, 6); | |
| 4 | pub const Flags = std.ArrayListUnmanaged([]const u8); | |
| 5 | 5 | |
| 6 | 6 | /// Large enough for GCCDetector for Linux; may need to be increased to support other toolchains. |
| 7 | 7 | const max_multilibs = 4; |
| 8 | 8 | |
| 9 | const MultilibArray = std.BoundedArray(Multilib, max_multilibs); | |
| 9 | const MultilibArray = std.ArrayListUnmanaged(Multilib); | |
| 10 | 10 | |
| 11 | 11 | pub const Detected = struct { |
| 12 | 12 | multilibs: MultilibArray = .{}, |
| ... | ... | @@ -15,20 +15,20 @@ pub const Detected = struct { |
| 15 | 15 | |
| 16 | 16 | pub fn filter(self: *Detected, multilib_filter: Filter, fs: Filesystem) void { |
| 17 | 17 | var found_count: usize = 0; |
| 18 | for (self.multilibs.constSlice()) |multilib| { | |
| 18 | for (self.multilibs.items) |multilib| { | |
| 19 | 19 | if (multilib_filter.exists(multilib, fs)) { |
| 20 | self.multilibs.set(found_count, multilib); | |
| 20 | self.multilibs.items[found_count] = multilib; | |
| 21 | 21 | found_count += 1; |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | self.multilibs.resize(found_count) catch unreachable; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | pub fn select(self: *Detected, flags: Flags) !bool { | |
| 27 | pub fn select(self: *Detected, flags: []const []const Flags) !bool { | |
| 28 | 28 | var filtered: MultilibArray = .{}; |
| 29 | for (self.multilibs.constSlice()) |multilib| { | |
| 30 | for (multilib.flags.constSlice()) |multilib_flag| { | |
| 31 | const matched = for (flags.constSlice()) |arg_flag| { | |
| 29 | for (self.multilibs.items) |multilib| { | |
| 30 | for (flags) |multilib_flag| { | |
| 31 | const matched = for (flags) |arg_flag| { | |
| 32 | 32 | if (std.mem.eql(u8, arg_flag[1..], multilib_flag[1..])) break arg_flag; |
| 33 | 33 | } else multilib_flag; |
| 34 | 34 | if (matched[0] != multilib_flag[0]) break; |
lib/compiler/aro/aro/Toolchain.zig+5-4| ... | ... | @@ -171,8 +171,7 @@ pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 { |
| 171 | 171 | /// TODO: this isn't exactly right since our target names don't necessarily match up |
| 172 | 172 | /// with GCC's. |
| 173 | 173 | /// For example the Zig target `arm-freestanding-eabi` would need the `arm-none-eabi` tools |
| 174 | fn possibleProgramNames(raw_triple: ?[]const u8, name: []const u8, buf: *[64]u8) std.BoundedArray([]const u8, 2) { | |
| 175 | var possible_names: std.BoundedArray([]const u8, 2) = .{}; | |
| 174 | fn possibleProgramNames(raw_triple: ?[]const u8, name: []const u8, buf: *[64]u8, possible_names: *std.ArrayListUnmanaged([]const u8)) void { | |
| 176 | 175 | if (raw_triple) |triple| { |
| 177 | 176 | if (std.fmt.bufPrint(buf, "{s}-{s}", .{ triple, name })) |res| { |
| 178 | 177 | possible_names.appendAssumeCapacity(res); |
| ... | ... | @@ -209,9 +208,11 @@ fn getProgramPath(tc: *const Toolchain, name: []const u8, buf: []u8) []const u8 |
| 209 | 208 | var fib = std.heap.FixedBufferAllocator.init(&path_buf); |
| 210 | 209 | |
| 211 | 210 | var tool_specific_buf: [64]u8 = undefined; |
| 212 | const possible_names = possibleProgramNames(tc.driver.raw_target_triple, name, &tool_specific_buf); | |
| 211 | var possible_names_buffer: [2][]const u8 = undefined; | |
| 212 | var possible_names = std.ArrayListUnmanaged.initBuffer(&possible_names_buffer); | |
| 213 | possibleProgramNames(tc.driver.raw_target_triple, name, &tool_specific_buf, &possible_names); | |
| 213 | 214 | |
| 214 | for (possible_names.constSlice()) |tool_name| { | |
| 215 | for (possible_names.items) |tool_name| { | |
| 215 | 216 | for (tc.program_paths.items) |program_path| { |
| 216 | 217 | defer fib.reset(); |
| 217 | 218 |
lib/compiler/translate-c/Translator.zig+3-3| ... | ... | @@ -3439,8 +3439,8 @@ fn transStringLiteralInitializer( |
| 3439 | 3439 | const init_list = try t.arena.alloc(ZigNode, @intCast(num_inits)); |
| 3440 | 3440 | for (init_list, 0..) |*item, i| { |
| 3441 | 3441 | const codepoint = switch (size) { |
| 3442 | 2 => @as(*const u16, @alignCast(@ptrCast(bytes.ptr + i * 2))).*, | |
| 3443 | 4 => @as(*const u32, @alignCast(@ptrCast(bytes.ptr + i * 4))).*, | |
| 3442 | 2 => @as(*const u16, @ptrCast(@alignCast(bytes.ptr + i * 2))).*, | |
| 3443 | 4 => @as(*const u32, @ptrCast(@alignCast(bytes.ptr + i * 4))).*, | |
| 3444 | 3444 | else => unreachable, |
| 3445 | 3445 | }; |
| 3446 | 3446 | item.* = try t.createCharLiteralNode(false, codepoint); |
| ... | ... | @@ -3873,7 +3873,7 @@ fn createNumberNode(t: *Translator, num: anytype, num_kind: enum { int, float }) |
| 3873 | 3873 | |
| 3874 | 3874 | fn createCharLiteralNode(t: *Translator, narrow: bool, val: u32) TransError!ZigNode { |
| 3875 | 3875 | return ZigTag.char_literal.create(t.arena, if (narrow) |
| 3876 | try std.fmt.allocPrint(t.arena, "'{f}'", .{std.zig.fmtChar(&.{@as(u8, @intCast(val))})}) | |
| 3876 | try std.fmt.allocPrint(t.arena, "'{f}'", .{std.zig.fmtChar(@intCast(val))}) | |
| 3877 | 3877 | else |
| 3878 | 3878 | try std.fmt.allocPrint(t.arena, "'\\u{{{x}}}'", .{val})); |
| 3879 | 3879 | } |