mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
translate-c correct assumption about macros
This commit is contained in:
parent
8088bdc6d5
commit
e063854563
@ -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().?;
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user