-
Notifications
You must be signed in to change notification settings - Fork 164
Zig master (0.16.0) Update #856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Lint Results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Lint Results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Lint Results
Found 105 issues on changed lines in 1 file:
- core/src/failing.zig: 105 issues
Updating with new lint results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Lint Results
Found 106 issues on changed lines in 2 files:
- core/src/failing.zig: 105 issues
- examples/raspberrypi/rp2xxx/src/net/lwip/net.zig: 1 issue
| const Args = struct { | ||
| help: bool = false, | ||
| input_elf: ?[]const u8 = null, | ||
| output: ?[]const u8 = null, | ||
| chip_id: ?esp_image.ChipId = null, | ||
| min_rev_full: u16 = 0x0000, | ||
| max_rev_full: u16 = 0xffff, | ||
| dont_append_digest: bool = false, | ||
| flash_freq: esp_image.FlashFreq = .@"40m", | ||
| flash_mode: esp_image.FlashMode = .dio, | ||
| flash_size: esp_image.FlashSize = .@"4mb", | ||
| flash_mmu_page_size: esp_image.FlashMMU_PageSize = .default, | ||
| use_segments: bool = false, | ||
|
|
||
| pub fn parse(args: []const [:0]const u8) !Args { | ||
| var ret: Args = .{}; | ||
|
|
||
| var index: usize = 1; | ||
| while (index < args.len) : (index += 1) { | ||
| if (std.mem.eql(u8, args[index], "--help")) { | ||
| ret.help = true; | ||
| } else if (std.mem.eql(u8, args[index], "--output")) { | ||
| index += 1; | ||
| if (index >= args.len) { | ||
| return error.FormatRequiresArgument; | ||
| } | ||
| ret.output = args[index]; | ||
| } else if (std.mem.eql(u8, args[index], "--chip-id")) { | ||
| index += 1; | ||
| if (index >= args.len) { | ||
| return error.FormatRequiresArgument; | ||
| } | ||
| ret.chip_id = std.meta.stringToEnum(esp_image.ChipId, args[index]) orelse { | ||
| return error.InvalidChipId; | ||
| }; | ||
| } else if (std.mem.eql(u8, args[index], "--min-rev-full")) { | ||
| index += 1; | ||
| if (index >= args.len) { | ||
| return error.FormatRequiresArgument; | ||
| } | ||
| ret.min_rev_full = std.fmt.parseInt(u16, args[index], 10) catch { | ||
| return error.InvalidNumber; | ||
| }; | ||
| } else if (std.mem.eql(u8, args[index], "--max-rev-full")) { | ||
| index += 1; | ||
| if (index >= args.len) { | ||
| return error.FormatRequiresArgument; | ||
| } | ||
| ret.max_rev_full = std.fmt.parseInt(u16, args[index], 10) catch { | ||
| return error.InvalidNumber; | ||
| }; | ||
| } else if (std.mem.eql(u8, args[index], "--dont-append-digest")) { | ||
| ret.dont_append_digest = true; | ||
| } else if (std.mem.eql(u8, args[index], "--flash-freq")) { | ||
| index += 1; | ||
| if (index >= args.len) { | ||
| return error.FormatRequiresArgument; | ||
| } | ||
| ret.flash_freq = std.meta.stringToEnum(esp_image.FlashFreq, args[index]) orelse { | ||
| return error.InvalidFlashFreq; | ||
| }; | ||
| } else if (std.mem.eql(u8, args[index], "--flash-mode")) { | ||
| index += 1; | ||
| if (index >= args.len) { | ||
| return error.FormatRequiresArgument; | ||
| } | ||
| ret.flash_mode = std.meta.stringToEnum(esp_image.FlashMode, args[index]) orelse { | ||
| return error.InvalidFlashMode; | ||
| }; | ||
| } else if (std.mem.eql(u8, args[index], "--flash-size")) { | ||
| index += 1; | ||
| if (index >= args.len) { | ||
| return error.FormatRequiresArgument; | ||
| } | ||
| ret.flash_size = std.meta.stringToEnum(esp_image.FlashSize, args[index]) orelse { | ||
| return error.InvalidFlashSize; | ||
| }; | ||
| } else if (std.mem.eql(u8, args[index], "--flash-mmu-page-size")) { | ||
| index += 1; | ||
| if (index >= args.len) { | ||
| return error.FormatRequiresArgument; | ||
| } | ||
| ret.flash_mmu_page_size = std.meta.stringToEnum(esp_image.FlashMMU_PageSize, args[index]) orelse { | ||
| return error.InvalidFlashMMU_PageSize; | ||
| }; | ||
| } else if (std.mem.eql(u8, args[index], "--use-segments")) { | ||
| ret.use_segments = true; | ||
| } else { | ||
| if (ret.input_elf != null) { | ||
| std.log.err("extra arg: {s}", .{args[index]}); | ||
| return error.ExtraArguments; | ||
| } | ||
| ret.input_elf = args[index]; | ||
| } | ||
| } | ||
|
|
||
| return ret; | ||
| } | ||
| }; | ||
|
|
||
|
|
||
| const help_message = | ||
| \\--help Show this message | ||
| \\--output <str> Path to save the generated file | ||
| \\--chip-id <ChipId> Chip id | ||
| \\--min-rev-full <u16> Minimal chip revision (in format: major * 100 + minor) | ||
| \\--max-rev-full <u16> Maximal chip revision (in format: major * 100 + minor) | ||
| \\--dont-append-digest Don't append a SHA256 digest of the entire image after the checksum | ||
| \\--flash-freq <FlashFreq> SPI Flash frequency | ||
| \\--flash-mode <FlashMode> SPI Flash mode | ||
| \\--flash-size <FlashSize> SPI Flash size in megabytes | ||
| \\--flash-mmu-page-size <FlashMMU_PageSize> Flash MMU page size | ||
| \\--use-segments Use program headers instead of section headers | ||
| \\<str> | ||
| \\ | ||
| ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrote arg parsing to not depend on clap that isn't up to date with master. We should use the std cli parser when it lands
| const AnyFuture = std.Io.AnyFuture; | ||
| const net = Io.net; | ||
|
|
||
| // Taken from https://codeberg.org/ziglang/zig/pulls/30691/ until it lands. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should switch to Io.failing when it lands
Updating with new lint results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 Lint Results
Found 105 issues on changed lines in 1 file:
- core/src/failing.zig: 105 issues
No description provided.