Skip to content

Commit

Permalink
Pragma: make pack level nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoClocks authored Jul 26, 2022
1 parent dde0bbb commit 395ec42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ record: struct {
record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{},
@"switch": ?*Switch = null,
in_loop: bool = false,
pragma_pack: u8 = 8,
pragma_pack: ?u8 = null,
declspec_id: StringId,

fn checkIdentifierCodepoint(comp: *Compilation, codepoint: u21, loc: Source.Location) Compilation.Error!bool {
Expand Down
6 changes: 3 additions & 3 deletions src/pragmas/pack.zig
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation
try p.pp.comp.diag.add(.{
.tag = .pragma_pack_show,
.loc = arg.loc,
.extra = .{ .unsigned = p.pragma_pack },
.extra = .{ .unsigned = p.pragma_pack orelse 8 },
}, arg.expansionSlice());
},
.push, .pop => {
Expand Down Expand Up @@ -96,7 +96,7 @@ fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation
}
}
if (action == .push) {
try pack.stack.append(p.pp.comp.gpa, .{ .label = label orelse "", .val = p.pragma_pack });
try pack.stack.append(p.pp.comp.gpa, .{ .label = label orelse "", .val = p.pragma_pack orelse 8 });
} else {
pack.pop(p, label);
if (new_val != null) {
Expand All @@ -120,7 +120,7 @@ fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation
.r_paren => if (apple_or_xl) {
pack.pop(p, null);
} else {
p.pragma_pack = 8;
p.pragma_pack = null;
},
.integer_literal => {
idx += 1;
Expand Down

0 comments on commit 395ec42

Please sign in to comment.