pub fn defineCMacro(translate_c: *TranslateC, name: []const u8, value: ?[]const u8) void translate_c: *TranslateCname: []const u8value: ?[]const u8156
157
158
159
160
161
162
163pub fn defineCMacro(translate_c: *TranslateC, name: []const u8, value: ?[]const u8) void {
const graph = translate_c.step.owner.graph;
const arena = graph.arena;
const wc = &graph.wip_configuration;
const macro = arena.print("{s}={s}", .{ name, value orelse "1" }) catch @panic("OOM");
const macro_string = wc.addString(macro) catch @panic("OOM");
translate_c.c_macros.append(arena, macro_string) catch @panic("OOM");
}
If the value is omitted, it is set to 1.
nameandvalueneed not live longer than the function call.