update to latest zig: add c_char type (#1124)

* update to latest zig: add c_char type

* Bump version, add c_char to isTypeIdent
This commit is contained in:
Jakub Konka 2023-04-14 04:02:18 +02:00 committed by GitHub
parent 4111d28073
commit 5457cec8da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 1 deletions

View File

@ -7,7 +7,7 @@ const zls_version = std.builtin.Version{ .major = 0, .minor = 11, .patch = 0 };
pub fn build(b: *std.build.Builder) !void { pub fn build(b: *std.build.Builder) !void {
comptime { comptime {
const current_zig = builtin.zig_version; const current_zig = builtin.zig_version;
const min_zig = std.SemanticVersion.parse("0.11.0-dev.2558+d3a237a98") catch unreachable; // zig build changes - "remove-legacy-build-api" https://github.com/ziglang/zig/pull/15234 const min_zig = std.SemanticVersion.parse("0.11.0-dev.2571+31738de28") catch unreachable; // add c_char - https://github.com/ziglang/zig/pull/15263
if (current_zig.order(min_zig) == .lt) { if (current_zig.order(min_zig) == .lt) {
@compileError(std.fmt.comptimePrint("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig })); @compileError(std.fmt.comptimePrint("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig }));
} }

View File

@ -653,6 +653,7 @@ pub fn isTypeIdent(text: []const u8) bool {
.{"type"}, .{"anyerror"}, .{"type"}, .{"anyerror"},
.{"comptime_int"}, .{"comptime_float"}, .{"comptime_int"}, .{"comptime_float"},
.{"anyframe"}, .{"anytype"}, .{"anyframe"}, .{"anytype"},
.{"c_char"}
}); });
if (PrimitiveTypes.has(text)) return true; if (PrimitiveTypes.has(text)) return true;

View File

@ -9025,6 +9025,7 @@ const primitive_instrs = std.ComptimeStringMap(Zir.Inst.Ref, .{
.{ "c_long", .c_long_type }, .{ "c_long", .c_long_type },
.{ "c_longdouble", .c_longdouble_type }, .{ "c_longdouble", .c_longdouble_type },
.{ "c_longlong", .c_longlong_type }, .{ "c_longlong", .c_longlong_type },
.{ "c_char", .c_char_type },
.{ "c_short", .c_short_type }, .{ "c_short", .c_short_type },
.{ "c_uint", .c_uint_type }, .{ "c_uint", .c_uint_type },
.{ "c_ulong", .c_ulong_type }, .{ "c_ulong", .c_ulong_type },
@ -9773,6 +9774,7 @@ fn nodeImpliesMoreThanOnePossibleValue(tree: *const Ast, start_node: Ast.Node.In
.c_long_type, .c_long_type,
.c_longdouble_type, .c_longdouble_type,
.c_longlong_type, .c_longlong_type,
.c_char_type,
.c_short_type, .c_short_type,
.c_uint_type, .c_uint_type,
.c_ulong_type, .c_ulong_type,
@ -10018,6 +10020,7 @@ fn nodeImpliesComptimeOnly(tree: *const Ast, start_node: Ast.Node.Index) bool {
.c_long_type, .c_long_type,
.c_longdouble_type, .c_longdouble_type,
.c_longlong_type, .c_longlong_type,
.c_char_type,
.c_short_type, .c_short_type,
.c_uint_type, .c_uint_type,
.c_ulong_type, .c_ulong_type,
@ -10158,6 +10161,7 @@ fn rvalue(
as_ty | @enumToInt(Zir.Inst.Ref.i64_type), as_ty | @enumToInt(Zir.Inst.Ref.i64_type),
as_ty | @enumToInt(Zir.Inst.Ref.usize_type), as_ty | @enumToInt(Zir.Inst.Ref.usize_type),
as_ty | @enumToInt(Zir.Inst.Ref.isize_type), as_ty | @enumToInt(Zir.Inst.Ref.isize_type),
as_ty | @enumToInt(Zir.Inst.Ref.c_char_type),
as_ty | @enumToInt(Zir.Inst.Ref.c_short_type), as_ty | @enumToInt(Zir.Inst.Ref.c_short_type),
as_ty | @enumToInt(Zir.Inst.Ref.c_ushort_type), as_ty | @enumToInt(Zir.Inst.Ref.c_ushort_type),
as_ty | @enumToInt(Zir.Inst.Ref.c_int_type), as_ty | @enumToInt(Zir.Inst.Ref.c_int_type),

View File

@ -2079,6 +2079,7 @@ pub const Inst = struct {
i128_type, i128_type,
usize_type, usize_type,
isize_type, isize_type,
c_char_type,
c_short_type, c_short_type,
c_ushort_type, c_ushort_type,
c_int_type, c_int_type,