Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ziglang/zig into stage2-c…
Browse files Browse the repository at this point in the history
…ompile-log
  • Loading branch information
g-w1 committed Dec 25, 2020
2 parents 852743a + e18abab commit 9f75473
Show file tree
Hide file tree
Showing 698 changed files with 74,979 additions and 3,308 deletions.
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ set(ZIG_TARGET_TRIPLE "native" CACHE STRING "arch-os-abi to output binaries for"
set(ZIG_TARGET_MCPU "baseline" CACHE STRING "-mcpu parameter to output binaries for")
set(ZIG_EXECUTABLE "" CACHE STRING "(when cross compiling) path to already-built zig binary")
set(ZIG_PREFER_LLVM_CONFIG off CACHE BOOL "(when cross compiling) use llvm-config to find target llvm dependencies if needed")
set(ZIG_SINGLE_THREADED off CACHE BOOL "limit the zig compiler to use only 1 thread")

find_package(llvm)
find_package(clang)
Expand Down Expand Up @@ -361,6 +362,7 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/lib/std/io/buffered_writer.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/change_detection_stream.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/counting_writer.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/counting_reader.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/find_byte_out_stream.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/fixed_buffer_stream.zig"
"${CMAKE_SOURCE_DIR}/lib/std/io/reader.zig"
Expand Down Expand Up @@ -408,11 +410,12 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/lib/std/os/windows/bits.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os/windows/ntstatus.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os/windows/win32error.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Progress.zig"
"${CMAKE_SOURCE_DIR}/lib/std/ResetEvent.zig"
"${CMAKE_SOURCE_DIR}/lib/std/StaticResetEvent.zig"
"${CMAKE_SOURCE_DIR}/lib/std/pdb.zig"
"${CMAKE_SOURCE_DIR}/lib/std/process.zig"
"${CMAKE_SOURCE_DIR}/lib/std/progress.zig"
"${CMAKE_SOURCE_DIR}/lib/std/rand.zig"
"${CMAKE_SOURCE_DIR}/lib/std/reset_event.zig"
"${CMAKE_SOURCE_DIR}/lib/std/sort.zig"
"${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt.zig"
"${CMAKE_SOURCE_DIR}/lib/std/special/compiler_rt/addXf3.zig"
Expand Down Expand Up @@ -513,7 +516,9 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/src/Module.zig"
"${CMAKE_SOURCE_DIR}/src/Package.zig"
"${CMAKE_SOURCE_DIR}/src/RangeSet.zig"
"${CMAKE_SOURCE_DIR}/src/ThreadPool.zig"
"${CMAKE_SOURCE_DIR}/src/TypedValue.zig"
"${CMAKE_SOURCE_DIR}/src/WaitGroup.zig"
"${CMAKE_SOURCE_DIR}/src/astgen.zig"
"${CMAKE_SOURCE_DIR}/src/clang.zig"
"${CMAKE_SOURCE_DIR}/src/clang_options.zig"
Expand Down Expand Up @@ -713,6 +718,11 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
else()
set(ZIG1_RELEASE_ARG -OReleaseFast --strip)
endif()
if(ZIG_SINGLE_THREADED)
set(ZIG1_SINGLE_THREADED_ARG "--single-threaded")
else()
set(ZIG1_SINGLE_THREADED_ARG "")
endif()

set(BUILD_ZIG1_ARGS
"src/stage1.zig"
Expand All @@ -722,6 +732,7 @@ set(BUILD_ZIG1_ARGS
--override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
"-femit-bin=${ZIG1_OBJECT}"
"${ZIG1_RELEASE_ARG}"
"${ZIG1_SINGLE_THREADED_ARG}"
-lc
--pkg-begin build_options "${ZIG_CONFIG_ZIG_OUT}"
--pkg-end
Expand Down
3 changes: 2 additions & 1 deletion ci/drone/linux_script
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ git config core.abbrev 9

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local -GNinja
# TODO figure out why Drone CI is deadlocking and stop passing -DZIG_SINGLE_THREADED=ON
cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local -GNinja -DZIG_SINGLE_THREADED=ON

samu install
./zig build test -Dskip-release -Dskip-non-native
Expand Down
12 changes: 6 additions & 6 deletions doc/docgen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ pub fn main() !void {

const input_file_bytes = try in_file.inStream().readAllAlloc(allocator, max_doc_file_size);

var buffered_out_stream = io.bufferedOutStream(out_file.outStream());
var buffered_out_stream = io.bufferedOutStream(out_file.writer());

var tokenizer = Tokenizer.init(in_file_name, input_file_bytes);
var toc = try genToc(allocator, &tokenizer);

try fs.cwd().makePath(tmp_dir_name);
defer fs.cwd().deleteTree(tmp_dir_name) catch {};

try genHtml(allocator, &tokenizer, &toc, buffered_out_stream.outStream(), zig_exe);
try genHtml(allocator, &tokenizer, &toc, buffered_out_stream.writer(), zig_exe);
try buffered_out_stream.flush();
}

Expand Down Expand Up @@ -325,7 +325,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
var toc_buf = std.ArrayList(u8).init(allocator);
defer toc_buf.deinit();

var toc = toc_buf.outStream();
var toc = toc_buf.writer();

var nodes = std.ArrayList(Node).init(allocator);
defer nodes.deinit();
Expand Down Expand Up @@ -615,7 +615,7 @@ fn urlize(allocator: *mem.Allocator, input: []const u8) ![]u8 {
var buf = std.ArrayList(u8).init(allocator);
defer buf.deinit();

const out = buf.outStream();
const out = buf.writer();
for (input) |c| {
switch (c) {
'a'...'z', 'A'...'Z', '_', '-', '0'...'9' => {
Expand All @@ -634,7 +634,7 @@ fn escapeHtml(allocator: *mem.Allocator, input: []const u8) ![]u8 {
var buf = std.ArrayList(u8).init(allocator);
defer buf.deinit();

const out = buf.outStream();
const out = buf.writer();
try writeEscaped(out, input);
return buf.toOwnedSlice();
}
Expand Down Expand Up @@ -680,7 +680,7 @@ fn termColor(allocator: *mem.Allocator, input: []const u8) ![]u8 {
var buf = std.ArrayList(u8).init(allocator);
defer buf.deinit();

var out = buf.outStream();
var out = buf.writer();
var number_start_index: usize = undefined;
var first_number: usize = undefined;
var second_number: usize = undefined;
Expand Down
8 changes: 4 additions & 4 deletions doc/langref.html.in
Original file line number Diff line number Diff line change
Expand Up @@ -1300,10 +1300,10 @@ a /= b{#endsyntax#}</pre></td>
<li>Can cause {#link|overflow|Default Operations#} for integers.</li>
<li>Can cause {#link|Division by Zero#} for integers.</li>
<li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li>
<li>For non-compile-time-known signed integers, must use
<li>Signed integer operands must be comptime-known and positive. In other cases, use
{#link|@divTrunc#},
{#link|@divFloor#}, or
{#link|@divExact#} instead of {#syntax#}/{#endsyntax#}.
{#link|@divExact#} instead.
</li>
<li>Invokes {#link|Peer Type Resolution#} for the operands.</li>
</ul>
Expand All @@ -1325,9 +1325,9 @@ a %= b{#endsyntax#}</pre></td>
<ul>
<li>Can cause {#link|Division by Zero#} for integers.</li>
<li>Can cause {#link|Division by Zero#} for floats in {#link|FloatMode.Optimized Mode|Floating Point Operations#}.</li>
<li>For non-compile-time-known signed integers, must use
<li>Signed or floating-point operands must be comptime-known and positive. In other cases, use
{#link|@rem#} or
{#link|@mod#} instead of {#syntax#}%{#endsyntax#}.
{#link|@mod#} instead.
</li>
<li>Invokes {#link|Peer Type Resolution#} for the operands.</li>
</ul>
Expand Down
Loading

0 comments on commit 9f75473

Please sign in to comment.