diff --git a/README.md b/README.md index e5cfcc4e91..39ef644976 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ A general-purpose programming language and toolchain for maintaining [](https://dev.azure.com/ziglang/zig/_build/latest?definitionId=1&branchName=master) Note that you can -[download a binary of master branch](https://ziglang.org/download/#release-master). +[download a binary of master branch](https://ziglang.org/download/#release-master) or +[install Zig from a package manager](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager). ### Stage 1: Build Zig from C++ Source Code diff --git a/build.zig b/build.zig index 9c50025375..8ac2d4f8ba 100644 --- a/build.zig +++ b/build.zig @@ -49,6 +49,7 @@ pub fn build(b: *Builder) !void { const skip_release_safe = b.option(bool, "skip-release-safe", "Main test suite skips release-safe builds") orelse skip_release; const skip_non_native = b.option(bool, "skip-non-native", "Main test suite skips non-native builds") orelse false; const skip_libc = b.option(bool, "skip-libc", "Main test suite skips tests that link libc") orelse false; + const skip_compile_errors = b.option(bool, "skip-compile-errors", "Main test suite skips compile error tests") orelse false; const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse false; @@ -83,6 +84,7 @@ pub fn build(b: *Builder) !void { } const log_scopes = b.option([]const []const u8, "log", "Which log scopes to enable") orelse &[0][]const u8{}; + const zir_dumps = b.option([]const []const u8, "dump-zir", "Which functions to dump ZIR for before codegen") orelse &[0][]const u8{}; const opt_version_string = b.option([]const u8, "version-string", "Override Zig version string. Default is to find out with git."); const version = if (opt_version_string) |version| version else v: { @@ -103,6 +105,7 @@ pub fn build(b: *Builder) !void { exe.addBuildOption([]const u8, "version", version); exe.addBuildOption([]const []const u8, "log_scopes", log_scopes); + exe.addBuildOption([]const []const u8, "zir_dumps", zir_dumps); exe.addBuildOption(bool, "enable_tracy", tracy != null); if (tracy) |tracy_path| { const client_cpp = fs.path.join( @@ -182,7 +185,9 @@ pub fn build(b: *Builder) !void { test_step.dependOn(tests.addRunTranslatedCTests(b, test_filter)); // tests for this feature are disabled until we have the self-hosted compiler available // test_step.dependOn(tests.addGenHTests(b, test_filter)); - test_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes)); + if (!skip_compile_errors) { + test_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes)); + } test_step.dependOn(docs_step); } diff --git a/ci/azure/windows_msvc_script.bat b/ci/azure/windows_msvc_script.bat index b2063a8e5f..5c3593fb96 100644 --- a/ci/azure/windows_msvc_script.bat +++ b/ci/azure/windows_msvc_script.bat @@ -24,7 +24,7 @@ cd %ZIGBUILDDIR% cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b -"%ZIGINSTALLDIR%\bin\zig.exe" build test || exit /b +"%ZIGINSTALLDIR%\bin\zig.exe" build test -Dskip-compile-errors || exit /b set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" SET "MSYSTEM=MINGW64" diff --git a/doc/langref.html.in b/doc/langref.html.in index 8e324743ea..b9b8f71c7a 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -10308,14 +10308,586 @@ fn readU32Be() u32 {} {#header_close#} {#header_open|Keyword Reference#} -
- TODO the rest of the keywords. Most of these can just be links to the relevant section. -
- {#header_open|Keyword: pub#} -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.
- {#see_also|@import#} - {#header_close#} +| + Keyword + | ++ Description + | +
|---|---|
+ {#syntax#}align{#endsyntax#}
+ |
+
+ {#syntax#}align{#endsyntax#} can be used to specify the alignment of a pointer.
+ It can also be used after a variable or function declaration to specify the alignment of pointers to that variable or function.
+
|
+
+ {#syntax#}allowzero{#endsyntax#}
+ |
+
+ The pointer attribute {#syntax#}allowzero{#endsyntax#} allows a pointer to have address zero.
+
|
+
+ {#syntax#}and{#endsyntax#}
+ |
+
+ The boolean operator {#syntax#}and{#endsyntax#}.
+
|
+
+ {#syntax#}anyframe{#endsyntax#}
+ |
+
+ {#syntax#}anyframe{#endsyntax#} can be used as a type for variables which hold pointers to function frames.
+
|
+
+ {#syntax#}anytype{#endsyntax#}
+ |
+
+ Function parameters and struct fields can be declared with {#syntax#}anytype{#endsyntax#} in place of the type.
+ The type will be inferred where the function is called or the struct is instantiated.
+
|
+
+ {#syntax#}asm{#endsyntax#}
+ |
+
+ {#syntax#}asm{#endsyntax#} begins an inline assembly expression. This allows for directly controlling the machine code generated on compilation.
+
|
+
+ {#syntax#}async{#endsyntax#}
+ |
+
+ {#syntax#}async{#endsyntax#} can be used before a function call to get a pointer to the function's frame when it suspends.
+
|
+
+ {#syntax#}await{#endsyntax#}
+ |
+
+ {#syntax#}await{#endsyntax#} can be used to suspend the current function until the frame provided after the {#syntax#}await{#endsyntax#} completes.
+ {#syntax#}await{#endsyntax#} copies the value returned from the target function's frame to the caller.
+
|
+
+ {#syntax#}break{#endsyntax#}
+ |
+
+ {#syntax#}break{#endsyntax#} can be used with a block label to return a value from the block.
+ It can also be used to exit a loop before iteration completes naturally.
+
|
+
+ {#syntax#}catch{#endsyntax#}
+ |
+
+ {#syntax#}catch{#endsyntax#} can be used to evaluate an expression if the expression before it evaluates to an error.
+ The expression after the {#syntax#}catch{#endsyntax#} can optionally capture the error value.
+
|
+
+ {#syntax#}comptime{#endsyntax#}
+ |
+
+ {#syntax#}comptime{#endsyntax#} before a declaration can be used to label variables or function parameters as known at compile time.
+ It can also be used to guarantee an expression is run at compile time.
+
|
+
+ {#syntax#}const{#endsyntax#}
+ |
+
+ {#syntax#}const{#endsyntax#} declares a variable that can not be modified.
+ Used as a pointer attribute, it denotes the value referenced by the pointer cannot be modified.
+
|
+
+ {#syntax#}continue{#endsyntax#}
+ |
+
+ {#syntax#}continue{#endsyntax#} can be used in a loop to jump back to the beginning of the loop.
+
|
+
+ {#syntax#}defer{#endsyntax#}
+ |
+
+ {#syntax#}defer{#endsyntax#} will execute an expression when control flow leaves the current block.
+
|
+
+ {#syntax#}else{#endsyntax#}
+ |
+
+ {#syntax#}else{#endsyntax#} can be used to provide an alternate branch for {#syntax#}if{#endsyntax#}, {#syntax#}switch{#endsyntax#},
+ {#syntax#}while{#endsyntax#}, and {#syntax#}for{#endsyntax#} expressions.
+
|
+
+ {#syntax#}enum{#endsyntax#}
+ |
+
+ {#syntax#}enum{#endsyntax#} defines an enum type.
+
|
+
+ {#syntax#}errdefer{#endsyntax#}
+ |
+
+ {#syntax#}errdefer{#endsyntax#} will execute an expression when control flow leaves the current block if the function returns an error.
+
|
+
+ {#syntax#}error{#endsyntax#}
+ |
+
+ {#syntax#}error{#endsyntax#} defines an error type.
+
|
+
+ {#syntax#}export{#endsyntax#}
+ |
+
+ {#syntax#}export{#endsyntax#} makes a function or variable externally visible in the generated object file.
+ Exported functions default to the C calling convention.
+
|
+
+ {#syntax#}extern{#endsyntax#}
+ |
+
+ {#syntax#}extern{#endsyntax#} can be used to declare a function or variable that will be resolved at link time, when linking statically
+ or at runtime, when linking dynamically.
+
|
+
+ {#syntax#}false{#endsyntax#}
+ |
+
+ The boolean value {#syntax#}false{#endsyntax#}.
+
|
+
+ {#syntax#}fn{#endsyntax#}
+ |
+
+ {#syntax#}fn{#endsyntax#} declares a function.
+
|
+
+ {#syntax#}for{#endsyntax#}
+ |
+
+ A {#syntax#}for{#endsyntax#} expression can be used to iterate over the elements of a slice, array, or tuple.
+
|
+
+ {#syntax#}if{#endsyntax#}
+ |
+
+ An {#syntax#}if{#endsyntax#} expression can test boolean expressions, optional values, or error unions.
+ For optional values or error unions, the if expression can capture the unwrapped value.
+
|
+
+ {#syntax#}inline{#endsyntax#}
+ |
+
+ {#syntax#}inline{#endsyntax#} can be used to label a loop expression such that it will be unrolled at compile time.
+ It can also be used to force a function to be inlined at all call sites.
+
|
+
+ {#syntax#}noalias{#endsyntax#}
+ |
+
+ The {#syntax#}noalias{#endsyntax#} keyword.
+
|
+
+ {#syntax#}nosuspend{#endsyntax#}
+ |
+
+ The {#syntax#}nosuspend{#endsyntax#} keyword.
+
|
+
+ {#syntax#}null{#endsyntax#}
+ |
+
+ The optional value {#syntax#}null{#endsyntax#}.
+
|
+
+ {#syntax#}or{#endsyntax#}
+ |
+
+ The boolean operator {#syntax#}or{#endsyntax#}.
+
|
+
+ {#syntax#}orelse{#endsyntax#}
+ |
+
+ {#syntax#}orelse{#endsyntax#} can be used to evaluate an expression if the expression before it evaluates to null.
+
|
+
+ {#syntax#}packed{#endsyntax#}
+ |
+
+ The {#syntax#}packed{#endsyntax#} keyword before a struct definition changes the struct's in-memory layout
+ to the guaranteed {#syntax#}packed{#endsyntax#} layout.
+
|
+
+ {#syntax#}pub{#endsyntax#}
+ |
+
+ 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.
+
|
+
+ {#syntax#}resume{#endsyntax#}
+ |
+
+ {#syntax#}resume{#endsyntax#} will continue execution of a function frame after the point the function was suspended.
+
|
+
+ {#syntax#}return{#endsyntax#}
+ |
+
+ {#syntax#}return{#endsyntax#} exits a function with a value.
+
|
+
+ {#syntax#}linksection{#endsyntax#}
+ |
+
+ The {#syntax#}linksection{#endsyntax#} keyword.
+
|
+
+ {#syntax#}struct{#endsyntax#}
+ |
+
+ {#syntax#}struct{#endsyntax#} defines a struct.
+
|
+
+ {#syntax#}suspend{#endsyntax#}
+ |
+
+ {#syntax#}suspend{#endsyntax#} will cause control flow to return to the call site or resumer of the function.
+ {#syntax#}suspend{#endsyntax#} can also be used before a block within a function,
+ to allow the function access to its frame before control flow returns to the call site.
+
|
+
+ {#syntax#}switch{#endsyntax#}
+ |
+
+ A {#syntax#}switch{#endsyntax#} expression can be used to test values of a common type.
+ {#syntax#}switch{#endsyntax#} cases can capture field values of a {#link|Tagged union#}.
+
|
+
+ {#syntax#}test{#endsyntax#}
+ |
+
+ The {#syntax#}test{#endsyntax#} keyword can be used to denote a top-level block of code
+ used to make sure behavior meets expectations.
+
|
+
+ {#syntax#}threadlocal{#endsyntax#}
+ |
+
+ {#syntax#}threadlocal{#endsyntax#} can be used to specify a variable as thread-local.
+
|
+
+ {#syntax#}true{#endsyntax#}
+ |
+
+ The boolean value {#syntax#}true{#endsyntax#}.
+
|
+
+ {#syntax#}try{#endsyntax#}
+ |
+
+ {#syntax#}try{#endsyntax#} evaluates an error union expression.
+ If it is an error, it returns from the current function with the same error.
+ Otherwise, the expression results in the unwrapped value.
+
|
+
+ {#syntax#}undefined{#endsyntax#}
+ |
+
+ {#syntax#}undefined{#endsyntax#} can be used to leave a value uninitialized.
+
|
+
+ {#syntax#}union{#endsyntax#}
+ |
+
+ {#syntax#}union{#endsyntax#} defines a union.
+
|
+
+ {#syntax#}unreachable{#endsyntax#}
+ |
+
+ {#syntax#}unreachable{#endsyntax#} can be used to assert that control flow will never happen upon a particular location.
+ Depending on the build mode, {#syntax#}unreachable{#endsyntax#} may emit a panic.
+
|
+
+ {#syntax#}usingnamespace{#endsyntax#}
+ |
+
+ {#syntax#}usingnamespace{#endsyntax#} is a top-level declaration that imports all the public declarations of the operand,
+ which must be a struct, union, or enum, into the current scope.
+
|
+
+ {#syntax#}var{#endsyntax#}
+ |
+
+ {#syntax#}var{#endsyntax#} declares a variable that may be modified.
+
|
+
+ {#syntax#}volatile{#endsyntax#}
+ |
+
+ {#syntax#}volatile{#endsyntax#} can be used to denote loads or stores of a pointer have side effects.
+ It can also modify an inline assembly expression to denote it has side effects.
+
|
+
+ {#syntax#}while{#endsyntax#}
+ |
+
+ A {#syntax#}while{#endsyntax#} expression can be used to repeatedly test a boolean, optional, or error union expression,
+ and cease looping when that expression evaluates to false, null, or an error, respectively.
+
|
+