zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 0e38f7215bede51b2ad3b8574e8b472c279d3db4 (tree)
parent 247e567422a0efde2ed1f2cbf1b16f217f2b61d9
Author: hryx <codroid@gmail.com>
Date:   Sat, 29 Jun 2019 14:34:00 -0700

Define different struct size for APValue on Windows (thanks @Sahnvour)

Diffstat:
Msrc-self-hosted/clang.zig | 4+++-
Msrc/zig_clang.h | 7++++++-
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src-self-hosted/clang.zig b/src-self-hosted/clang.zig @@ -1,3 +1,5 @@ +const builtin = @import("builtin"); + pub const struct_ZigClangAPSInt = @OpaqueType(); pub const struct_ZigClangAPFloat = @OpaqueType(); pub const struct_ZigClangASTContext = @OpaqueType(); @@ -938,7 +940,7 @@ pub const struct_ZigClangExprEvalResult = extern struct { pub const struct_ZigClangAPValue = extern struct { Kind: ZigClangAPValue_ValueKind, - Data: [68]u8, // TODO: is there a way to statically assert that this matches the .h? + Data: if (builtin.os == .windows) [52]u8 else [68]u8, }; pub const ZigClangAPValue_ValueKind = extern enum { diff --git a/src/zig_clang.h b/src/zig_clang.h @@ -47,7 +47,12 @@ enum ZigClangAPValue_ValueKind { struct ZigClangAPValue { enum ZigClangAPValue_ValueKind Kind; - char Data[68]; // experimentally-derived size of clang::APValue::DataType + // experimentally-derived size of clang::APValue::DataType +#ifdef _WIN32 + char Data[52]; +#else + char Data[68]; +#endif }; struct ZigClangExprEvalResult {