Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit e883d95

Browse files
committed
add missing floating point literals
1 parent 0a146cc commit e883d95

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/MacroTranslator.zig

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,16 @@ fn parseCNumLit(mt: *MacroTranslator) ParseError!ZigNode {
351351
const type_node = try ZigTag.type.create(arena, switch (suffix) {
352352
.F16 => "f16",
353353
.F => "f32",
354-
.None => "f64",
354+
.None, .F32x, .F64 => "f64",
355355
.L => "c_longdouble",
356-
.W => "f80",
356+
.W, .F64x => "f80",
357357
.Q, .F128 => "f128",
358-
else => unreachable,
358+
.BF16 => "u16",
359+
360+
else => {
361+
try mt.fail("TODO: float literal suffix: '{s}'", .{suffix_str});
362+
return error.ParseError;
363+
},
359364
});
360365
const rhs = try ZigTag.float_literal.create(arena, bytes.items);
361366
return ZigTag.as.create(arena, .{ .lhs = type_node, .rhs = rhs });
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#define PI_F64 3.141592653589793F64
2+
3+
// translate
4+
//
5+
// pub const PI_F64 = @as(f64, 3.141592653589793);

0 commit comments

Comments
 (0)