mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.Build.Step.ConfigHeader: permit inserting enum values
This commit is contained in:
parent
344db9e26b
commit
c1c6f08296
4 changed files with 4 additions and 1 deletions
|
|
@ -131,7 +131,7 @@ fn putValue(config_header: *ConfigHeader, field_name: []const u8, comptime T: ty
|
|||
.comptime_int => {
|
||||
try config_header.values.put(field_name, .{ .int = v });
|
||||
},
|
||||
.enum_literal => {
|
||||
.@"enum", .enum_literal => {
|
||||
try config_header.values.put(field_name, .{ .ident = @tagName(v) });
|
||||
},
|
||||
.optional => {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ pub fn build(b: *std.Build) void {
|
|||
.SOME_ZERO = 0,
|
||||
.SOME_ONE = 1,
|
||||
.SOME_TEN = 10,
|
||||
.SOME_ENUM = @as(enum { foo, bar }, .foo),
|
||||
.SOME_ENUM_LITERAL = .@"test",
|
||||
.SOME_STRING = "test",
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ int foo();
|
|||
#define SOME_ZERO 0
|
||||
#define SOME_ONE 1
|
||||
#define SOME_TEN 10
|
||||
#define SOME_ENUM foo
|
||||
#define SOME_ENUM_LITERAL test
|
||||
#define SOME_STRING "test"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ int foo();
|
|||
#undef SOME_ZERO
|
||||
#undef SOME_ONE
|
||||
#undef SOME_TEN
|
||||
#undef SOME_ENUM
|
||||
#undef SOME_ENUM_LITERAL
|
||||
#undef SOME_STRING
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue