mirror of
https://github.com/ziglang/zig.git
synced 2025-12-29 09:33:18 +00:00
translate-c: Only consider public decls in isBuiltinDefined
This commit is contained in:
parent
df589eecd6
commit
f5553bfefc
@ -1990,6 +1990,7 @@ fn transImplicitCastExpr(
|
||||
|
||||
fn isBuiltinDefined(name: []const u8) bool {
|
||||
inline for (meta.declarations(std.zig.c_builtins)) |decl| {
|
||||
if (!decl.is_pub) continue;
|
||||
if (std.mem.eql(u8, name, decl.name)) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -3672,4 +3672,10 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
||||
, &[_][]const u8{
|
||||
\\pub const FOO = __builtin_popcount;
|
||||
});
|
||||
|
||||
cases.add("Only consider public decls in `isBuiltinDefined`",
|
||||
\\#define FOO std
|
||||
, &[_][]const u8{
|
||||
\\pub const FOO = @compileError("unable to translate macro: undefined identifier `std`");
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user