| author | |
| committer | |
| log | c236cbff39de996cf862dfedbc92584ac09414d8 |
| tree | 6932a6729486d4722646853dea75edb7521312f0 |
| parent | a6e288d5fe51d5373fa995b5eec2dd2325c1ea9f |
| parent | eefe6956fde0adc2b0b56fdb6d22e06e2543219e |
| signature |
fix compilation under mingw3 files changed, 24 insertions(+), 5 deletions(-)
CMakeLists.txt+3| ... | ... | @@ -454,6 +454,9 @@ if("${ZIG_TARGET_TRIPLE}" STREQUAL "native") |
| 454 | 454 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" |
| 455 | 455 | ) |
| 456 | 456 | set(ZIG_EXECUTABLE "${zig_BINARY_DIR}/zig") |
| 457 | if (WIN32) | |
| 458 | set(ZIG_EXECUTABLE "${ZIG_EXECUTABLE}.exe") | |
| 459 | endif() | |
| 457 | 460 | else() |
| 458 | 461 | add_custom_target(zig_build_libstage2 ALL |
| 459 | 462 | COMMAND "${ZIG_EXECUTABLE}" ${BUILD_LIBSTAGE2_ARGS} |
doc/langref.html.in+1-1| ... | ... | @@ -8167,7 +8167,7 @@ test "vector @splat" { |
| 8167 | 8167 | {#header_open|@tagName#} |
| 8168 | 8168 | <pre>{#syntax#}@tagName(value: var) []const u8{#endsyntax#}</pre> |
| 8169 | 8169 | <p> |
| 8170 | Converts an enum value or union value to a slice of bytes representing the name. | |
| 8170 | Converts an enum value or union value to a slice of bytes representing the name.</p><p>If the enum is non-exhaustive and the tag value does not map to a name, it invokes safety-checked {#link|Undefined Behavior#}. | |
| 8171 | 8171 | </p> |
| 8172 | 8172 | {#header_close#} |
| 8173 | 8173 |
src-self-hosted/stage2.zig+20-4| ... | ... | @@ -897,6 +897,22 @@ export fn stage2_libc_render(stage1_libc: *Stage2LibCInstallation, output_file: |
| 897 | 897 | return .None; |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | fn enumToString(value: var, type_name: []const u8) ![]const u8 { | |
| 901 | switch (@typeInfo(@TypeOf(value))) { | |
| 902 | .Enum => |e| { | |
| 903 | if (e.is_exhaustive) { | |
| 904 | return std.fmt.allocPrint(std.heap.c_allocator, ".{}", .{@tagName(value)}); | |
| 905 | } else { | |
| 906 | return std.fmt.allocPrint(std.heap.c_allocator, | |
| 907 | "@intToEnum({}, {})", | |
| 908 | .{type_name, @enumToInt(value)} | |
| 909 | ); | |
| 910 | } | |
| 911 | }, | |
| 912 | else => unreachable | |
| 913 | } | |
| 914 | } | |
| 915 | ||
| 900 | 916 | // ABI warning |
| 901 | 917 | const Stage2Target = extern struct { |
| 902 | 918 | arch: c_int, |
| ... | ... | @@ -1114,13 +1130,13 @@ const Stage2Target = extern struct { |
| 1114 | 1130 | |
| 1115 | 1131 | .windows => try os_builtin_str_buffer.outStream().print( |
| 1116 | 1132 | \\ .windows = .{{ |
| 1117 | \\ .min = .{}, | |
| 1118 | \\ .max = .{}, | |
| 1133 | \\ .min = {}, | |
| 1134 | \\ .max = {}, | |
| 1119 | 1135 | \\ }}}}, |
| 1120 | 1136 | \\ |
| 1121 | 1137 | , .{ |
| 1122 | @tagName(target.os.version_range.windows.min), | |
| 1123 | @tagName(target.os.version_range.windows.max), | |
| 1138 | try enumToString(target.os.version_range.windows.min, "Target.Os.WindowsVersion"), | |
| 1139 | try enumToString(target.os.version_range.windows.max, "Target.Os.WindowsVersion") | |
| 1124 | 1140 | }), |
| 1125 | 1141 | } |
| 1126 | 1142 | try os_builtin_str_buffer.appendSlice("};\n"); |