Commit e063854563
Changed files (2)
src-self-hosted
test
src-self-hosted/translate_c.zig
@@ -4874,7 +4874,7 @@ fn transPreprocessorEntities(c: *Context, unit: *ZigClangASTUnit) Error!void {
var tok_it = tok_list.iterator(0);
const first_tok = tok_it.next().?;
- assert(first_tok.id == .Identifier and mem.eql(u8, slice[first_tok.start..first_tok.end], name));
+ assert(mem.eql(u8, slice[first_tok.start..first_tok.end], name));
var macro_fn = false;
const next = tok_it.peek().?;
test/translate_c.zig
@@ -25,6 +25,15 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
\\}
});
+ cases.add("macro keyword define",
+ \\#define foo 1
+ \\#define inline 2
+ , &[_][]const u8{
+ \\pub const foo = 1;
+ ,
+ \\pub const @"inline" = 2;
+ });
+
cases.add("macro line continuation",
\\#define FOO -\
\\BAR