| ... | ... | @@ -120,6 +120,7 @@ pub fn typeToCIdentifier(ty: Type, mod: *Module) std.fmt.Formatter(formatTypeAsC |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | const reserved_idents = std.ComptimeStringMap(void, .{ |
| 123 | // C language |
| 123 | 124 | .{ "alignas", { |
| 124 | 125 | @setEvalBranchQuota(4000); |
| 125 | 126 | } }, |
| ... | ... | @@ -215,14 +216,22 @@ const reserved_idents = std.ComptimeStringMap(void, .{ |
| 215 | 216 | .{ "void", {} }, |
| 216 | 217 | .{ "volatile", {} }, |
| 217 | 218 | .{ "while ", {} }, |
| 219 | |
| 220 | // windows.h |
| 221 | .{ "max", {} }, |
| 222 | .{ "min", {} }, |
| 218 | 223 | }); |
| 219 | 224 | |
| 220 | 225 | fn isReservedIdent(ident: []const u8) bool { |
| 221 | | if (ident.len >= 2 and ident[0] == '_') { |
| 226 | if (ident.len >= 2 and ident[0] == '_') { // C language |
| 222 | 227 | switch (ident[1]) { |
| 223 | 228 | 'A'...'Z', '_' => return true, |
| 224 | 229 | else => return false, |
| 225 | 230 | } |
| 231 | } else if (std.mem.startsWith(u8, ident, "DUMMYSTRUCTNAME") or |
| 232 | std.mem.startsWith(u8, ident, "DUMMYUNIONNAME")) |
| 233 | { // windows.h |
| 234 | return true; |
| 226 | 235 | } else return reserved_idents.has(ident); |
| 227 | 236 | } |
| 228 | 237 | |