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

master
Andrew Kelley 2020-01-16 13:01:36 -05:00
commit fbe6af81fd
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
856 changed files with 73631 additions and 35008 deletions

View File

@ -3,8 +3,11 @@ packages:
- cmake
- py27-s3cmd
- wget
- curl
- jq
secrets:
- 6c60aaee-92e7-4e7d-812c-114817689b4d
- dd0bd962-7664-4d3e-b0f3-41c9ee96b8b8
sources:
- https://github.com/ziglang/zig
tasks:

View File

@ -10,10 +10,14 @@ if(NOT CMAKE_INSTALL_PREFIX)
"Directory to install zig to" FORCE)
endif()
set(CMAKE_USER_MAKE_RULES_OVERRIDE
${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)
project(zig C CXX)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
set(ZIG_VERSION_MAJOR 0)
set(ZIG_VERSION_MINOR 5)
set(ZIG_VERSION_PATCH 0)
@ -42,6 +46,7 @@ message("Configuring zig version ${ZIG_VERSION}")
set(ZIG_STATIC off CACHE BOOL "Attempt to build a static zig executable (not compatible with glibc)")
set(ZIG_STATIC_LLVM off CACHE BOOL "Prefer linking against static LLVM libraries")
set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL "Disable copying lib/ files to install prefix")
set(ZIG_ENABLE_MEM_PROFILE off CACHE BOOL "Activate memory usage instrumentation")
if(ZIG_STATIC)
set(ZIG_STATIC_LLVM "on")
@ -433,16 +438,20 @@ set(ZIG_MAIN_SRC "${CMAKE_SOURCE_DIR}/src/main.cpp")
# This is our shim which will be replaced by libuserland written in Zig.
set(ZIG0_SHIM_SRC "${CMAKE_SOURCE_DIR}/src/userland.cpp")
if(ZIG_ENABLE_MEM_PROFILE)
set(ZIG_SOURCES_MEM_PROFILE "${CMAKE_SOURCE_DIR}/src/memory_profiling.cpp")
endif()
set(ZIG_SOURCES
"${CMAKE_SOURCE_DIR}/src/analyze.cpp"
"${CMAKE_SOURCE_DIR}/src/ast_render.cpp"
"${CMAKE_SOURCE_DIR}/src/bigfloat.cpp"
"${CMAKE_SOURCE_DIR}/src/bigint.cpp"
"${CMAKE_SOURCE_DIR}/src/buffer.cpp"
"${CMAKE_SOURCE_DIR}/src/c_tokenizer.cpp"
"${CMAKE_SOURCE_DIR}/src/cache_hash.cpp"
"${CMAKE_SOURCE_DIR}/src/codegen.cpp"
"${CMAKE_SOURCE_DIR}/src/compiler.cpp"
"${CMAKE_SOURCE_DIR}/src/dump_analysis.cpp"
"${CMAKE_SOURCE_DIR}/src/errmsg.cpp"
"${CMAKE_SOURCE_DIR}/src/error.cpp"
"${CMAKE_SOURCE_DIR}/src/glibc.cpp"
@ -453,11 +462,10 @@ set(ZIG_SOURCES
"${CMAKE_SOURCE_DIR}/src/os.cpp"
"${CMAKE_SOURCE_DIR}/src/parser.cpp"
"${CMAKE_SOURCE_DIR}/src/range_set.cpp"
"${CMAKE_SOURCE_DIR}/src/stack_report.cpp"
"${CMAKE_SOURCE_DIR}/src/target.cpp"
"${CMAKE_SOURCE_DIR}/src/tokenizer.cpp"
"${CMAKE_SOURCE_DIR}/src/translate_c.cpp"
"${CMAKE_SOURCE_DIR}/src/util.cpp"
"${ZIG_SOURCES_MEM_PROFILE}"
)
set(OPTIMIZED_C_SOURCES
"${CMAKE_SOURCE_DIR}/src/blake2b.c"
@ -624,5 +632,10 @@ set_target_properties(zig PROPERTIES
LINK_FLAGS ${EXE_LDFLAGS}
)
target_link_libraries(zig compiler "${LIBUSERLAND}")
if(MSVC)
target_link_libraries(zig ntdll.lib)
elseif(MINGW)
target_link_libraries(zig ntdll)
endif()
add_dependencies(zig zig_build_libuserland)
install(TARGETS zig DESTINATION bin)

View File

@ -123,3 +123,61 @@ When developing on Linux, another option is available to you: `-Denable-wine`.
This will enable running behavior tests and std lib tests with Wine. It's
recommended for Linux users to install Wine and enable this testing option
when editing the standard library or anything Windows-related.
#### Improving Translate-C
Please read the [Editing Source Code](#editing-source-code) section as a
prerequisite to this one.
`translate-c` is a feature provided by Zig that converts C source code into
Zig source code. It powers the `zig translate-c` command as well as
[@cImport](https://ziglang.org/documentation/master/#cImport), allowing Zig
code to not only take advantage of function prototypes defined in .h files,
but also `static inline` functions written in C, and even some macros.
This feature works by using libclang API to parse and semantically analyze
C/C++ files, and then based on the provided AST and type information,
generating Zig AST, and finally using the mechanisms of `zig fmt` to render
the Zig AST to a file.
The relevant tests for this feature are:
* `test/run_translated_c.zig` - each test case is C code with a `main` function. The C code
is translated into Zig code, compiled, and run, and tests that the expected output is the
same, and that the program exits cleanly. This kind of test coverage is preferred, when
possible, because it makes sure that the resulting Zig code is actually viable.
* `test/translate_c.zig` - each test case is C code, with a list of expected strings which
must be found in the resulting Zig code. This kind of test is more precise in what it
measures, but does not provide test coverage of whether the resulting Zig code is valid.
This feature is self-hosted, even though Zig is not fully self-hosted yet. In the Zig source
repo, we maintain a C API on top of Clang's C++ API:
* `src/zig_clang.h` - the C API that we maintain on top of Clang's C++ API. This
file does not include any Clang's C++ headers. Instead, C types and C enums are defined
here.
* `src/zig_clang.cpp` - a lightweight wrapper that fulfills the C API on top of the
C++ API. It takes advantage of `static_assert` to make sure we get compile errors when
Clang's C++ API changes. This one file necessarily does include Clang's C++ headers, which
makes it the slowest-to-compile source file in all of Zig's codebase.
* `src-self-hosted/clang.zig` - the Zig equivalent of `src/zig_clang.h`. This is a manually
maintained list of types and functions that are ABI-compatible with the Clang C API we
maintain. In theory this could be generated by running translate-c on `src/zig_clang.h`,
but that would introduce a dependency cycle, since we are using this file to implement
translate-c.
Finally, the actual source code for the translate-c feature is
`src-self-hosted/translate_c.zig`. This code uses the Clang C API exposed by
`src-self-hosted/clang.zig`, and produces Zig AST.
The steps for contributing to translate-c look like this:
1. Identify a test case you want to improve. Add it as a run-translated-c test
case (usually preferable), or as a translate-c test case.
2. Edit `src-self-hosted/translate_c.zig` to improve the behavior.
3. Run the relevant tests: `./zig build test-run-translated-c test-translate-c`

View File

@ -1,7 +1,7 @@
![ZIG](https://ziglang.org/zig-logo.svg)
A general-purpose programming language designed for **robustness**,
**optimality**, and **maintainability**.
A general-purpose programming language and toolchain for maintaining
**robust**, **optimal**, and **reusable** software.
## Resources

View File

@ -20,10 +20,10 @@ pub fn build(b: *Builder) !void {
const rel_zig_exe = try fs.path.relative(b.allocator, b.build_root, b.zig_exe);
const langref_out_path = fs.path.join(
b.allocator,
[_][]const u8{ b.cache_root, "langref.html" },
&[_][]const u8{ b.cache_root, "langref.html" },
) catch unreachable;
var docgen_cmd = docgen_exe.run();
docgen_cmd.addArgs([_][]const u8{
docgen_cmd.addArgs(&[_][]const u8{
rel_zig_exe,
"doc" ++ fs.path.sep_str ++ "langref.html.in",
langref_out_path,
@ -36,7 +36,7 @@ pub fn build(b: *Builder) !void {
const test_step = b.step("test", "Run all the tests");
// find the stage0 build artifacts because we're going to re-use config.h and zig_cpp library
const build_info = try b.exec([_][]const u8{
const build_info = try b.exec(&[_][]const u8{
b.zig_exe,
"BUILD_INFO",
});
@ -54,8 +54,9 @@ pub fn build(b: *Builder) !void {
var test_stage2 = b.addTest("src-self-hosted/test.zig");
test_stage2.setBuildMode(builtin.Mode.Debug);
test_stage2.addPackagePath("stage2_tests", "test/stage2/test.zig");
const fmt_build_zig = b.addFmt([_][]const u8{"build.zig"});
const fmt_build_zig = b.addFmt(&[_][]const u8{"build.zig"});
var exe = b.addExecutable("zig", "src-self-hosted/main.zig");
exe.setBuildMode(mode);
@ -72,9 +73,9 @@ pub fn build(b: *Builder) !void {
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_self_hosted = b.option(bool, "skip-self-hosted", "Main test suite skips building self hosted compiler") orelse false;
if (!skip_self_hosted) {
// TODO re-enable this after https://github.com/ziglang/zig/issues/2377
//test_step.dependOn(&exe.step);
if (!skip_self_hosted and builtin.os == .linux) {
// TODO evented I/O other OS's
test_step.dependOn(&exe.step);
}
const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
@ -87,7 +88,7 @@ pub fn build(b: *Builder) !void {
.source_dir = "lib",
.install_dir = .Lib,
.install_subdir = "zig",
.exclude_extensions = [_][]const u8{ "test.zig", "README.md" },
.exclude_extensions = &[_][]const u8{ "test.zig", "README.md" },
});
const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter");
@ -98,11 +99,7 @@ pub fn build(b: *Builder) !void {
const test_stage2_step = b.step("test-stage2", "Run the stage2 compiler tests");
test_stage2_step.dependOn(&test_stage2.step);
// TODO see https://github.com/ziglang/zig/issues/1364
if (false) {
test_step.dependOn(test_stage2_step);
}
test_step.dependOn(test_stage2_step);
var chosen_modes: [4]builtin.Mode = undefined;
var chosen_mode_index: usize = 0;
@ -140,6 +137,7 @@ pub fn build(b: *Builder) !void {
test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));
test_step.dependOn(tests.addRuntimeSafetyTests(b, test_filter, modes));
test_step.dependOn(tests.addTranslateCTests(b, test_filter));
test_step.dependOn(tests.addRunTranslatedCTests(b, test_filter));
test_step.dependOn(tests.addGenHTests(b, test_filter));
test_step.dependOn(tests.addCompileErrorTests(b, test_filter, modes));
test_step.dependOn(docs_step);
@ -151,16 +149,16 @@ fn dependOnLib(b: *Builder, lib_exe_obj: var, dep: LibraryDep) void {
}
const lib_dir = fs.path.join(
b.allocator,
[_][]const u8{ dep.prefix, "lib" },
&[_][]const u8{ dep.prefix, "lib" },
) catch unreachable;
for (dep.system_libs.toSliceConst()) |lib| {
const static_bare_name = if (mem.eql(u8, lib, "curses"))
([]const u8)("libncurses.a")
@as([]const u8, "libncurses.a")
else
b.fmt("lib{}.a", lib);
b.fmt("lib{}.a", .{lib});
const static_lib_name = fs.path.join(
b.allocator,
[_][]const u8{ lib_dir, static_bare_name },
&[_][]const u8{ lib_dir, static_bare_name },
) catch unreachable;
const have_static = fileExists(static_lib_name) catch unreachable;
if (have_static) {
@ -186,10 +184,10 @@ fn fileExists(filename: []const u8) !bool {
}
fn addCppLib(b: *Builder, lib_exe_obj: var, cmake_binary_dir: []const u8, lib_name: []const u8) void {
lib_exe_obj.addObjectFile(fs.path.join(b.allocator, [_][]const u8{
lib_exe_obj.addObjectFile(fs.path.join(b.allocator, &[_][]const u8{
cmake_binary_dir,
"zig_cpp",
b.fmt("{}{}{}", lib_exe_obj.target.libPrefix(), lib_name, lib_exe_obj.target.staticLibSuffix()),
b.fmt("{}{}{}", .{ lib_exe_obj.target.libPrefix(), lib_name, lib_exe_obj.target.staticLibSuffix() }),
}) catch unreachable);
}
@ -202,22 +200,22 @@ const LibraryDep = struct {
};
fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep {
const shared_mode = try b.exec([_][]const u8{ llvm_config_exe, "--shared-mode" });
const shared_mode = try b.exec(&[_][]const u8{ llvm_config_exe, "--shared-mode" });
const is_static = mem.startsWith(u8, shared_mode, "static");
const libs_output = if (is_static)
try b.exec([_][]const u8{
try b.exec(&[_][]const u8{
llvm_config_exe,
"--libfiles",
"--system-libs",
})
else
try b.exec([_][]const u8{
try b.exec(&[_][]const u8{
llvm_config_exe,
"--libs",
});
const includes_output = try b.exec([_][]const u8{ llvm_config_exe, "--includedir" });
const libdir_output = try b.exec([_][]const u8{ llvm_config_exe, "--libdir" });
const prefix_output = try b.exec([_][]const u8{ llvm_config_exe, "--prefix" });
const includes_output = try b.exec(&[_][]const u8{ llvm_config_exe, "--includedir" });
const libdir_output = try b.exec(&[_][]const u8{ llvm_config_exe, "--libdir" });
const prefix_output = try b.exec(&[_][]const u8{ llvm_config_exe, "--prefix" });
var result = LibraryDep{
.prefix = mem.tokenize(prefix_output, " \r\n").next().?,
@ -235,6 +233,9 @@ fn findLLVM(b: *Builder, llvm_config_exe: []const u8) !LibraryDep {
if (fs.path.isAbsolute(lib_arg)) {
try result.libs.append(lib_arg);
} else {
if (mem.endsWith(u8, lib_arg, ".lib")) {
lib_arg = lib_arg[0 .. lib_arg.len - 4];
}
try result.system_libs.append(lib_arg);
}
}
@ -341,16 +342,16 @@ fn addCxxKnownPath(
objname: []const u8,
errtxt: ?[]const u8,
) !void {
const path_padded = try b.exec([_][]const u8{
const path_padded = try b.exec(&[_][]const u8{
ctx.cxx_compiler,
b.fmt("-print-file-name={}", objname),
b.fmt("-print-file-name={}", .{objname}),
});
const path_unpadded = mem.tokenize(path_padded, "\r\n").next().?;
if (mem.eql(u8, path_unpadded, objname)) {
if (errtxt) |msg| {
warn("{}", msg);
warn("{}", .{msg});
} else {
warn("Unable to determine path to {}\n", objname);
warn("Unable to determine path to {}\n", .{objname});
}
return error.RequiredLibraryNotFound;
}
@ -373,6 +374,7 @@ fn addLibUserlandStep(b: *Builder, mode: builtin.Mode) void {
artifact.bundle_compiler_rt = true;
artifact.setTarget(builtin.arch, builtin.os, builtin.abi);
artifact.setBuildMode(mode);
artifact.force_pic = true;
if (mode != .Debug) {
artifact.strip = true;
}

View File

@ -5,7 +5,7 @@ set -e
BUILDDIR="$(pwd)"
sudo sh -c 'echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" >> /etc/apt/sources.list'
sudo sh -c 'echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main" >> /etc/apt/sources.list'
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update -q
@ -14,6 +14,10 @@ sudo apt-get remove -y llvm-*
sudo rm -rf /usr/local/*
sudo apt-get install -y libxml2-dev libclang-9-dev llvm-9 llvm-9-dev cmake s3cmd gcc-7 g++-7 qemu
# Make the `zig version` number consistent.
# This will affect the cmake command below.
git config core.abbrev 9
export CC=gcc-7
export CXX=g++-7
mkdir build
@ -21,11 +25,12 @@ cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j2 install
./zig build test -Denable-qemu
VERSION="$(./zig version)"
if [ "${BUILD_REASON}" != "PullRequest" ]; then
ARTIFACTSDIR="$BUILDDIR/artifacts"
mkdir "$ARTIFACTSDIR"
docker run -i --mount type=bind,source="$ARTIFACTSDIR",target=/z ziglang/static-base:llvm9-1 -j2 $BUILD_SOURCEVERSION
docker run -i --mount type=bind,source="$ARTIFACTSDIR",target=/z ziglang/static-base:llvm9-x86_64 -j2 $BUILD_SOURCEVERSION
TARBALL="$(ls $ARTIFACTSDIR)"
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$ARTIFACTSDIR/$TARBALL" s3://ziglang.org/builds/
@ -40,7 +45,7 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/linux-$VERSION.json"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/x86_64-linux-$VERSION.json"
# `set -x` causes these variables to be mangled.
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
@ -48,4 +53,5 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
echo "##vso[task.setvariable variable=version;isOutput=true]$VERSION"
fi

View File

@ -8,7 +8,9 @@ system_profiler SPHardwareDataType
brew install s3cmd gcc@8
ZIGDIR="$(pwd)"
CACHE_BASENAME="llvm+clang-10.0.0-macos-x86_64-gcc8-release"
LLVMVER="10.0.0"
ARCH="x86_64"
CACHE_BASENAME="llvm+clang+lld-$LLVMVER-$ARCH-macos-gcc8-release"
PREFIX="$HOME/$CACHE_BASENAME"
TMPDIR="$HOME/tmpz"
JOBS="-j2"
@ -44,18 +46,27 @@ else
rm $PREFIX/lib/libz*dylib
cd $TMPDIR
wget https://releases.llvm.org/10.0.0/llvm-10.0.0.src.tar.xz
tar xf llvm-10.0.0.src.tar.xz
cd llvm-10.0.0.src/
wget https://releases.llvm.org/$LLVMVER/llvm-$LLVMVER.src.tar.xz
tar xf llvm-$LLVMVER.src.tar.xz
cd llvm-$LLVMVER.src/
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_BUILD_TYPE=Release -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF
make $JOBS install
cd $TMPDIR
wget https://releases.llvm.org/10.0.0/cfe-10.0.0.src.tar.xz
tar xf cfe-10.0.0.src.tar.xz
cd cfe-10.0.0.src/
wget https://releases.llvm.org/$LLVMVER/cfe-$LLVMVER.src.tar.xz
tar xf cfe-$LLVMVER.src.tar.xz
cd cfe-$LLVMVER.src/
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_BUILD_TYPE=Release
make $JOBS install
cd $TMPDIR
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVMVER/lld-$LLVMVER.src.tar.xz
tar xf lld-$LLVMVER.src.tar.xz
cd lld-$LLVMVER.src/
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_BUILD_TYPE=Release
@ -68,6 +79,11 @@ else
fi
cd $ZIGDIR
# Make the `zig version` number consistent.
# This will affect the cmake command below.
git config core.abbrev 9
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$(pwd)/release -DZIG_STATIC=ON
@ -81,7 +97,7 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
rmdir release/bin
VERSION=$(release/zig version)
DIRNAME="zig-macos-x86_64-$VERSION"
DIRNAME="zig-macos-$ARCH-$VERSION"
TARBALL="$DIRNAME.tar.xz"
mv release "$DIRNAME"
tar cfJ "$TARBALL" "$DIRNAME"
@ -99,7 +115,7 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/macos-$VERSION.json"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-macos-$VERSION.json"
# `set -x` causes these variables to be mangled.
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html

12
ci/azure/on_master_success Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# We do not set -x because this would leak the oauth access token.
set +x
set -e
sudo apt-get update -y
sudo apt-get install -y curl jq
OAUTH_TOKEN="$(cat "$DOWNLOADSECUREFILE_SECUREFILEPATH")"
./ci/srht/on_master_success "$VERSION" "$OAUTH_TOKEN"

View File

@ -14,7 +14,7 @@ jobs:
displayName: 'Build and test'
- job: BuildLinux
pool:
vmImage: 'ubuntu-16.04'
vmImage: 'ubuntu-18.04'
timeoutInMinutes: 360
@ -44,7 +44,7 @@ jobs:
- script: ci/azure/windows_script.bat
name: main
displayName: 'Build and test'
- job: UpdateDownloadPage
- job: OnMasterSuccess
dependsOn:
- BuildMacOS
- BuildLinux
@ -53,20 +53,12 @@ jobs:
strategy:
maxParallel: 1
pool:
vmImage: 'ubuntu-16.04'
vmImage: 'ubuntu-18.04'
variables:
macos_tarball: $[ dependencies.BuildMacOS.outputs['main.tarball'] ]
macos_shasum: $[ dependencies.BuildMacOS.outputs['main.shasum'] ]
macos_bytesize: $[ dependencies.BuildMacOS.outputs['main.bytesize'] ]
linux_tarball: $[ dependencies.BuildLinux.outputs['main.tarball'] ]
linux_shasum: $[ dependencies.BuildLinux.outputs['main.shasum'] ]
linux_bytesize: $[ dependencies.BuildLinux.outputs['main.bytesize'] ]
windows_tarball: $[ dependencies.BuildWindows.outputs['main.tarball'] ]
windows_shasum: $[ dependencies.BuildWindows.outputs['main.shasum'] ]
windows_bytesize: $[ dependencies.BuildWindows.outputs['main.bytesize'] ]
version: $[ dependencies.BuildLinux.outputs['main.version'] ]
steps:
- task: DownloadSecureFile@1
inputs:
secureFile: s3cfg
- script: ci/azure/update_download_page
displayName: 'Update download page'
secureFile: oauth_token
- script: ci/azure/on_master_success
displayName: 'master branch success hook'

View File

@ -1,41 +0,0 @@
#!/bin/sh
set -x
set -e
SRCDIR=$(pwd)
rm -rf .git
sudo apt-get update -y
sudo apt-get install -y s3cmd curl jq
cd "$HOME"
wget "https://ziglang.org/builds/$LINUX_TARBALL"
tar xf $LINUX_TARBALL
ZIGDIR=$(basename -s .tar.xz $LINUX_TARBALL)
ZIG="$ZIGDIR/zig"
LANGREF="$ZIGDIR/langref.html"
VERSION=$($ZIG version)
SRCTARBALLDIR="zig-$VERSION"
export SRC_TARBALL="$SRCTARBALLDIR.tar.xz"
mv "$SRCDIR" "$SRCTARBALLDIR"
tar cfJ "$SRC_TARBALL" "$SRCTARBALLDIR"
export SRC_SHASUM=$(sha256sum $SRC_TARBALL | cut '-d ' -f1)
export SRC_BYTESIZE=$(wc -c < $SRC_TARBALL)
# the freebsd build has to be there too
FREEBSD_JSON=$(curl --fail "https://ziglang.org/builds/freebsd-$VERSION.json" || exit 1)
export FREEBSD_TARBALL="$(echo "$FREEBSD_JSON" | jq .tarball -r)"
export FREEBSD_BYTESIZE="$(echo "$FREEBSD_JSON" | jq .size -r)"
export FREEBSD_SHASUM="$(echo "$FREEBSD_JSON" | jq .shasum -r)"
git clone https://github.com/ziglang/www.ziglang.org --depth 1
cd www.ziglang.org
export MASTER_DATE=$(date +%Y-%m-%d)
env
"../$ZIG" run update-download-page.zig
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "../$SRC_TARBALL" s3://ziglang.org/builds/
s3cmd put -P "../$LANGREF" s3://ziglang.org/documentation/master/index.html --add-header="Cache-Control: max-age=0, must-revalidate"
s3cmd put -P www/download/index.html s3://ziglang.org/download/index.html --add-header="Cache-Control: max-age=0, must-revalidate"
s3cmd put -P www/download/index.json s3://ziglang.org/download/index.json --add-header="Cache-Control: max-age=0, must-revalidate"

View File

@ -6,5 +6,5 @@ set -e
pacman -Su --needed --noconfirm
pacman -S --needed --noconfirm wget p7zip python3-pip
pip install s3cmd
wget -nv "https://ziglang.org/deps/llvm%2bclang-10.0.0-win64-msvc-release.tar.xz"
wget -nv "https://ziglang.org/deps/llvm%2bclang%2blld-10.0.0-x86_64-windows-msvc-mt.tar.xz"
tar xf llvm+clang-10.0.0-win64-msvc-release.tar.xz

View File

@ -11,15 +11,18 @@ SET "MSYSTEM=%PREVMSYSTEM%"
SET "ZIGBUILDDIR=%SRCROOT%\build"
SET "ZIGINSTALLDIR=%ZIGBUILDDIR%\dist"
SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang-10.0.0-win64-msvc-release"
SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang+lld-10.0.0-x86_64-windows-msvc-mt"
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
REM Make the `zig version` number consistent.
REM This will affect the cmake command below.
git.exe config core.abbrev 9
mkdir %ZIGBUILDDIR%
cd %ZIGBUILDDIR%
REM Here we use MinSizeRel instead of Release to work around https://github.com/ziglang/zig/issues/3024
cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=MinSizeRel || exit /b
msbuild /p:Configuration=MinSizeRel INSTALL.vcxproj || exit /b
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

View File

@ -30,7 +30,7 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/windows-$VERSION.json"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/x86_64-windows-$VERSION.json"
# `set -x` causes these variables to be mangled.
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html

19
ci/drone/drone.yml Normal file
View File

@ -0,0 +1,19 @@
---
kind: pipeline
name: test-aarch64-linux-musl
platform:
arch: arm64
steps:
- name: build-and-test
image: ziglang/static-base:llvm9-1
environment:
SRHT_OAUTH_TOKEN:
from_secret: SRHT_OAUTH_TOKEN
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: AWS_SECRET_ACCESS_KEY
commands:
- ./ci/drone/linux_script

70
ci/drone/linux_script Executable file
View File

@ -0,0 +1,70 @@
#!/bin/sh
set -x
set -e
TRIPLEARCH="$(uname -m)"
BUILDDIR="$(pwd)"
DISTDIR="$(pwd)/dist"
apk update
apk add py3-pip xz perl-utils jq curl
pip3 install s3cmd
# Make the `zig version` number consistent.
# This will affect the cmake command below.
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
make -j$(nproc) install
./zig build test-fmt test-behavior test-std test-compiler-rt -Dskip-release -Dskip-non-native
# TODO test-compare-output is hitting https://github.com/ziglang/zig/issues/3526
./zig build test-standalone test-stack-traces
# TODO test-cli is hitting https://github.com/ziglang/zig/issues/3526
./zig build test-asm-link test-runtime-safety
# TODO test-translate-c is hitting https://github.com/ziglang/zig/issues/3526
./zig build test-gen-h
# TODO test-compile-errors is hitting https://github.com/ziglang/zig/issues/3526
# TODO building docs is hitting https://github.com/ziglang/zig/issues/3526
# TODO full test suite:
#./zig build test
if [ -z "$DRONE_PULL_REQUEST" ]; then
mv ../LICENSE "$DISTDIR/"
# TODO uncomment when the docs are generated
# mv ../zig-cache/langref.html "$DISTDIR/"
mv "$DISTDIR/bin/zig" "$DISTDIR/"
rmdir "$DISTDIR/bin"
GITBRANCH="$DRONE_BRANCH"
VERSION="$("$DISTDIR/zig" version)"
DIRNAME="zig-linux-$TRIPLEARCH-$VERSION"
TARBALL="$DIRNAME.tar.xz"
mv "$DISTDIR" "$DIRNAME"
tar cfJ "$TARBALL" "$DIRNAME"
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1)
BYTESIZE=$(wc -c < $TARBALL)
JSONFILE="$TRIPLEARCH-linux-$GITBRANCH.json"
touch $JSONFILE
echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$TRIPLEARCH-linux-$VERSION.json"
if [ "$GITBRANCH" = "master" ]; then
# avoid leaking oauth token
set +x
cd "$BUILDDIR"
./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN"
fi
fi

View File

@ -13,9 +13,14 @@ wget -nv "https://ziglang.org/builds/$CACHE_BASENAME.tar.xz"
tar xf "$CACHE_BASENAME.tar.xz"
cd $ZIGDIR
# Make the `zig version` number consistent.
# This will affect the cmake command below.
git config core.abbrev 9
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$(pwd)/release -DZIG_STATIC=ON
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX "-DCMAKE_INSTALL_PREFIX=$(pwd)/release" -DZIG_STATIC=ON
make $JOBS install
release/bin/zig build test-fmt
@ -80,5 +85,14 @@ if [ -f ~/.s3cfg ]; then
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/freebsd-$VERSION.json"
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/x86_64-freebsd-$VERSION.json"
if [ "$GITBRANCH" = "master" ]; then
# avoid leaking oauth token
set +x
OAUTH_TOKEN="$(cat ~/.oauth_token)"
cd "$ZIGDIR"
./ci/srht/on_master_success "$VERSION" "$OAUTH_TOKEN"
fi
fi

39
ci/srht/on_master_success Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh
# This script must run on a lot of different platforms.
# It assumes that the following things are installed:
# * curl
# * jq
# * cat
# We do not set -x because this would leak the oauth access token.
set +x
set -e
VERSION="$1"
OAUTH_TOKEN="$2"
YML_FILE="tmp.yml"
cat <<EOF >"$YML_FILE"
image: alpine/latest
packages:
- py3-pip
- curl
- jq
- xz
secrets:
- 6c60aaee-92e7-4e7d-812c-114817689b4d
sources:
- https://github.com/ziglang/zig
tasks:
- build: cd zig && ./ci/srht/update_download_page $VERSION
EOF
jq <$YML_FILE -sR '{
"manifest": .,
}' | curl \
-H Authorization:"token $OAUTH_TOKEN" \
-H Content-Type:application/json \
-X POST \
-d @- "https://builds.sr.ht/api/jobs"

79
ci/srht/update_download_page Executable file
View File

@ -0,0 +1,79 @@
#!/bin/sh
set -x
set -e
VERSION="$1"
SRCDIR="$(pwd)"
NATIVE_TARBALL="zig-linux-$(uname -m)-$VERSION.tar.xz"
# Check for all the builds being completed. It's expected that this script is run several times
# before they are all complete.
AARCH64_LINUX_JSON_URL="https://ziglang.org/builds/aarch64-linux-$VERSION.json"
X86_64_LINUX_JSON_URL="https://ziglang.org/builds/x86_64-linux-$VERSION.json"
X86_64_WINDOWS_JSON_URL="https://ziglang.org/builds/x86_64-windows-$VERSION.json"
X86_64_MACOS_JSON_URL="https://ziglang.org/builds/x86_64-macos-$VERSION.json"
X86_64_FREEBSD_JSON_URL="https://ziglang.org/builds/x86_64-freebsd-$VERSION.json"
# If any of these fail, it's not really this job failing; rather we have detected
# that this job will be called again later when other jobs have completed.
curl --fail -I "$AARCH64_LINUX_JSON_URL" >/dev/null || exit 0
curl --fail -I "$X86_64_LINUX_JSON_URL" >/dev/null || exit 0
curl --fail -I "$X86_64_WINDOWS_JSON_URL" >/dev/null || exit 0
curl --fail -I "$X86_64_MACOS_JSON_URL" >/dev/null || exit 0
curl --fail -I "$X86_64_FREEBSD_JSON_URL" >/dev/null || exit 0
# Without --user, this gave me:
# ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied
pip3 install s3cmd --user
S3CMD="$HOME/.local/bin/s3cmd"
rm -rf .git
cd "$HOME"
wget "https://ziglang.org/builds/$NATIVE_TARBALL"
tar xf "$NATIVE_TARBALL"
ZIGDIR=$(basename $NATIVE_TARBALL .tar.xz)
ZIG="$ZIGDIR/zig"
LANGREF="$ZIGDIR/langref.html"
SRCTARBALLDIR="zig-$VERSION"
export SRC_TARBALL="$SRCTARBALLDIR.tar.xz"
mv "$SRCDIR" "$SRCTARBALLDIR"
tar cfJ "$SRC_TARBALL" "$SRCTARBALLDIR"
export SRC_SHASUM=$(sha256sum $SRC_TARBALL | cut '-d ' -f1)
export SRC_BYTESIZE=$(wc -c < $SRC_TARBALL)
X86_64_WINDOWS_JSON=$(curl --fail "$X86_64_WINDOWS_JSON_URL" || exit 1)
export X86_64_WINDOWS_TARBALL="$(echo "$X86_64_WINDOWS_JSON" | jq .tarball -r)"
export X86_64_WINDOWS_BYTESIZE="$(echo "$X86_64_WINDOWS_JSON" | jq .size -r)"
export X86_64_WINDOWS_SHASUM="$(echo "$X86_64_WINDOWS_JSON" | jq .shasum -r)"
X86_64_MACOS_JSON=$(curl --fail "$X86_64_MACOS_JSON_URL" || exit 1)
export X86_64_MACOS_TARBALL="$(echo "$X86_64_MACOS_JSON" | jq .tarball -r)"
export X86_64_MACOS_BYTESIZE="$(echo "$X86_64_MACOS_JSON" | jq .size -r)"
export X86_64_MACOS_SHASUM="$(echo "$X86_64_MACOS_JSON" | jq .shasum -r)"
X86_64_LINUX_JSON=$(curl --fail "$X86_64_LINUX_JSON_URL" || exit 1)
export X86_64_LINUX_TARBALL="$(echo "$X86_64_LINUX_JSON" | jq .tarball -r)"
export X86_64_LINUX_BYTESIZE="$(echo "$X86_64_LINUX_JSON" | jq .size -r)"
export X86_64_LINUX_SHASUM="$(echo "$X86_64_LINUX_JSON" | jq .shasum -r)"
AARCH64_LINUX_JSON=$(curl --fail "$AARCH64_LINUX_JSON_URL" || exit 1)
export AARCH64_LINUX_TARBALL="$(echo "$AARCH64_LINUX_JSON" | jq .tarball -r)"
export AARCH64_LINUX_BYTESIZE="$(echo "$AARCH64_LINUX_JSON" | jq .size -r)"
export AARCH64_LINUX_SHASUM="$(echo "$AARCH64_LINUX_JSON" | jq .shasum -r)"
X86_64_FREEBSD_JSON=$(curl --fail "$X86_64_FREEBSD_JSON_URL" || exit 1)
export X86_64_FREEBSD_TARBALL="$(echo "$X86_64_FREEBSD_JSON" | jq .tarball -r)"
export X86_64_FREEBSD_BYTESIZE="$(echo "$X86_64_FREEBSD_JSON" | jq .size -r)"
export X86_64_FREEBSD_SHASUM="$(echo "$X86_64_FREEBSD_JSON" | jq .shasum -r)"
git clone https://github.com/ziglang/www.ziglang.org --depth 1
cd www.ziglang.org
export MASTER_DATE="$(date +%Y-%m-%d)"
"../$ZIG" run update-download-page.zig
$S3CMD put -P --no-mime-magic --add-header="cache-control: public, max-age=31536000, immutable" "../$SRC_TARBALL" s3://ziglang.org/builds/
$S3CMD put -P --no-mime-magic "../$LANGREF" s3://ziglang.org/documentation/master/index.html --add-header="Cache-Control: max-age=0, must-revalidate"
$S3CMD put -P --no-mime-magic www/download/index.html s3://ziglang.org/download/index.html --add-header="Cache-Control: max-age=0, must-revalidate"
$S3CMD put -P --no-mime-magic www/download/index.json s3://ziglang.org/download/index.json --add-header="Cache-Control: max-age=0, must-revalidate"

View File

@ -0,0 +1,13 @@
if(MSVC)
set(CMAKE_C_FLAGS_DEBUG_INIT
"/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
set(CMAKE_C_FLAGS_MINSIZEREL_INIT
"/MT /O1 /Ob1 /D NDEBUG")
set(CMAKE_C_FLAGS_RELEASE_INIT
"/MT /O2 /Ob1 /D NDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT
"/MT /Zi /O2 /Ob1 /D NDEBUG")
endif()

View File

@ -0,0 +1,13 @@
if(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG_INIT
"/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT
"/MT /O1 /Ob1 /D NDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE_INIT
"/MT /O2 /Ob1 /D NDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT
"/MT /Zi /O2 /Ob1 /D NDEBUG")
endif()

View File

@ -10,13 +10,13 @@ const testing = std.testing;
const max_doc_file_size = 10 * 1024 * 1024;
const exe_ext = std.build.Target(std.build.Target.Native).exeFileExt();
const obj_ext = std.build.Target(std.build.Target.Native).oFileExt();
const exe_ext = @as(std.build.Target, std.build.Target.Native).exeFileExt();
const obj_ext = @as(std.build.Target, std.build.Target.Native).oFileExt();
const tmp_dir_name = "docgen_tmp";
const test_out_path = tmp_dir_name ++ fs.path.sep_str ++ "test" ++ exe_ext;
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.direct_allocator);
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = &arena.allocator;
@ -51,7 +51,7 @@ pub fn main() !void {
var toc = try genToc(allocator, &tokenizer);
try fs.makePath(allocator, tmp_dir_name);
defer fs.deleteTree(allocator, tmp_dir_name) catch {};
defer fs.deleteTree(tmp_dir_name) catch {};
try genHtml(allocator, &tokenizer, &toc, &buffered_out_stream.stream, zig_exe);
try buffered_out_stream.flush();
@ -215,32 +215,33 @@ const Tokenizer = struct {
}
};
fn parseError(tokenizer: *Tokenizer, token: Token, comptime fmt: []const u8, args: ...) anyerror {
fn parseError(tokenizer: *Tokenizer, token: Token, comptime fmt: []const u8, args: var) anyerror {
const loc = tokenizer.getTokenLocation(token);
warn("{}:{}:{}: error: " ++ fmt ++ "\n", tokenizer.source_file_name, loc.line + 1, loc.column + 1, args);
const args_prefix = .{ tokenizer.source_file_name, loc.line + 1, loc.column + 1 };
warn("{}:{}:{}: error: " ++ fmt ++ "\n", args_prefix ++ args);
if (loc.line_start <= loc.line_end) {
warn("{}\n", tokenizer.buffer[loc.line_start..loc.line_end]);
warn("{}\n", .{tokenizer.buffer[loc.line_start..loc.line_end]});
{
var i: usize = 0;
while (i < loc.column) : (i += 1) {
warn(" ");
warn(" ", .{});
}
}
{
const caret_count = token.end - token.start;
var i: usize = 0;
while (i < caret_count) : (i += 1) {
warn("~");
warn("~", .{});
}
}
warn("\n");
warn("\n", .{});
}
return error.ParseError;
}
fn assertToken(tokenizer: *Tokenizer, token: Token, id: Token.Id) !void {
if (token.id != id) {
return parseError(tokenizer, token, "expected {}, found {}", @tagName(id), @tagName(token.id));
return parseError(tokenizer, token, "expected {}, found {}", .{ @tagName(id), @tagName(token.id) });
}
}
@ -339,7 +340,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
switch (token.id) {
Token.Id.Eof => {
if (header_stack_size != 0) {
return parseError(tokenizer, token, "unbalanced headers");
return parseError(tokenizer, token, "unbalanced headers", .{});
}
try toc.write(" </ul>\n");
break;
@ -370,13 +371,18 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
.Separator => continue,
.TagContent => {
const param = tokenizer.buffer[bracket_tok.start..bracket_tok.end];
if (mem.eql(u8, param, "3col")) {
columns = 3;
if (mem.eql(u8, param, "2col")) {
columns = 2;
} else {
return parseError(tokenizer, bracket_tok, "unrecognized header_open param: {}", param);
return parseError(
tokenizer,
bracket_tok,
"unrecognized header_open param: {}",
.{param},
);
}
},
else => return parseError(tokenizer, bracket_tok, "invalid header_open token"),
else => return parseError(tokenizer, bracket_tok, "invalid header_open token", .{}),
}
}
@ -391,15 +397,15 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
},
});
if (try urls.put(urlized, tag_token)) |entry| {
parseError(tokenizer, tag_token, "duplicate header url: #{}", urlized) catch {};
parseError(tokenizer, entry.value, "other tag here") catch {};
parseError(tokenizer, tag_token, "duplicate header url: #{}", .{urlized}) catch {};
parseError(tokenizer, entry.value, "other tag here", .{}) catch {};
return error.ParseError;
}
if (last_action == Action.Open) {
try toc.writeByte('\n');
try toc.writeByteNTimes(' ', header_stack_size * 4);
if (last_columns) |n| {
try toc.print("<ul style=\"columns: {}\">\n", n);
try toc.print("<ul style=\"columns: {}\">\n", .{n});
} else {
try toc.write("<ul>\n");
}
@ -408,10 +414,10 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
}
last_columns = columns;
try toc.writeByteNTimes(' ', 4 + header_stack_size * 4);
try toc.print("<li><a id=\"toc-{}\" href=\"#{}\">{}</a>", urlized, urlized, content);
try toc.print("<li><a id=\"toc-{}\" href=\"#{}\">{}</a>", .{ urlized, urlized, content });
} else if (mem.eql(u8, tag_name, "header_close")) {
if (header_stack_size == 0) {
return parseError(tokenizer, tag_token, "unbalanced close header");
return parseError(tokenizer, tag_token, "unbalanced close header", .{});
}
header_stack_size -= 1;
_ = try eatToken(tokenizer, Token.Id.BracketClose);
@ -442,7 +448,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
try nodes.append(Node{ .SeeAlso = list.toOwnedSlice() });
break;
},
else => return parseError(tokenizer, see_also_tok, "invalid see_also token"),
else => return parseError(tokenizer, see_also_tok, "invalid see_also token", .{}),
}
}
} else if (mem.eql(u8, tag_name, "link")) {
@ -459,7 +465,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
_ = try eatToken(tokenizer, Token.Id.BracketClose);
break :blk tokenizer.buffer[explicit_text.start..explicit_text.end];
},
else => return parseError(tokenizer, tok, "invalid link token"),
else => return parseError(tokenizer, tok, "invalid link token", .{}),
}
};
@ -482,7 +488,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
_ = try eatToken(tokenizer, Token.Id.BracketClose);
},
Token.Id.BracketClose => {},
else => return parseError(tokenizer, token, "invalid token"),
else => return parseError(tokenizer, token, "invalid token", .{}),
}
const code_kind_str = tokenizer.buffer[code_kind_tok.start..code_kind_tok.end];
var code_kind_id: Code.Id = undefined;
@ -512,7 +518,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
code_kind_id = Code.Id{ .Obj = null };
is_inline = true;
} else {
return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {}", code_kind_str);
return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {}", .{code_kind_str});
}
var mode = builtin.Mode.Debug;
@ -550,7 +556,12 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
_ = try eatToken(tokenizer, Token.Id.BracketClose);
break content_tok;
} else {
return parseError(tokenizer, end_code_tag, "invalid token inside code_begin: {}", end_tag_name);
return parseError(
tokenizer,
end_code_tag,
"invalid token inside code_begin: {}",
.{end_tag_name},
);
}
_ = try eatToken(tokenizer, Token.Id.BracketClose);
} else
@ -575,15 +586,20 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
const end_syntax_tag = try eatToken(tokenizer, Token.Id.TagContent);
const end_tag_name = tokenizer.buffer[end_syntax_tag.start..end_syntax_tag.end];
if (!mem.eql(u8, end_tag_name, "endsyntax")) {
return parseError(tokenizer, end_syntax_tag, "invalid token inside syntax: {}", end_tag_name);
return parseError(
tokenizer,
end_syntax_tag,
"invalid token inside syntax: {}",
.{end_tag_name},
);
}
_ = try eatToken(tokenizer, Token.Id.BracketClose);
try nodes.append(Node{ .Syntax = content_tok });
} else {
return parseError(tokenizer, tag_token, "unrecognized tag name: {}", tag_name);
return parseError(tokenizer, tag_token, "unrecognized tag name: {}", .{tag_name});
}
},
else => return parseError(tokenizer, token, "invalid token"),
else => return parseError(tokenizer, token, "invalid token", .{}),
}
}
@ -729,7 +745,7 @@ fn termColor(allocator: *mem.Allocator, input: []const u8) ![]u8 {
try out.write("</span>");
}
if (first_number != 0 or second_number != 0) {
try out.print("<span class=\"t{}_{}\">", first_number, second_number);
try out.print("<span class=\"t{}_{}\">", .{ first_number, second_number });
open_span_count += 1;
}
},
@ -802,6 +818,7 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok
.Keyword_resume,
.Keyword_return,
.Keyword_linksection,
.Keyword_callconv,
.Keyword_stdcallcc,
.Keyword_struct,
.Keyword_suspend,
@ -856,6 +873,7 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok
.LineComment,
.DocComment,
.ContainerDocComment,
.ShebangLine,
=> {
try out.write("<span class=\"tok-comment\">");
@ -917,6 +935,7 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok
.LBracket,
.RBracket,
.Period,
.PeriodAsterisk,
.Ellipsis2,
.Ellipsis3,
.Caret,
@ -952,14 +971,13 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok
.AngleBracketAngleBracketRight,
.AngleBracketAngleBracketRightEqual,
.Tilde,
.BracketStarBracket,
.BracketStarCBracket,
=> try writeEscaped(out, src[token.start..token.end]),
.Invalid, .Invalid_ampersands => return parseError(
docgen_tokenizer,
source_token,
"syntax error",
.{},
),
}
index = token.end;
@ -987,9 +1005,9 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
},
Node.Link => |info| {
if (!toc.urls.contains(info.url)) {
return parseError(tokenizer, info.token, "url not found: {}", info.url);
return parseError(tokenizer, info.token, "url not found: {}", .{info.url});
}
try out.print("<a href=\"#{}\">{}</a>", info.url, info.name);
try out.print("<a href=\"#{}\">{}</a>", .{ info.url, info.name });
},
Node.Nav => {
try out.write(toc.toc);
@ -1002,12 +1020,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
Node.HeaderOpen => |info| {
try out.print(
"<h{} id=\"{}\"><a href=\"#toc-{}\">{}</a> <a class=\"hdr\" href=\"#{}\">§</a></h{}>\n",
info.n,
info.url,
info.url,
info.name,
info.url,
info.n,
.{ info.n, info.url, info.url, info.name, info.url, info.n },
);
},
Node.SeeAlso => |items| {
@ -1015,9 +1028,9 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
for (items) |item| {
const url = try urlize(allocator, item.name);
if (!toc.urls.contains(url)) {
return parseError(tokenizer, item.token, "url not found: {}", url);
return parseError(tokenizer, item.token, "url not found: {}", .{url});
}
try out.print("<li><a href=\"#{}\">{}</a></li>\n", url, item.name);
try out.print("<li><a href=\"#{}\">{}</a></li>\n", .{ url, item.name });
}
try out.write("</ul>\n");
},
@ -1026,29 +1039,29 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
},
Node.Code => |code| {
code_progress_index += 1;
warn("docgen example code {}/{}...", code_progress_index, tokenizer.code_node_count);
warn("docgen example code {}/{}...", .{ code_progress_index, tokenizer.code_node_count });
const raw_source = tokenizer.buffer[code.source_token.start..code.source_token.end];
const trimmed_raw_source = mem.trim(u8, raw_source, " \n");
if (!code.is_inline) {
try out.print("<p class=\"file\">{}.zig</p>", code.name);
try out.print("<p class=\"file\">{}.zig</p>", .{code.name});
}
try out.write("<pre>");
try tokenizeAndPrint(tokenizer, out, code.source_token);
try out.write("</pre>");
const name_plus_ext = try std.fmt.allocPrint(allocator, "{}.zig", code.name);
const name_plus_ext = try std.fmt.allocPrint(allocator, "{}.zig", .{code.name});
const tmp_source_file_name = try fs.path.join(
allocator,
[_][]const u8{ tmp_dir_name, name_plus_ext },
&[_][]const u8{ tmp_dir_name, name_plus_ext },
);
try io.writeFile(tmp_source_file_name, trimmed_raw_source);
switch (code.id) {
Code.Id.Exe => |expected_outcome| code_block: {
const name_plus_bin_ext = try std.fmt.allocPrint(allocator, "{}{}", code.name, exe_ext);
const name_plus_bin_ext = try std.fmt.allocPrint(allocator, "{}{}", .{ code.name, exe_ext });
var build_args = std.ArrayList([]const u8).init(allocator);
defer build_args.deinit();
try build_args.appendSlice([_][]const u8{
try build_args.appendSlice(&[_][]const u8{
zig_exe,
"build-exe",
tmp_source_file_name,
@ -1059,40 +1072,40 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
"--cache",
"on",
});
try out.print("<pre><code class=\"shell\">$ zig build-exe {}.zig", code.name);
try out.print("<pre><code class=\"shell\">$ zig build-exe {}.zig", .{code.name});
switch (code.mode) {
builtin.Mode.Debug => {},
builtin.Mode.ReleaseSafe => {
try build_args.append("--release-safe");
try out.print(" --release-safe");
try out.print(" --release-safe", .{});
},
builtin.Mode.ReleaseFast => {
try build_args.append("--release-fast");
try out.print(" --release-fast");
try out.print(" --release-fast", .{});
},
builtin.Mode.ReleaseSmall => {
try build_args.append("--release-small");
try out.print(" --release-small");
try out.print(" --release-small", .{});
},
}
for (code.link_objects) |link_object| {
const name_with_ext = try std.fmt.allocPrint(allocator, "{}{}", link_object, obj_ext);
const name_with_ext = try std.fmt.allocPrint(allocator, "{}{}", .{ link_object, obj_ext });
const full_path_object = try fs.path.join(
allocator,
[_][]const u8{ tmp_dir_name, name_with_ext },
&[_][]const u8{ tmp_dir_name, name_with_ext },
);
try build_args.append("--object");
try build_args.append(full_path_object);
try out.print(" --object {}", name_with_ext);
try out.print(" --object {}", .{name_with_ext});
}
if (code.link_libc) {
try build_args.append("-lc");
try out.print(" -lc");
try out.print(" -lc", .{});
}
if (code.target_str) |triple| {
try build_args.appendSlice([_][]const u8{ "-target", triple });
try build_args.appendSlice(&[_][]const u8{ "-target", triple });
if (!code.is_inline) {
try out.print(" -target {}", triple);
try out.print(" -target {}", .{triple});
}
}
if (expected_outcome == .BuildFail) {
@ -1106,29 +1119,29 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
switch (result.term) {
.Exited => |exit_code| {
if (exit_code == 0) {
warn("{}\nThe following command incorrectly succeeded:\n", result.stderr);
warn("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
for (build_args.toSliceConst()) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
return parseError(tokenizer, code.source_token, "example incorrectly compiled");
warn("\n", .{});
return parseError(tokenizer, code.source_token, "example incorrectly compiled", .{});
}
},
else => {
warn("{}\nThe following command crashed:\n", result.stderr);
warn("{}\nThe following command crashed:\n", .{result.stderr});
for (build_args.toSliceConst()) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
return parseError(tokenizer, code.source_token, "example compile crashed");
warn("\n", .{});
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
},
}
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const colored_stderr = try termColor(allocator, escaped_stderr);
try out.print("\n{}</code></pre>\n", colored_stderr);
try out.print("\n{}</code></pre>\n", .{colored_stderr});
break :code_block;
}
const exec_result = exec(allocator, &env_map, build_args.toSliceConst()) catch return parseError(tokenizer, code.source_token, "example failed to compile");
const exec_result = exec(allocator, &env_map, build_args.toSliceConst()) catch return parseError(tokenizer, code.source_token, "example failed to compile", .{});
if (code.target_str) |triple| {
if (mem.startsWith(u8, triple, "wasm32") or
@ -1137,13 +1150,13 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
(builtin.os != .linux or builtin.arch != .x86_64))
{
// skip execution
try out.print("</code></pre>\n");
try out.print("</code></pre>\n", .{});
break :code_block;
}
}
const path_to_exe = mem.trim(u8, exec_result.stdout, " \r\n");
const run_args = [_][]const u8{path_to_exe};
const run_args = &[_][]const u8{path_to_exe};
var exited_with_signal = false;
@ -1152,12 +1165,12 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
switch (result.term) {
.Exited => |exit_code| {
if (exit_code == 0) {
warn("{}\nThe following command incorrectly succeeded:\n", result.stderr);
warn("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
for (run_args) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
return parseError(tokenizer, code.source_token, "example incorrectly compiled");
warn("\n", .{});
return parseError(tokenizer, code.source_token, "example incorrectly compiled", .{});
}
},
.Signal => exited_with_signal = true,
@ -1165,7 +1178,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
}
break :blk result;
} else blk: {
break :blk exec(allocator, &env_map, run_args) catch return parseError(tokenizer, code.source_token, "example crashed");
break :blk exec(allocator, &env_map, run_args) catch return parseError(tokenizer, code.source_token, "example crashed", .{});
};
const escaped_stderr = try escapeHtml(allocator, result.stderr);
@ -1174,57 +1187,57 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
const colored_stderr = try termColor(allocator, escaped_stderr);
const colored_stdout = try termColor(allocator, escaped_stdout);
try out.print("\n$ ./{}\n{}{}", code.name, colored_stdout, colored_stderr);
try out.print("\n$ ./{}\n{}{}", .{ code.name, colored_stdout, colored_stderr });
if (exited_with_signal) {
try out.print("(process terminated by signal)");
try out.print("(process terminated by signal)", .{});
}
try out.print("</code></pre>\n");
try out.print("</code></pre>\n", .{});
},
Code.Id.Test => {
var test_args = std.ArrayList([]const u8).init(allocator);
defer test_args.deinit();
try test_args.appendSlice([_][]const u8{
try test_args.appendSlice(&[_][]const u8{
zig_exe,
"test",
tmp_source_file_name,
"--cache",
"on",
});
try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);
try out.print("<pre><code class=\"shell\">$ zig test {}.zig", .{code.name});
switch (code.mode) {
builtin.Mode.Debug => {},
builtin.Mode.ReleaseSafe => {
try test_args.append("--release-safe");
try out.print(" --release-safe");
try out.print(" --release-safe", .{});
},
builtin.Mode.ReleaseFast => {
try test_args.append("--release-fast");
try out.print(" --release-fast");
try out.print(" --release-fast", .{});
},
builtin.Mode.ReleaseSmall => {
try test_args.append("--release-small");
try out.print(" --release-small");
try out.print(" --release-small", .{});
},
}
if (code.link_libc) {
try test_args.append("-lc");
try out.print(" -lc");
try out.print(" -lc", .{});
}
if (code.target_str) |triple| {
try test_args.appendSlice([_][]const u8{ "-target", triple });
try out.print(" -target {}", triple);
try test_args.appendSlice(&[_][]const u8{ "-target", triple });
try out.print(" -target {}", .{triple});
}
const result = exec(allocator, &env_map, test_args.toSliceConst()) catch return parseError(tokenizer, code.source_token, "test failed");
const result = exec(allocator, &env_map, test_args.toSliceConst()) catch return parseError(tokenizer, code.source_token, "test failed", .{});
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const escaped_stdout = try escapeHtml(allocator, result.stdout);
try out.print("\n{}{}</code></pre>\n", escaped_stderr, escaped_stdout);
try out.print("\n{}{}</code></pre>\n", .{ escaped_stderr, escaped_stdout });
},
Code.Id.TestError => |error_match| {
var test_args = std.ArrayList([]const u8).init(allocator);
defer test_args.deinit();
try test_args.appendSlice([_][]const u8{
try test_args.appendSlice(&[_][]const u8{
zig_exe,
"test",
"--color",
@ -1233,57 +1246,57 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
"--output-dir",
tmp_dir_name,
});
try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);
try out.print("<pre><code class=\"shell\">$ zig test {}.zig", .{code.name});
switch (code.mode) {
builtin.Mode.Debug => {},
builtin.Mode.ReleaseSafe => {
try test_args.append("--release-safe");
try out.print(" --release-safe");
try out.print(" --release-safe", .{});
},
builtin.Mode.ReleaseFast => {
try test_args.append("--release-fast");
try out.print(" --release-fast");
try out.print(" --release-fast", .{});
},
builtin.Mode.ReleaseSmall => {
try test_args.append("--release-small");
try out.print(" --release-small");
try out.print(" --release-small", .{});
},
}
const result = try ChildProcess.exec(allocator, test_args.toSliceConst(), null, &env_map, max_doc_file_size);
switch (result.term) {
.Exited => |exit_code| {
if (exit_code == 0) {
warn("{}\nThe following command incorrectly succeeded:\n", result.stderr);
warn("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
for (test_args.toSliceConst()) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
return parseError(tokenizer, code.source_token, "example incorrectly compiled");
warn("\n", .{});
return parseError(tokenizer, code.source_token, "example incorrectly compiled", .{});
}
},
else => {
warn("{}\nThe following command crashed:\n", result.stderr);
warn("{}\nThe following command crashed:\n", .{result.stderr});
for (test_args.toSliceConst()) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
return parseError(tokenizer, code.source_token, "example compile crashed");
warn("\n", .{});
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
},
}
if (mem.indexOf(u8, result.stderr, error_match) == null) {
warn("{}\nExpected to find '{}' in stderr", result.stderr, error_match);
return parseError(tokenizer, code.source_token, "example did not have expected compile error");
warn("{}\nExpected to find '{}' in stderr", .{ result.stderr, error_match });
return parseError(tokenizer, code.source_token, "example did not have expected compile error", .{});
}
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const colored_stderr = try termColor(allocator, escaped_stderr);
try out.print("\n{}</code></pre>\n", colored_stderr);
try out.print("\n{}</code></pre>\n", .{colored_stderr});
},
Code.Id.TestSafety => |error_match| {
var test_args = std.ArrayList([]const u8).init(allocator);
defer test_args.deinit();
try test_args.appendSlice([_][]const u8{
try test_args.appendSlice(&[_][]const u8{
zig_exe,
"test",
tmp_source_file_name,
@ -1311,52 +1324,51 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
switch (result.term) {
.Exited => |exit_code| {
if (exit_code == 0) {
warn("{}\nThe following command incorrectly succeeded:\n", result.stderr);
warn("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
for (test_args.toSliceConst()) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
return parseError(tokenizer, code.source_token, "example test incorrectly succeeded");
warn("\n", .{});
return parseError(tokenizer, code.source_token, "example test incorrectly succeeded", .{});
}
},
else => {
warn("{}\nThe following command crashed:\n", result.stderr);
warn("{}\nThe following command crashed:\n", .{result.stderr});
for (test_args.toSliceConst()) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
return parseError(tokenizer, code.source_token, "example compile crashed");
warn("\n", .{});
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
},
}
if (mem.indexOf(u8, result.stderr, error_match) == null) {
warn("{}\nExpected to find '{}' in stderr", result.stderr, error_match);
return parseError(tokenizer, code.source_token, "example did not have expected runtime safety error message");
warn("{}\nExpected to find '{}' in stderr", .{ result.stderr, error_match });
return parseError(tokenizer, code.source_token, "example did not have expected runtime safety error message", .{});
}
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const colored_stderr = try termColor(allocator, escaped_stderr);
try out.print(
"<pre><code class=\"shell\">$ zig test {}.zig{}\n{}</code></pre>\n",
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| {
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 });
const tmp_obj_file_name = try fs.path.join(
allocator,
[_][]const u8{ tmp_dir_name, name_plus_obj_ext },
&[_][]const u8{ tmp_dir_name, name_plus_obj_ext },
);
var build_args = std.ArrayList([]const u8).init(allocator);
defer build_args.deinit();
const name_plus_h_ext = try std.fmt.allocPrint(allocator, "{}.h", code.name);
const name_plus_h_ext = try std.fmt.allocPrint(allocator, "{}.h", .{code.name});
const output_h_file_name = try fs.path.join(
allocator,
[_][]const u8{ tmp_dir_name, name_plus_h_ext },
&[_][]const u8{ tmp_dir_name, name_plus_h_ext },
);
try build_args.appendSlice([_][]const u8{
try build_args.appendSlice(&[_][]const u8{
zig_exe,
"build-obj",
tmp_source_file_name,
@ -1369,7 +1381,7 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
});
if (!code.is_inline) {
try out.print("<pre><code class=\"shell\">$ zig build-obj {}.zig", code.name);
try out.print("<pre><code class=\"shell\">$ zig build-obj {}.zig", .{code.name});
}
switch (code.mode) {
@ -1377,26 +1389,26 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
builtin.Mode.ReleaseSafe => {
try build_args.append("--release-safe");
if (!code.is_inline) {
try out.print(" --release-safe");
try out.print(" --release-safe", .{});
}
},
builtin.Mode.ReleaseFast => {
try build_args.append("--release-fast");
if (!code.is_inline) {
try out.print(" --release-fast");
try out.print(" --release-fast", .{});
}
},
builtin.Mode.ReleaseSmall => {
try build_args.append("--release-small");
if (!code.is_inline) {
try out.print(" --release-small");
try out.print(" --release-small", .{});
}
},
}
if (code.target_str) |triple| {
try build_args.appendSlice([_][]const u8{ "-target", triple });
try out.print(" -target {}", triple);
try build_args.appendSlice(&[_][]const u8{ "-target", triple });
try out.print(" -target {}", .{triple});
}
if (maybe_error_match) |error_match| {
@ -1404,78 +1416,75 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
switch (result.term) {
.Exited => |exit_code| {
if (exit_code == 0) {
warn("{}\nThe following command incorrectly succeeded:\n", result.stderr);
warn("{}\nThe following command incorrectly succeeded:\n", .{result.stderr});
for (build_args.toSliceConst()) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
return parseError(tokenizer, code.source_token, "example build incorrectly succeeded");
warn("\n", .{});
return parseError(tokenizer, code.source_token, "example build incorrectly succeeded", .{});
}
},
else => {
warn("{}\nThe following command crashed:\n", result.stderr);
warn("{}\nThe following command crashed:\n", .{result.stderr});
for (build_args.toSliceConst()) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
return parseError(tokenizer, code.source_token, "example compile crashed");
warn("\n", .{});
return parseError(tokenizer, code.source_token, "example compile crashed", .{});
},
}
if (mem.indexOf(u8, result.stderr, error_match) == null) {
warn("{}\nExpected to find '{}' in stderr", result.stderr, error_match);
return parseError(tokenizer, code.source_token, "example did not have expected compile error message");
warn("{}\nExpected to find '{}' in stderr", .{ result.stderr, error_match });
return parseError(tokenizer, code.source_token, "example did not have expected compile error message", .{});
}
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const colored_stderr = try termColor(allocator, escaped_stderr);
try out.print("\n{}\n", colored_stderr);
if (!code.is_inline) {
try out.print("</code></pre>\n");
}
try out.print("\n{}", .{colored_stderr});
} else {
_ = exec(allocator, &env_map, build_args.toSliceConst()) catch return parseError(tokenizer, code.source_token, "example failed to compile");
_ = exec(allocator, &env_map, build_args.toSliceConst()) catch return parseError(tokenizer, code.source_token, "example failed to compile", .{});
}
if (!code.is_inline) {
try out.print("</code></pre>\n");
try out.print("</code></pre>\n", .{});
}
},
Code.Id.Lib => {
var test_args = std.ArrayList([]const u8).init(allocator);
defer test_args.deinit();
try test_args.appendSlice([_][]const u8{
try test_args.appendSlice(&[_][]const u8{
zig_exe,
"build-lib",
tmp_source_file_name,
"--output-dir",
tmp_dir_name,
});
try out.print("<pre><code class=\"shell\">$ zig build-lib {}.zig", code.name);
try out.print("<pre><code class=\"shell\">$ zig build-lib {}.zig", .{code.name});
switch (code.mode) {
builtin.Mode.Debug => {},
builtin.Mode.ReleaseSafe => {
try test_args.append("--release-safe");
try out.print(" --release-safe");
try out.print(" --release-safe", .{});
},
builtin.Mode.ReleaseFast => {
try test_args.append("--release-fast");
try out.print(" --release-fast");
try out.print(" --release-fast", .{});
},
builtin.Mode.ReleaseSmall => {
try test_args.append("--release-small");
try out.print(" --release-small");
try out.print(" --release-small", .{});
},
}
if (code.target_str) |triple| {
try test_args.appendSlice([_][]const u8{ "-target", triple });
try out.print(" -target {}", triple);
try test_args.appendSlice(&[_][]const u8{ "-target", triple });
try out.print(" -target {}", .{triple});
}
const result = exec(allocator, &env_map, test_args.toSliceConst()) catch return parseError(tokenizer, code.source_token, "test failed");
const result = exec(allocator, &env_map, test_args.toSliceConst()) catch return parseError(tokenizer, code.source_token, "test failed", .{});
const escaped_stderr = try escapeHtml(allocator, result.stderr);
const escaped_stdout = try escapeHtml(allocator, result.stdout);
try out.print("\n{}{}</code></pre>\n", escaped_stderr, escaped_stdout);
try out.print("\n{}{}</code></pre>\n", .{ escaped_stderr, escaped_stdout });
},
}
warn("OK\n");
warn("OK\n", .{});
},
}
}
@ -1486,20 +1495,20 @@ fn exec(allocator: *mem.Allocator, env_map: *std.BufMap, args: []const []const u
switch (result.term) {
.Exited => |exit_code| {
if (exit_code != 0) {
warn("{}\nThe following command exited with code {}:\n", result.stderr, exit_code);
warn("{}\nThe following command exited with code {}:\n", .{ result.stderr, exit_code });
for (args) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
warn("\n", .{});
return error.ChildExitError;
}
},
else => {
warn("{}\nThe following command crashed:\n", result.stderr);
warn("{}\nThe following command crashed:\n", .{result.stderr});
for (args) |arg|
warn("{} ", arg)
warn("{} ", .{arg})
else
warn("\n");
warn("\n", .{});
return error.ChildCrashed;
},
}
@ -1507,7 +1516,7 @@ fn exec(allocator: *mem.Allocator, env_map: *std.BufMap, args: []const []const u
}
fn getBuiltinCode(allocator: *mem.Allocator, env_map: *std.BufMap, zig_exe: []const u8) ![]const u8 {
const result = try exec(allocator, env_map, [_][]const u8{
const result = try exec(allocator, env_map, &[_][]const u8{
zig_exe,
"builtin",
});

File diff suppressed because it is too large Load Diff

391
lib/libc/glibc/LICENSES Normal file
View File

@ -0,0 +1,391 @@
This file contains the copying permission notices for various files in the
GNU C Library distribution that have copyright owners other than the Free
Software Foundation. These notices all require that a copy of the notice
be included in the accompanying documentation and be distributed with
binary distributions of the code, so be sure to include this file along
with any binary distributions derived from the GNU C Library.
All code incorporated from 4.4 BSD is distributed under the following
license:
Copyright (C) 1991 Regents of the University of California.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. [This condition was removed.]
4. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
The DNS resolver code, taken from BIND 4.9.5, is copyrighted by UC
Berkeley, by Digital Equipment Corporation and by Internet Software
Consortium. The DEC portions are under the following license:
Portions Copyright (C) 1993 by Digital Equipment Corporation.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies, and
that the name of Digital Equipment Corporation not be used in
advertising or publicity pertaining to distribution of the document or
software without specific, written prior permission.
THE SOFTWARE IS PROVIDED ``AS IS'' AND DIGITAL EQUIPMENT CORP.
DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
The ISC portions are under the following license:
Portions Copyright (c) 1996-1999 by Internet Software Consortium.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
The Sun RPC support (from rpcsrc-4.0) is covered by the following
license:
Copyright (c) 2010, Oracle America, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of the "Oracle America, Inc." nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The following CMU license covers some of the support code for Mach,
derived from Mach 3.0:
Mach Operating System
Copyright (C) 1991,1990,1989 Carnegie Mellon University
All Rights Reserved.
Permission to use, copy, modify and distribute this software and its
documentation is hereby granted, provided that both the copyright
notice and this permission notice appear in all copies of the
software, derivative works or modified versions, and any portions
thereof, and that both notices appear in supporting documentation.
CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS ``AS IS''
CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
Carnegie Mellon requests users of this software to return to
Software Distribution Coordinator
School of Computer Science
Carnegie Mellon University
Pittsburgh PA 15213-3890
or Software.Distribution@CS.CMU.EDU any improvements or
extensions that they make and grant Carnegie Mellon the rights to
redistribute these changes.
The file if_ppp.h is under the following CMU license:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY AND
CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The following license covers the files from Intel's "Highly Optimized
Mathematical Functions for Itanium" collection:
Intel License Agreement
Copyright (c) 2000, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* The name of Intel Corporation may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The files inet/getnameinfo.c and sysdeps/posix/getaddrinfo.c are copyright
(C) by Craig Metz and are distributed under the following license:
/* The Inner Net License, Version 2.00
The author(s) grant permission for redistribution and use in source and
binary forms, with or without modification, of the software and documentation
provided that the following conditions are met:
0. If you receive a version of the software that is specifically labelled
as not being for redistribution (check the version message and/or README),
you are not permitted to redistribute that version of the software in any
way or form.
1. All terms of the all other applicable copyrights and licenses must be
followed.
2. Redistributions of source code must retain the authors' copyright
notice(s), this list of conditions, and the following disclaimer.
3. Redistributions in binary form must reproduce the authors' copyright
notice(s), this list of conditions, and the following disclaimer in the
documentation and/or other materials provided with the distribution.
4. [The copyright holder has authorized the removal of this clause.]
5. Neither the name(s) of the author(s) nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
If these license terms cause you a real problem, contact the author. */
The file sunrpc/des_impl.c is copyright Eric Young:
Copyright (C) 1992 Eric Young
Collected from libdes and modified for SECURE RPC by Martin Kuck 1994
This file is distributed under the terms of the GNU Lesser General
Public License, version 2.1 or later - see the file COPYING.LIB for details.
If you did not receive a copy of the license with this program, please
see <http://www.gnu.org/licenses/> to obtain a copy.
The file inet/rcmd.c is under a UCB copyright and the following:
Copyright (C) 1998 WIDE Project.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
The file posix/runtests.c is copyright Tom Lord:
Copyright 1995 by Tom Lord
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of the copyright holder not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
Tom Lord DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL TOM LORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
The posix/rxspencer tests are copyright Henry Spencer:
Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved.
This software is not subject to any license of the American Telephone
and Telegraph Company or of the Regents of the University of California.
Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it, subject
to the following restrictions:
1. The author is not responsible for the consequences of use of this
software, no matter how awful, even if they arise from flaws in it.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Since few users ever read sources,
credits must appear in the documentation.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software. Since few users
ever read sources, credits must appear in the documentation.
4. This notice may not be removed or altered.
The file posix/PCRE.tests is copyright University of Cambridge:
Copyright (c) 1997-2003 University of Cambridge
Permission is granted to anyone to use this software for any purpose on any
computer system, and to redistribute it freely, subject to the following
restrictions:
1. This software 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.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. In practice, this means that if you use
PCRE in software that you distribute to others, commercially or
otherwise, you must put a sentence like this
Regular expression support is provided by the PCRE library package,
which is open source software, written by Philip Hazel, and copyright
by the University of Cambridge, England.
somewhere reasonably visible in your documentation and in any relevant
files or online help data or similar. A reference to the ftp site for
the source, that is, to
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
should also be given in the documentation. However, this condition is not
intended to apply to whole chains of software. If package A includes PCRE,
it must acknowledge it, but if package B is software that includes package
A, the condition is not imposed on package B (unless it uses PCRE
independently).
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software.
4. If PCRE is embedded in any software that is released under the GNU
General Purpose Licence (GPL), or Lesser General Purpose Licence (LGPL),
then the terms of that licence shall supersede any condition above with
which it is incompatible.
Files from Sun fdlibm are copyright Sun Microsystems, Inc.:
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Developed at SunPro, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.
Various long double libm functions are copyright Stephen L. Moshier:
Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see
<http://www.gnu.org/licenses/>. */

View File

@ -29,4 +29,12 @@
#define HWCAP_SSBS (1 << 28)
#define HWCAP_SB (1 << 29)
#define HWCAP_PACA (1 << 30)
#define HWCAP_PACG (1UL << 31)
#define HWCAP_PACG (1UL << 31)
#define HWCAP2_DCPODP (1 << 0)
#define HWCAP2_SVE2 (1 << 1)
#define HWCAP2_SVEAES (1 << 2)
#define HWCAP2_SVEPMULL (1 << 3)
#define HWCAP2_SVEBITPERM (1 << 4)
#define HWCAP2_SVESHA3 (1 << 5)
#define HWCAP2_SVESM4 (1 << 6)

View File

@ -1,14 +0,0 @@
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
uid_t cuid;
gid_t cgid;
mode_t mode;
unsigned short __ipc_perm_seq;
unsigned long __pad1;
unsigned long __pad2;
};
#define IPC_64 0

View File

@ -1,2 +0,0 @@
#define _POSIX_V6_LP64_OFF64 1
#define _POSIX_V7_LP64_OFF64 1

View File

@ -1,2 +0,0 @@
#undef __WORDSIZE
#define __WORDSIZE 64

View File

@ -281,6 +281,12 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define SYS_io_setup 0
#define SYS_io_destroy 1
@ -564,4 +570,10 @@
#define SYS_pidfd_send_signal 424
#define SYS_io_uring_setup 425
#define SYS_io_uring_enter 426
#define SYS_io_uring_register 427
#define SYS_io_uring_register 427
#define SYS_open_tree 428
#define SYS_move_mount 429
#define SYS_fsopen 430
#define SYS_fsconfig 431
#define SYS_fsmount 432
#define SYS_fspick 433

View File

@ -50,7 +50,7 @@
* On GCC 4.9 we may always include those headers. On older GCCs, we may do it only if CPU
* features used by them are enabled, so we need to check macros like __SSE__ or __MMX__ first.
*/
#if __MINGW_GNUC_PREREQ(4, 9)
#if __MINGW_GNUC_PREREQ(4, 9) || defined(__clang__)
#define __MINGW_FORCE_SYS_INTRINS
#endif

View File

@ -1,7 +1,7 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define LONG_BIT 64
#define LONG_BIT 32
#endif
#define LONG_MAX 0x7fffffffffffffffL
#define LONG_MAX 0x7fffffffL
#define LLONG_MAX 0x7fffffffffffffffLL

View File

@ -0,0 +1,2 @@
#define _POSIX_V6_ILP32_OFFBIG 1
#define _POSIX_V7_ILP32_OFFBIG 1

View File

@ -0,0 +1,3 @@
#undef __WORDSIZE
#define __WORDSIZE 32
/* FIXME */

View File

@ -1,14 +1,16 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
long __unused1;
time_t sem_ctime;
long __unused2;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
#else
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
unsigned short sem_nsems;
#endif
time_t __unused3;
time_t __unused4;
long __unused3;
long __unused4;
};

View File

@ -0,0 +1,21 @@
/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat {
dev_t st_dev;
int __st_dev_padding;
long __st_ino_truncated;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
int __st_rdev_padding;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
ino_t st_ino;
};

View File

@ -381,6 +381,12 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define __ARM_NR_breakpoint 0x0f0001
#define __ARM_NR_cacheflush 0x0f0002
@ -771,4 +777,10 @@
#define SYS_pidfd_send_signal 424
#define SYS_io_uring_setup 425
#define SYS_io_uring_enter 426
#define SYS_io_uring_register 427
#define SYS_io_uring_register 427
#define SYS_open_tree 428
#define SYS_move_mount 429
#define SYS_fsopen 430
#define SYS_fsconfig 431
#define SYS_fsmount 432
#define SYS_fspick 433

View File

@ -8,6 +8,4 @@ struct ipc_perm {
int __ipc_perm_seq;
long __pad1;
long __pad2;
};
#define IPC_64 0x100
};

View File

@ -0,0 +1 @@
#define IPC_STAT 2

View File

@ -1,7 +1,7 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define LONG_BIT 32
#define LONG_BIT 64
#endif
#define LONG_MAX 0x7fffffffL
#define LONG_MAX 0x7fffffffffffffffL
#define LLONG_MAX 0x7fffffffffffffffLL

View File

@ -8,6 +8,5 @@ struct msqid_ds {
msglen_t msg_qbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
unsigned long __pad1;
unsigned long __pad2;
unsigned long __unused[2];
};

View File

@ -1,2 +1,2 @@
#define _POSIX_V6_ILP32_OFFBIG 1
#define _POSIX_V7_ILP32_OFFBIG 1
#define _POSIX_V6_LP64_OFF64 1
#define _POSIX_V7_LP64_OFF64 1

View File

@ -1,3 +1,2 @@
#undef __WORDSIZE
#define __WORDSIZE 32
/* FIXME */
#define __WORDSIZE 64

View File

@ -1,16 +1,14 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t __unused1;
time_t sem_ctime;
time_t __unused2;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
#else
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
unsigned short sem_nsems;
#endif
time_t __unused3;
time_t __unused4;
long __unused3;
long __unused4;
};

View File

@ -1,21 +1,18 @@
/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat {
dev_t st_dev;
int __st_dev_padding;
long __st_ino_truncated;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
int __st_rdev_padding;
unsigned long __pad;
off_t st_size;
blksize_t st_blksize;
int __pad2;
blkcnt_t st_blocks;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
ino_t st_ino;
unsigned __unused[2];
};

View File

@ -100,6 +100,11 @@ int posix_fallocate(int, off_t, off_t);
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define AT_NO_AUTOMOUNT 0x800
#define AT_EMPTY_PATH 0x1000
#define AT_STATX_SYNC_TYPE 0x6000
#define AT_STATX_SYNC_AS_STAT 0x0000
#define AT_STATX_FORCE_SYNC 0x2000
#define AT_STATX_DONT_SYNC 0x4000
#define AT_RECURSIVE 0x8000
#define FAPPEND O_APPEND
#define FFSYNC O_SYNC

View File

@ -31,6 +31,9 @@ void globfree(glob_t *);
#define GLOB_NOESCAPE 0x40
#define GLOB_PERIOD 0x80
#define GLOB_TILDE 0x1000
#define GLOB_TILDE_CHECK 0x4000
#define GLOB_NOSPACE 1
#define GLOB_ABORTED 2
#define GLOB_NOMATCH 3

View File

@ -76,6 +76,7 @@
#define ETH_P_QINQ2 0x9200
#define ETH_P_QINQ3 0x9300
#define ETH_P_EDSA 0xDADA
#define ETH_P_DSA_8021Q 0xDADB
#define ETH_P_IFE 0xED3E
#define ETH_P_AF_IUCV 0xFBFB

View File

@ -18,10 +18,12 @@ extern "C" {
struct sched_param {
int sched_priority;
int sched_ss_low_priority;
struct timespec sched_ss_repl_period;
struct timespec sched_ss_init_budget;
int sched_ss_max_repl;
int __reserved1;
struct {
time_t __reserved1;
long __reserved2;
} __reserved2[2];
int __reserved3;
};
int sched_get_priority_max(int);
@ -47,6 +49,7 @@ int sched_yield(void);
#define CLONE_FS 0x00000200
#define CLONE_FILES 0x00000400
#define CLONE_SIGHAND 0x00000800
#define CLONE_PIDFD 0x00001000
#define CLONE_PTRACE 0x00002000
#define CLONE_VFORK 0x00004000
#define CLONE_PARENT 0x00008000

View File

@ -71,6 +71,11 @@ int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict);
int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -152,6 +152,7 @@ int ptsname_r(int, char *, size_t);
char *ecvt(double, int, int *, int *);
char *fcvt(double, int, int *, int *);
char *gcvt(double, int, char *);
char *secure_getenv(const char *);
struct __locale_struct;
float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);

View File

@ -22,6 +22,7 @@ extern "C" {
#endif
#include <bits/ipc.h>
#include <bits/ipcstat.h>
#define IPC_CREAT 01000
#define IPC_EXCL 02000
@ -29,7 +30,6 @@ extern "C" {
#define IPC_RMID 0
#define IPC_SET 1
#define IPC_STAT 2
#define IPC_INFO 3
#define IPC_PRIVATE ((key_t) 0)

View File

@ -25,9 +25,9 @@ typedef unsigned long msglen_t;
#define MSG_NOERROR 010000
#define MSG_EXCEPT 020000
#define MSG_STAT 11
#define MSG_STAT (11 | (IPC_STAT & 0x100))
#define MSG_INFO 12
#define MSG_STAT_ANY 13
#define MSG_STAT_ANY (13 | (IPC_STAT & 0x100))
struct msginfo {
int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;

View File

@ -31,9 +31,9 @@ extern "C" {
#define _SEM_SEMUN_UNDEFINED 1
#define SEM_STAT 18
#define SEM_STAT (18 | (IPC_STAT & 0x100))
#define SEM_INFO 19
#define SEM_STAT_ANY 20
#define SEM_STAT_ANY (20 | (IPC_STAT & 0x100))
struct seminfo {
int semmap;

View File

@ -33,9 +33,9 @@ extern "C" {
#define SHM_LOCK 11
#define SHM_UNLOCK 12
#define SHM_STAT 13
#define SHM_STAT (13 | (IPC_STAT & 0x100))
#define SHM_INFO 14
#define SHM_STAT_ANY 15
#define SHM_STAT_ANY (15 | (IPC_STAT & 0x100))
#define SHM_DEST 01000
#define SHM_LOCKED 02000
#define SHM_HUGETLB 04000

View File

@ -176,6 +176,7 @@ long syscall(long, ...);
int execvpe(const char *, char *const [], char *const []);
int issetugid(void);
int getentropy(void *, size_t);
extern int optreset;
#endif
#ifdef _GNU_SOURCE
@ -188,6 +189,7 @@ char *get_current_dir_name(void);
int syncfs(int);
int euidaccess(const char *, int);
int eaccess(const char *, int);
ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned);
#endif
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)

View File

@ -0,0 +1,2 @@
#define _POSIX_V6_ILP32_OFFBIG 1
#define _POSIX_V7_ILP32_OFFBIG 1

View File

@ -0,0 +1,11 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
long __unused1;
time_t sem_ctime;
long __unused2;
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
long __unused3;
long __unused4;
};

View File

@ -0,0 +1,21 @@
/* copied from kernel definition, but with padding replaced
* by the corresponding correctly-sized userspace types. */
struct stat {
dev_t st_dev;
int __st_dev_padding;
long __st_ino_truncated;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
int __st_rdev_padding;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
ino_t st_ino;
};

View File

@ -418,6 +418,12 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define SYS_restart_syscall 0
#define SYS_exit 1
@ -836,4 +842,10 @@
#define SYS_pidfd_send_signal 424
#define SYS_io_uring_setup 425
#define SYS_io_uring_enter 426
#define SYS_io_uring_register 427
#define SYS_io_uring_register 427
#define SYS_open_tree 428
#define SYS_move_mount 429
#define SYS_fsopen 430
#define SYS_fsconfig 431
#define SYS_fsmount 432
#define SYS_fspick 433

View File

@ -1,7 +1,7 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define LONG_BIT 64
#define LONG_BIT 32
#endif
#define LONG_MAX 0x7fffffffffffffffL
#define LONG_MAX 0x7fffffffL
#define LLONG_MAX 0x7fffffffffffffffLL

View File

@ -0,0 +1,2 @@
#define _POSIX_V6_ILP32_OFFBIG 1
#define _POSIX_V7_ILP32_OFFBIG 1

View File

@ -1,14 +0,0 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t sem_ctime;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
#else
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
unsigned short sem_nsems;
#endif
time_t __unused3;
time_t __unused4;
};

View File

@ -400,6 +400,12 @@
#define __NR_io_uring_setup 4425
#define __NR_io_uring_enter 4426
#define __NR_io_uring_register 4427
#define __NR_open_tree 4428
#define __NR_move_mount 4429
#define __NR_fsopen 4430
#define __NR_fsconfig 4431
#define __NR_fsmount 4432
#define __NR_fspick 4433
#define SYS_syscall 4000
#define SYS_exit 4001
@ -802,4 +808,10 @@
#define SYS_pidfd_send_signal 4424
#define SYS_io_uring_setup 4425
#define SYS_io_uring_enter 4426
#define SYS_io_uring_register 4427
#define SYS_io_uring_register 4427
#define SYS_open_tree 4428
#define SYS_move_mount 4429
#define SYS_fsopen 4430
#define SYS_fsconfig 4431
#define SYS_fsmount 4432
#define SYS_fspick 4433

View File

@ -9,6 +9,4 @@ struct ipc_perm {
int __pad1;
unsigned long __unused1;
unsigned long __unused2;
};
#define IPC_64 0x100
};

View File

@ -1,14 +0,0 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t sem_ctime;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
#else
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
unsigned short sem_nsems;
#endif
time_t __unused3;
time_t __unused4;
};

View File

@ -1,6 +1,3 @@
#include <string.h>
#include <bits/alltypes.h>
struct stat {
dev_t st_dev;
int __pad1[3];

View File

@ -330,6 +330,12 @@
#define __NR_io_uring_setup 5425
#define __NR_io_uring_enter 5426
#define __NR_io_uring_register 5427
#define __NR_open_tree 5428
#define __NR_move_mount 5429
#define __NR_fsopen 5430
#define __NR_fsconfig 5431
#define __NR_fsmount 5432
#define __NR_fspick 5433
#define SYS_read 5000
#define SYS_write 5001
@ -662,4 +668,10 @@
#define SYS_pidfd_send_signal 5424
#define SYS_io_uring_setup 5425
#define SYS_io_uring_enter 5426
#define SYS_io_uring_register 5427
#define SYS_io_uring_register 5427
#define SYS_open_tree 5428
#define SYS_move_mount 5429
#define SYS_fsopen 5430
#define SYS_fsconfig 5431
#define SYS_fsmount 5432
#define SYS_fspick 5433

View File

@ -14,11 +14,19 @@ typedef __builtin_va_list __isoc_va_list;
#ifndef __cplusplus
#ifdef __WCHAR_TYPE__
#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
typedef __WCHAR_TYPE__ wchar_t;
#define __DEFINED_wchar_t
#endif
#else
#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t)
typedef long wchar_t;
#define __DEFINED_wchar_t
#endif
#endif
#endif
#if defined(__NEED_float_t) && !defined(__DEFINED_float_t)

View File

@ -9,6 +9,4 @@ struct ipc_perm {
int __pad1;
long long __pad2;
long long __pad3;
};
#define IPC_64 0x100
};

View File

@ -1,7 +1,7 @@
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#define LONG_BIT 64
#define LONG_BIT 32
#endif
#define LONG_MAX 0x7fffffffffffffffL
#define LONG_MAX 0x7fffffffL
#define LLONG_MAX 0x7fffffffffffffffLL

View File

@ -0,0 +1,2 @@
#define _POSIX_V6_ILP32_OFFBIG 1
#define _POSIX_V7_ILP32_OFFBIG 1

View File

@ -0,0 +1,3 @@
#undef __WORDSIZE
#define __WORDSIZE 32
/* FIXME */

View File

@ -407,6 +407,12 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define SYS_restart_syscall 0
#define SYS_exit 1
@ -816,4 +822,10 @@
#define SYS_pidfd_send_signal 424
#define SYS_io_uring_setup 425
#define SYS_io_uring_enter 426
#define SYS_io_uring_register 427
#define SYS_io_uring_register 427
#define SYS_open_tree 428
#define SYS_move_mount 429
#define SYS_fsopen 430
#define SYS_fsconfig 431
#define SYS_fsmount 432
#define SYS_fspick 433

View File

@ -1,10 +1,8 @@
struct pt_regs {
unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, mq;
unsigned long trap, dar, dsisr, result;
};
struct user {
struct pt_regs regs;
struct {
unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, mq;
unsigned long trap, dar, dsisr, result;
} regs;
unsigned long u_tsize, u_dsize, u_ssize;
unsigned long start_code, start_data, start_stack;
long signal;

View File

@ -9,6 +9,4 @@ struct ipc_perm {
int __pad1;
long long __pad2;
long long __pad3;
};
#define IPC_64 0x100
};

View File

@ -1,12 +0,0 @@
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
time_t msg_ctime;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
unsigned long __unused[2];
};

View File

@ -1,2 +0,0 @@
#define _POSIX_V6_LP64_OFF64 1
#define _POSIX_V7_LP64_OFF64 1

View File

@ -1,13 +0,0 @@
#include <endian.h>
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t sem_ctime;
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned short __pad[3], sem_nsems;
#else
unsigned short sem_nsems, __pad[3];
#endif
unsigned long __unused[2];
};

View File

@ -379,6 +379,12 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define SYS_restart_syscall 0
#define SYS_exit 1
@ -760,4 +766,10 @@
#define SYS_pidfd_send_signal 424
#define SYS_io_uring_setup 425
#define SYS_io_uring_enter 426
#define SYS_io_uring_register 427
#define SYS_io_uring_register 427
#define SYS_open_tree 428
#define SYS_move_mount 429
#define SYS_fsopen 430
#define SYS_fsconfig 431
#define SYS_fsmount 432
#define SYS_fspick 433

View File

@ -1,10 +1,8 @@
struct pt_regs {
unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, softe;
unsigned long trap, dar, dsisr, result;
};
struct user {
struct pt_regs regs;
struct {
unsigned long gpr[32], nip, msr, orig_gpr3, ctr, link, xer, ccr, softe;
unsigned long trap, dar, dsisr, result;
} regs;
unsigned long u_tsize, u_dsize, u_ssize;
unsigned long start_code, start_data, start_stack;
long signal;

View File

@ -1,14 +0,0 @@
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
uid_t cuid;
gid_t cgid;
mode_t mode;
unsigned short __ipc_perm_seq;
unsigned long __pad1;
unsigned long __pad2;
};
#define IPC_64 0

View File

@ -1,9 +0,0 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t sem_ctime;
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
time_t __unused3;
time_t __unused4;
};

View File

@ -1,25 +0,0 @@
#define SHMLBA 4096
struct shmid_ds
{
struct ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
time_t shm_dtime;
time_t shm_ctime;
pid_t shm_cpid;
pid_t shm_lpid;
unsigned long shm_nattch;
unsigned long __pad1;
unsigned long __pad2;
};
struct shminfo {
unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
};
struct shm_info {
int __used_ids;
unsigned long shm_tot, shm_rss, shm_swp;
unsigned long __swap_attempts, __swap_successes;
};

View File

@ -6,46 +6,43 @@
# define SIGSTKSZ 8192
#endif
/* gregs[0] holds the program counter. */
typedef unsigned long __riscv_mc_gp_state[32];
struct __riscv_mc_f_ext_state {
unsigned int __f[32];
unsigned int __fcsr;
};
struct __riscv_mc_d_ext_state {
unsigned long long __f[32];
unsigned int __fcsr;
};
struct __riscv_mc_q_ext_state {
unsigned long long __f[64] __attribute__((aligned(16)));
unsigned int __fcsr;
unsigned int __reserved[3];
};
union __riscv_mc_fp_state {
struct __riscv_mc_f_ext_state __f;
struct __riscv_mc_d_ext_state __d;
struct __riscv_mc_q_ext_state __q;
};
typedef struct mcontext_t {
__riscv_mc_gp_state __gregs;
union __riscv_mc_fp_state __fpregs;
} mcontext_t;
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef unsigned long greg_t;
typedef unsigned long gregset_t[32];
struct __riscv_f_ext_state {
unsigned int f[32];
unsigned int fcsr;
};
struct __riscv_d_ext_state {
unsigned long long f[32];
unsigned int fcsr;
};
struct __riscv_q_ext_state {
unsigned long long f[64] __attribute__((aligned(16)));
unsigned int fcsr;
unsigned int reserved[3];
};
union __riscv_fp_state {
struct __riscv_f_ext_state f;
struct __riscv_d_ext_state d;
struct __riscv_q_ext_state q;
};
typedef union __riscv_fp_state fpregset_t;
typedef struct sigcontext {
typedef union __riscv_mc_fp_state fpregset_t;
struct sigcontext {
gregset_t gregs;
fpregset_t fpregs;
} mcontext_t;
#else
typedef struct {
unsigned long gregs[32];
unsigned long long fpregs[66];
} mcontext_t;
};
#endif
struct sigaltstack {
@ -54,10 +51,10 @@ struct sigaltstack {
size_t ss_size;
};
typedef struct __ucontext
typedef struct ucontext_t
{
unsigned long uc_flags;
struct __ucontext *uc_link;
struct ucontext_t *uc_link;
stack_t uc_stack;
sigset_t uc_sigmask;
mcontext_t uc_mcontext;

View File

@ -273,6 +273,21 @@
#define __NR_pkey_mprotect 288
#define __NR_pkey_alloc 289
#define __NR_pkey_free 290
#define __NR_statx 291
#define __NR_io_pgetevents 292
#define __NR_rseq 293
#define __NR_kexec_file_load 294
#define __NR_pidfd_send_signal 424
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define __NR_sysriscv __NR_arch_specific_syscall
#define __NR_riscv_flush_icache (__NR_sysriscv + 15)
#define SYS_io_setup 0
@ -550,5 +565,19 @@
#define SYS_pkey_mprotect 288
#define SYS_pkey_alloc 289
#define SYS_pkey_free 290
#define SYS_statx 291
#define SYS_io_pgetevents 292
#define SYS_rseq 293
#define SYS_kexec_file_load 294
#define SYS_pidfd_send_signal 424
#define SYS_io_uring_setup 425
#define SYS_io_uring_enter 426
#define SYS_io_uring_register 427
#define SYS_open_tree 428
#define SYS_move_mount 429
#define SYS_fsopen 430
#define SYS_fsconfig 431
#define SYS_fsmount 432
#define SYS_fspick 433
#define SYS_sysriscv __NR_arch_specific_syscall
#define SYS_riscv_flush_icache (__NR_sysriscv + 15)

View File

@ -1,43 +1,5 @@
struct user_regs_struct {
unsigned long pc;
unsigned long ra;
unsigned long sp;
unsigned long gp;
unsigned long tp;
unsigned long t0;
unsigned long t1;
unsigned long t2;
unsigned long s0;
unsigned long s1;
unsigned long a0;
unsigned long a1;
unsigned long a2;
unsigned long a3;
unsigned long a4;
unsigned long a5;
unsigned long a6;
unsigned long a7;
unsigned long s2;
unsigned long s3;
unsigned long s4;
unsigned long s5;
unsigned long s6;
unsigned long s7;
unsigned long s8;
unsigned long s9;
unsigned long s10;
unsigned long s11;
unsigned long t3;
unsigned long t4;
unsigned long t5;
unsigned long t6;
};
struct user_fpregs_struct {
double f[32];
unsigned int fcsr;
};
#include <signal.h>
#define ELF_NGREG 32
typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
typedef struct user_fpregs_struct elf_fpregset_t;
typedef union __riscv_mc_fp_state elf_fpregset_t;

View File

@ -1,14 +0,0 @@
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
uid_t cuid;
gid_t cgid;
mode_t mode;
unsigned short __pad1;
unsigned short __ipc_perm_seq;
unsigned long __pad2;
unsigned long __pad3;
};
#define IPC_64 0x100

View File

@ -1,12 +0,0 @@
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
time_t msg_ctime;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
unsigned long __unused[2];
};

View File

@ -1,2 +0,0 @@
#define _POSIX_V6_LP64_OFF64 1
#define _POSIX_V7_LP64_OFF64 1

View File

@ -1,2 +0,0 @@
#undef __WORDSIZE
#define __WORDSIZE 64

View File

@ -1,7 +0,0 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
time_t sem_ctime;
unsigned short __pad[3], sem_nsems;
unsigned long __unused[2];
};

View File

@ -344,6 +344,12 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define SYS_exit 1
#define SYS_fork 2
@ -690,4 +696,10 @@
#define SYS_pidfd_send_signal 424
#define SYS_io_uring_setup 425
#define SYS_io_uring_enter 426
#define SYS_io_uring_register 427
#define SYS_io_uring_register 427
#define SYS_open_tree 428
#define SYS_move_mount 429
#define SYS_fsopen 430
#define SYS_fsconfig 431
#define SYS_fsmount 432
#define SYS_fspick 433

View File

@ -1,13 +0,0 @@
struct ipc_perm {
key_t __ipc_perm_key;
uid_t uid;
gid_t gid;
uid_t cuid;
gid_t cgid;
mode_t mode;
int __ipc_perm_seq;
long __pad1;
long __pad2;
};
#define IPC_64 0

View File

@ -1,12 +0,0 @@
struct msqid_ds {
struct ipc_perm msg_perm;
time_t msg_stime;
time_t msg_rtime;
time_t msg_ctime;
unsigned long msg_cbytes;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
unsigned long __unused[2];
};

View File

@ -1,2 +0,0 @@
#define _POSIX_V6_LP64_OFF64 1
#define _POSIX_V7_LP64_OFF64 1

View File

@ -0,0 +1,11 @@
struct semid_ds {
struct ipc_perm sem_perm;
time_t sem_otime;
long __unused1;
time_t sem_ctime;
long __unused2;
unsigned short sem_nsems;
char __sem_nsems_pad[sizeof(long)-sizeof(short)];
long __unused3;
long __unused4;
};

View File

@ -337,6 +337,12 @@
#define __NR_io_uring_setup 425
#define __NR_io_uring_enter 426
#define __NR_io_uring_register 427
#define __NR_open_tree 428
#define __NR_move_mount 429
#define __NR_fsopen 430
#define __NR_fsconfig 431
#define __NR_fsmount 432
#define __NR_fspick 433
#define SYS_read 0
#define SYS_write 1
@ -676,4 +682,10 @@
#define SYS_pidfd_send_signal 424
#define SYS_io_uring_setup 425
#define SYS_io_uring_enter 426
#define SYS_io_uring_register 427
#define SYS_io_uring_register 427
#define SYS_open_tree 428
#define SYS_move_mount 429
#define SYS_fsopen 430
#define SYS_fsconfig 431
#define SYS_fsmount 432
#define SYS_fspick 433

43
lib/libc/mingw/COPYING Normal file
View File

@ -0,0 +1,43 @@
With exception of certain parts that are prominently marked as being
in the Public Domain, BSD, or LGPL this Software is provided under the
Zope Public License (ZPL) Version 2.1.
Copyright (c) 2009 - 2013 by the mingw-w64 project
See the AUTHORS file for the list of contributors to the mingw-w64 project.
This license has been certified as open source. It has also been designated
as GPL compatible by the Free Software Foundation (FSF).
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions in source code must retain the accompanying copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the accompanying
copyright notice, this list of conditions, and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
3. Names of the copyright holders must not be used to endorse or promote
products derived from this software without prior written permission
from the copyright holders.
4. The right to distribute this software or to use it for any purpose does
not give you the right to use Servicemarks (sm) or Trademarks (tm) of
the copyright holders. Use of them is covered by separate agreement
with the copyright holders.
5. If any files are modified, you must cause the modified files to carry
prominent notices stating that you changed the files and the date of
any change.
Disclaimer
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,65 @@
LIBRARY "bcrypt.dll"
EXPORTS
BCryptAddContextFunction
BCryptAddContextFunctionProvider
BCryptCloseAlgorithmProvider
BCryptConfigureContext
BCryptConfigureContextFunction
BCryptCreateContext
BCryptCreateHash
BCryptCreateMultiHash
BCryptDecrypt
BCryptDeleteContext
BCryptDeriveKey
BCryptDeriveKeyCapi
BCryptDeriveKeyPBKDF2
BCryptDestroyHash
BCryptDestroyKey
BCryptDestroySecret
BCryptDuplicateHash
BCryptDuplicateKey
BCryptEncrypt
BCryptEnumAlgorithms
BCryptEnumContextFunctionProviders
BCryptEnumContextFunctions
BCryptEnumContexts
BCryptEnumProviders
BCryptEnumRegisteredProviders
BCryptExportKey
BCryptFinalizeKeyPair
BCryptFinishHash
BCryptFreeBuffer
BCryptGenRandom
BCryptGenerateKeyPair
BCryptGenerateSymmetricKey
BCryptGetFipsAlgorithmMode
BCryptGetProperty
BCryptHashData
BCryptImportKey
BCryptImportKeyPair
BCryptKeyDerivation
BCryptOpenAlgorithmProvider
BCryptProcessMultiOperations
BCryptQueryContextConfiguration
BCryptQueryContextFunctionConfiguration
BCryptQueryContextFunctionProperty
BCryptQueryProviderRegistration
BCryptRegisterConfigChangeNotify
BCryptRegisterProvider
BCryptRemoveContextFunction
BCryptRemoveContextFunctionProvider
BCryptResolveProviders
BCryptSecretAgreement
BCryptSetAuditingInterface
BCryptSetContextFunctionProperty
BCryptSetProperty
BCryptSignHash
BCryptUnregisterConfigChangeNotify
BCryptUnregisterProvider
BCryptVerifySignature
GetAsymmetricEncryptionInterface
GetCipherInterface
GetHashInterface
GetRngInterface
GetSecretAgreementInterface
GetSignatureInterface

View File

@ -0,0 +1,125 @@
LIBRARY COMCTL32.dll
EXPORTS
MenuHelp
ShowHideMenuCtl
GetEffectiveClientRect
DrawStatusTextA
CreateStatusWindowA
CreateToolbar
CreateMappedBitmap
DPA_LoadStream
DPA_SaveStream
DPA_Merge
CreatePropertySheetPage
MakeDragList
LBItemFromPt
DrawInsert
CreateUpDownControl
InitCommonControls
CreatePropertySheetPageA
CreatePropertySheetPageW
CreateStatusWindow
CreateStatusWindowW
CreateToolbarEx
DestroyPropertySheetPage
DllGetVersion
DllInstall
DrawStatusText
DrawStatusTextW
FlatSB_EnableScrollBar
FlatSB_GetScrollInfo
FlatSB_GetScrollPos
FlatSB_GetScrollProp
FlatSB_GetScrollPropPtr
FlatSB_GetScrollRange
FlatSB_SetScrollInfo
FlatSB_SetScrollPos
FlatSB_SetScrollProp
FlatSB_SetScrollRange
FlatSB_ShowScrollBar
GetMUILanguage
ImageList_Add
ImageList_AddIcon
ImageList_AddMasked
ImageList_BeginDrag
ImageList_Copy
ImageList_Create
ImageList_Destroy
ImageList_DragEnter
ImageList_DragLeave
ImageList_DragMove
ImageList_DragShowNolock
ImageList_Draw
ImageList_DrawEx
ImageList_DrawIndirect
ImageList_Duplicate
ImageList_EndDrag
ImageList_GetBkColor
ImageList_GetDragImage
ImageList_GetFlags
ImageList_GetIcon
ImageList_GetIconSize
ImageList_GetImageCount
ImageList_GetImageInfo
ImageList_GetImageRect
ImageList_LoadImage
ImageList_LoadImageA
ImageList_LoadImageW
ImageList_Merge
ImageList_Read
ImageList_Remove
ImageList_Replace
ImageList_ReplaceIcon
ImageList_SetBkColor
ImageList_SetDragCursorImage
ImageList_SetFilter
ImageList_SetFlags
ImageList_SetIconSize
ImageList_SetImageCount
ImageList_SetOverlayImage
ImageList_Write
InitCommonControlsEx
InitMUILanguage
InitializeFlatSB
LoadIconMetric
PropertySheet
PropertySheetA
PropertySheetW
RegisterClassNameW
UninitializeFlatSB
_TrackMouseEvent
FreeMRUList
Str_SetPtrW
DSA_Create
DSA_Destroy
DSA_GetItem
DSA_GetItemPtr
DSA_InsertItem
DSA_SetItem
DSA_DeleteItem
DSA_DeleteAllItems
DPA_Create
DPA_Destroy
DPA_Grow
DPA_Clone
DPA_GetPtr
DPA_GetPtrIndex
DPA_InsertPtr
DPA_SetPtr
DPA_DeletePtr
DPA_DeleteAllPtrs
DPA_Sort
DPA_Search
DPA_CreateEx
DPA_EnumCallback
DPA_DestroyCallback
DSA_EnumCallback
DSA_DestroyCallback
CreateMRUListW
AddMRUStringW
EnumMRUListW
SetWindowSubclass
RemoveWindowSubclass
DefSubclassProc
TaskDialog
TaskDialogIndirect

View File

@ -0,0 +1,34 @@
;
; Exports of file comdlg32.dll
;
; Autogenerated by gen_exportdef
; Written by Kai Tietz, 2007
;
LIBRARY comdlg32.dll
EXPORTS
ChooseColorA
ChooseColorW
ChooseFontA
ChooseFontW
CommDlgExtendedError
FindTextA
FindTextW
GetFileTitleA
GetFileTitleW
GetOpenFileNameA
GetOpenFileNameW
GetSaveFileNameA
GetSaveFileNameW
LoadAlterBitmap
PageSetupDlgA
PageSetupDlgW
PrintDlgA
PrintDlgExA
PrintDlgExW
PrintDlgW
ReplaceTextA
ReplaceTextW
Ssync_ANSI_UNICODE_Struct_For_WOW
WantArrows
dwLBSubclass
dwOKSubclass

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