diff options
| author | Vexu <git@vexu.eu> | 2020-05-15 14:15:30 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-15 14:15:30 +0300 |
| commit | f8b99331a2ca98f0e938c8caaf1cd232ad1e9fa3 (patch) | |
| tree | aa74657a7023f839462bf2512b4ed4db4616243f /src-self-hosted | |
| parent | 4b898893e21fc644c4e7a163232e5e98631640d6 (diff) | |
| parent | 440189a04ae4baa4a20114fe1d30f0eb585bacc4 (diff) | |
| download | zig-f8b99331a2ca98f0e938c8caaf1cd232ad1e9fa3.tar.gz zig-f8b99331a2ca98f0e938c8caaf1cd232ad1e9fa3.zip | |
Merge pull request #5336 from Vexu/parser
Make self-hosted parser more error tolerant
Diffstat (limited to 'src-self-hosted')
| -rw-r--r-- | src-self-hosted/translate_c.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src-self-hosted/translate_c.zig b/src-self-hosted/translate_c.zig index 7da6f402af..0b4854dcdc 100644 --- a/src-self-hosted/translate_c.zig +++ b/src-self-hosted/translate_c.zig @@ -668,7 +668,7 @@ fn transTypeDefAsBuiltin(c: *Context, typedef_decl: *const ZigClangTypedefNameDe return transCreateNodeIdentifier(c, builtin_name); } -fn checkForBuiltinTypedef(checked_name: []const u8) !?[]const u8 { +fn checkForBuiltinTypedef(checked_name: []const u8) ?[]const u8 { const table = [_][2][]const u8{ .{ "uint8_t", "u8" }, .{ "int8_t", "i8" }, @@ -703,7 +703,7 @@ fn transTypeDef(c: *Context, typedef_decl: *const ZigClangTypedefNameDecl, top_l // TODO https://github.com/ziglang/zig/issues/3756 // TODO https://github.com/ziglang/zig/issues/1802 const checked_name = if (isZigPrimitiveType(typedef_name)) try std.fmt.allocPrint(c.a(), "{}_{}", .{ typedef_name, c.getMangle() }) else typedef_name; - if (try checkForBuiltinTypedef(checked_name)) |builtin| { + if (checkForBuiltinTypedef(checked_name)) |builtin| { return transTypeDefAsBuiltin(c, typedef_decl, builtin); } @@ -1411,7 +1411,7 @@ fn transDeclStmt(rp: RestorePoint, scope: *Scope, stmt: *const ZigClangDeclStmt) const underlying_type = ZigClangQualType_getTypePtr(underlying_qual); const mangled_name = try block_scope.makeMangledName(c, name); - if (try checkForBuiltinTypedef(name)) |builtin| { + if (checkForBuiltinTypedef(name)) |builtin| { try block_scope.variables.push(.{ .alias = builtin, .name = mangled_name, |
