Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

addUserInputFlag

Public Function
std.Build.addUserInputFlag
pub fn addUserInputFlag(b: *Build, name: []const u8) error

Build system implementation detail.

Params

  • b: *Build
  • name: []const u8

File

Build.zig:1388
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
pub fn addUserInputFlag(b: *Build, name: []const u8) error{OutOfMemory}!bool {
    const graph = b.graph;
    const arena = graph.arena;
    const gop = try b.user_input_options.getOrPut(arena, name);
    if (!gop.found_existing) {
        gop.key_ptr.* = graph.dupeString(name);
        gop.value_ptr.* = .{ .flag = {} };
        return false;
    }
    // Option already exists.
    switch (gop.value_ptr.*) {
        .scalar => |s| {
            log.err("flag -D{s} conflicts with option -D{s}={s}", .{ name, name, s });
            return true;
        },
        .list, .map, .lazy_path_list => {
            log.err("flag -D{s} conflicts with multiple options of the same name", .{name});
            return true;
        },
        .lazy_path => |lp| {
            log.err("flag -D{s} conflicts with option -D{s}={f}", .{ name, name, lp });
            return true;
        },

        .flag => {},
    }
    return false;
}