Merge remote-tracking branch 'origin/master' into llvm8

This commit is contained in:
Andrew Kelley 2019-03-18 20:03:23 -04:00
commit a581f4f0e2
No known key found for this signature in database
GPG key ID: 7C5F548F728501A9
1291 changed files with 2471 additions and 13196 deletions

File diff suppressed because it is too large Load diff

View file

@ -707,7 +707,7 @@ const builtin_types = [][]const u8{
"f16", "f32", "f64", "f128", "c_longdouble", "c_short", "f16", "f32", "f64", "f128", "c_longdouble", "c_short",
"c_ushort", "c_int", "c_uint", "c_long", "c_ulong", "c_longlong", "c_ushort", "c_int", "c_uint", "c_long", "c_ulong", "c_longlong",
"c_ulonglong", "c_char", "c_void", "void", "bool", "isize", "c_ulonglong", "c_char", "c_void", "void", "bool", "isize",
"usize", "noreturn", "type", "error", "comptime_int", "comptime_float", "usize", "noreturn", "type", "anyerror", "comptime_int", "comptime_float",
}; };
fn isType(name: []const u8) bool { fn isType(name: []const u8) bool {
@ -1183,11 +1183,21 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
"--output-dir", "--output-dir",
tmp_dir_name, tmp_dir_name,
}); });
var mode_arg: []const u8 = "";
switch (code.mode) { switch (code.mode) {
builtin.Mode.Debug => {}, builtin.Mode.Debug => {},
builtin.Mode.ReleaseSafe => try test_args.append("--release-safe"), builtin.Mode.ReleaseSafe => {
builtin.Mode.ReleaseFast => try test_args.append("--release-fast"), try test_args.append("--release-safe");
builtin.Mode.ReleaseSmall => try test_args.append("--release-small"), mode_arg = " --release-safe";
},
builtin.Mode.ReleaseFast => {
try test_args.append("--release-fast");
mode_arg = " --release-fast";
},
builtin.Mode.ReleaseSmall => {
try test_args.append("--release-small");
mode_arg = " --release-small";
},
} }
const result = try os.ChildProcess.exec(allocator, test_args.toSliceConst(), null, &env_map, max_doc_file_size); const result = try os.ChildProcess.exec(allocator, test_args.toSliceConst(), null, &env_map, max_doc_file_size);
@ -1217,7 +1227,12 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
} }
const escaped_stderr = try escapeHtml(allocator, result.stderr); const escaped_stderr = try escapeHtml(allocator, result.stderr);
const colored_stderr = try termColor(allocator, escaped_stderr); const colored_stderr = try termColor(allocator, escaped_stderr);
try out.print("<pre><code class=\"shell\">$ zig test {}.zig\n{}</code></pre>\n", code.name, colored_stderr); try out.print(
"<pre><code class=\"shell\">$ zig test {}.zig{}\n{}</code></pre>\n",
code.name,
mode_arg,
colored_stderr,
);
}, },
Code.Id.Obj => |maybe_error_match| { Code.Id.Obj => |maybe_error_match| {
const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{}{}", code.name, obj_ext); const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{}{}", code.name, obj_ext);

View file

@ -5890,10 +5890,11 @@ comptime {
{#see_also|Import from C Header File|@cInclude|@cImport|@cUndef|void#} {#see_also|Import from C Header File|@cInclude|@cImport|@cUndef|void#}
{#header_close#} {#header_close#}
{#header_open|@cImport#} {#header_open|@cImport#}
<pre>{#syntax#}@cImport(expression) (namespace){#endsyntax#}</pre> <pre>{#syntax#}@cImport(expression) type{#endsyntax#}</pre>
<p> <p>
This function parses C code and imports the functions, types, variables, and This function parses C code and imports the functions, types, variables,
compatible macro definitions into the result namespace. and compatible macro definitions into a new empty struct type, and then
returns that type.
</p> </p>
<p> <p>
{#syntax#}expression{#endsyntax#} is interpreted at compile time. The builtin functions {#syntax#}expression{#endsyntax#} is interpreted at compile time. The builtin functions
@ -6320,14 +6321,22 @@ export fn @"A function name that is a complete sentence."() void {}
{#header_close#} {#header_close#}
{#header_open|@import#} {#header_open|@import#}
<pre>{#syntax#}@import(comptime path: []u8) (namespace){#endsyntax#}</pre> <pre>{#syntax#}@import(comptime path: []u8) type{#endsyntax#}</pre>
<p> <p>
This function finds a zig file corresponding to {#syntax#}path{#endsyntax#} and imports all the This function finds a zig file corresponding to {#syntax#}path{#endsyntax#} and adds it to the build,
public top level declarations into the resulting namespace. if it is not already added.
</p>
<p>
Zig source files are implicitly structs, with a name equal to the file's basename with the extension
truncated. {#syntax#}@import{#endsyntax#} returns the struct type corresponding to the file.
</p>
<p>
Declarations which have the {#syntax#}pub{#endsyntax#} keyword may be referenced from a different
source file than the one they are declared in.
</p> </p>
<p> <p>
{#syntax#}path{#endsyntax#} can be a relative or absolute path, or it can be the name of a package. {#syntax#}path{#endsyntax#} can be a relative or absolute path, or it can be the name of a package.
If it is a relative path, it is relative to the file that contains the {#syntax#}@import{#endsyntax#} If it is a relative path, it is relative to the file that contains the {#syntax#}@import{#endsyntax#}
function call. function call.
</p> </p>
<p> <p>
@ -6335,7 +6344,9 @@ export fn @"A function name that is a complete sentence."() void {}
</p> </p>
<ul> <ul>
<li>{#syntax#}@import("std"){#endsyntax#} - Zig Standard Library</li> <li>{#syntax#}@import("std"){#endsyntax#} - Zig Standard Library</li>
<li>{#syntax#}@import("builtin"){#endsyntax#} - Compiler-provided types and variables</li> <li>{#syntax#}@import("builtin"){#endsyntax#} - Compiler-provided types and variables.
The command <code>zig builtin</code> outputs the source to stdout for reference.
</li>
</ul> </ul>
{#see_also|Compile Variables|@embedFile#} {#see_also|Compile Variables|@embedFile#}
{#header_close#} {#header_close#}
@ -6769,8 +6780,32 @@ pub const FloatMode = enum {
{#header_open|@setRuntimeSafety#} {#header_open|@setRuntimeSafety#}
<pre>{#syntax#}@setRuntimeSafety(safety_on: bool){#endsyntax#}</pre> <pre>{#syntax#}@setRuntimeSafety(safety_on: bool){#endsyntax#}</pre>
<p> <p>
Sets whether runtime safety checks are on for the scope that contains the function call. Sets whether runtime safety checks are enabled for the scope that contains the function call.
</p> </p>
{#code_begin|test_safety|integer overflow#}
{#code_release_fast#}
test "@setRuntimeSafety" {
// The builtin applies to the scope that it is called in. So here, integer overflow
// will not be caught in ReleaseFast and ReleaseSmall modes:
// var x: u8 = 255;
// x += 1; // undefined behavior in ReleaseFast/ReleaseSmall modes.
{
// However this block has safety enabled, so safety checks happen here,
// even in ReleaseFast and ReleaseSmall modes.
@setRuntimeSafety(true);
var x: u8 = 255;
x += 1;
{
// The value can be overridden at any scope. So here integer overflow
// would not be caught in any build mode.
@setRuntimeSafety(false);
// var x: u8 = 255;
// x += 1; // undefined behavior in all build modes.
}
}
}
{#code_end#}
{#header_close#} {#header_close#}
@ -8177,28 +8212,68 @@ all your base are belong to us</code></pre>
</p> </p>
<pre><code class="shell">$ zig targets <pre><code class="shell">$ zig targets
Architectures: Architectures:
armv8_2a arm
armv8_1a v8_4a
armv8 v8_3a
armv8r v8_2a
armv8m_baseline v8_1a
armv8m_mainline v8
armv7 v8r
armv7em v8m_baseline
armv7m v8m_mainline
armv7s v7
armv7k v7em
armv7ve v7m
armv6 v7s
armv6m v7k
armv6k v7ve
armv6t2 v6
armv5 v6m
armv5te v6k
armv4t v6t2
v5
v5te
v4t
armeb armeb
v8_4a
v8_3a
v8_2a
v8_1a
v8
v8r
v8m_baseline
v8m_mainline
v7
v7em
v7m
v7s
v7k
v7ve
v6
v6m
v6k
v6t2
v5
v5te
v4t
aarch64 aarch64
v8_4a
v8_3a
v8_2a
v8_1a
v8
v8r
v8m_baseline
v8m_mainline
aarch64_be aarch64_be
v8_4a
v8_3a
v8_2a
v8_1a
v8
v8r
v8m_baseline
v8m_mainline
avr avr
bpfel bpfel
bpfeb bpfeb
@ -8208,7 +8283,6 @@ Architectures:
mips64 mips64
mips64el mips64el
msp430 msp430
nios2
powerpc powerpc
powerpc64 powerpc64
powerpc64le powerpc64le
@ -8220,32 +8294,58 @@ Architectures:
sparcv9 sparcv9
sparcel sparcel
s390x s390x
tce
tcele
thumb thumb
v8_4a
v8_3a
v8_2a
v8_1a
v8
v8r
v8m_baseline
v8m_mainline
v7
v7em
v7m
v7s
v7k
v7ve
v6
v6m
v6k
v6t2
v5
v5te
v4t
thumbeb thumbeb
v8_4a
v8_3a
v8_2a
v8_1a
v8
v8r
v8m_baseline
v8m_mainline
v7
v7em
v7m
v7s
v7k
v7ve
v6
v6m
v6k
v6t2
v5
v5te
v4t
i386 i386
x86_64 (native) x86_64 (native)
xcore xcore
nvptx nvptx
nvptx64 nvptx64
le32
le64
amdil
amdil64
hsail
hsail64
spir
spir64
kalimbav3
kalimbav4
kalimbav5
shave
lanai lanai
wasm32 wasm32
wasm64 wasm64
renderscript32
renderscript64
Operating Systems: Operating Systems:
freestanding freestanding
@ -8268,7 +8368,6 @@ Operating Systems:
rtems rtems
nacl nacl
cnk cnk
bitrig
aix aix
cuda cuda
nvcl nvcl
@ -8279,11 +8378,14 @@ Operating Systems:
watchos watchos
mesa3d mesa3d
contiki contiki
amdpal
zen zen
uefi
Environments: C ABIs:
unknown none
gnu (native) gnu (native)
gnuabin32
gnuabi64 gnuabi64
gnueabi gnueabi
gnueabihf gnueabihf
@ -8298,9 +8400,8 @@ Environments:
msvc msvc
itanium itanium
cygnus cygnus
amdopencl
coreclr coreclr
opencl</code></pre> simulator</code></pre>
<p> <p>
The Zig Standard Library ({#syntax#}@import("std"){#endsyntax#}) has architecture, environment, and operating system The Zig Standard Library ({#syntax#}@import("std"){#endsyntax#}) has architecture, environment, and operating system
abstractions, and thus takes additional work to support more platforms. abstractions, and thus takes additional work to support more platforms.
@ -8433,6 +8534,19 @@ fn readU32Be() u32 {}
<p>The codepoint U+000a (LF) (which is encoded as the single-byte value 0x0a) is the line terminator character. This character always terminates a line of zig source code (except possbly the last line of the file).</p> <p>The codepoint U+000a (LF) (which is encoded as the single-byte value 0x0a) is the line terminator character. This character always terminates a line of zig source code (except possbly the last line of the file).</p>
<p>For some discussion on the rationale behind these design decisions, see <a href="https://github.com/ziglang/zig/issues/663">issue #663</a></p> <p>For some discussion on the rationale behind these design decisions, see <a href="https://github.com/ziglang/zig/issues/663">issue #663</a></p>
{#header_close#} {#header_close#}
{#header_open|Keyword Reference#}
<p>
TODO the rest of the keywords. Most of these can just be links to the relevant section.
</p>
{#header_open|Keyword: pub#}
<p>The {#syntax#}pub{#endsyntax#} in front of a top level declaration makes the
declaration available to reference from a different file than the one it is declared in.</p>
<p><a href="https://github.com/ziglang/zig/issues/2059">TODO delete pub syntax for fields, or make it do something.</a></p>
{#see_also|@import#}
{#header_close#}
{#header_close#}
{#header_open|Grammar#} {#header_open|Grammar#}
<pre><code>Root &lt;- skip ContainerMembers eof <pre><code>Root &lt;- skip ContainerMembers eof

View file

@ -1,24 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright (C) 2012 ARM Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ASM_BITSPERLONG_H
#define __ASM_BITSPERLONG_H
#define __BITS_PER_LONG 64
#include <asm-generic/bitsperlong.h>
#endif /* __ASM_BITSPERLONG_H */

View file

@ -1,21 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright (C) 2012 ARM Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define __ARCH_WANT_RENAMEAT
#define __ARCH_WANT_NEW_STAT
#include <asm-generic/unistd.h>

View file

@ -1,24 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright (C) 2012 ARM Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ASM_BITSPERLONG_H
#define __ASM_BITSPERLONG_H
#define __BITS_PER_LONG 64
#include <asm-generic/bitsperlong.h>
#endif /* __ASM_BITSPERLONG_H */

View file

@ -1,21 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright (C) 2012 ARM Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define __ARCH_WANT_RENAMEAT
#define __ARCH_WANT_NEW_STAT
#include <asm-generic/unistd.h>

Some files were not shown because too many files have changed in this diff Show more