| author | |
| committer | |
| log | fc3142aa9a54f014c07aac6ac2aab75f57c5a75f |
| tree | 6c6815cb514bb4045a7061b1224bb0f711d11908 |
| parent | c37afa2811677b7602cdde8120049358c0d8c467 |
| parent | 8f079bad1f623b8da2bf327f7d8fd85cbecd1e39 |
15 files changed, 481 insertions(+), 403 deletions(-)
.github/workflows/ci.yaml+23-18| ... | ... | @@ -15,41 +15,37 @@ jobs: |
| 15 | 15 | - name: Checkout |
| 16 | 16 | uses: actions/checkout@v3 |
| 17 | 17 | - name: Build and Test |
| 18 | run: sh ./ci/linux/build-x86_64-debug.sh | |
| 19 | - name: Print Version | |
| 20 | run: echo "$(build-debug/stage3-debug/bin/zig version)" | |
| 18 | run: sh ci/x86_64-linux-debug.sh | |
| 21 | 19 | x86_64-linux-release: |
| 22 | 20 | runs-on: [self-hosted, Linux, x86_64] |
| 23 | 21 | steps: |
| 24 | 22 | - name: Checkout |
| 25 | 23 | uses: actions/checkout@v3 |
| 26 | 24 | - name: Build and Test |
| 27 | run: sh ./ci/linux/build-x86_64-release.sh | |
| 28 | x86_64-macos: | |
| 29 | runs-on: "macos-11" | |
| 30 | env: | |
| 31 | ARCH: "x86_64" | |
| 25 | run: sh ci/x86_64-linux-release.sh | |
| 26 | aarch64-linux-debug: | |
| 27 | runs-on: [self-hosted, Linux, aarch64] | |
| 32 | 28 | steps: |
| 33 | 29 | - name: Checkout |
| 34 | 30 | uses: actions/checkout@v3 |
| 35 | 31 | - name: Build and Test |
| 36 | run: ./ci/macos/build-x86_64.sh | |
| 37 | x86_64-windows: | |
| 38 | runs-on: windows-latest | |
| 39 | env: | |
| 40 | ARCH: "x86_64" | |
| 32 | run: sh ci/aarch64-linux-debug.sh | |
| 33 | aarch64-linux-release: | |
| 34 | runs-on: [self-hosted, Linux, aarch64] | |
| 41 | 35 | steps: |
| 42 | 36 | - name: Checkout |
| 43 | 37 | uses: actions/checkout@v3 |
| 44 | 38 | - name: Build and Test |
| 45 | run: ./ci/windows/build.ps1 | |
| 46 | aarch64-linux: | |
| 47 | runs-on: [self-hosted, Linux, aarch64] | |
| 39 | run: sh ci/aarch64-linux-release.sh | |
| 40 | x86_64-macos: | |
| 41 | runs-on: "macos-11" | |
| 42 | env: | |
| 43 | ARCH: "x86_64" | |
| 48 | 44 | steps: |
| 49 | 45 | - name: Checkout |
| 50 | 46 | uses: actions/checkout@v3 |
| 51 | 47 | - name: Build and Test |
| 52 | run: sh ./ci/linux/build-aarch64.sh | |
| 48 | run: ci/x86_64-macos.sh | |
| 53 | 49 | aarch64-macos: |
| 54 | 50 | runs-on: [self-hosted, macOS, aarch64] |
| 55 | 51 | env: |
| ... | ... | @@ -58,4 +54,13 @@ jobs: |
| 58 | 54 | - name: Checkout |
| 59 | 55 | uses: actions/checkout@v3 |
| 60 | 56 | - name: Build and Test |
| 61 | run: ./ci/macos/build-aarch64.sh | |
| 57 | run: ci/aarch64-macos.sh | |
| 58 | x86_64-windows: | |
| 59 | runs-on: windows-latest | |
| 60 | env: | |
| 61 | ARCH: "x86_64" | |
| 62 | steps: | |
| 63 | - name: Checkout | |
| 64 | uses: actions/checkout@v3 | |
| 65 | - name: Build and Test | |
| 66 | run: ci/x86_64-windows.ps1 |
ci/aarch64-linux-debug.sh created+66| ... | ... | @@ -0,0 +1,66 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | # Requires cmake ninja-build | |
| 4 | ||
| 5 | set -x | |
| 6 | set -e | |
| 7 | ||
| 8 | ARCH="$(uname -m)" | |
| 9 | TARGET="$ARCH-linux-musl" | |
| 10 | MCPU="baseline" | |
| 11 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" | |
| 12 | PREFIX="$HOME/deps/$CACHE_BASENAME" | |
| 13 | ZIG="$PREFIX/bin/zig" | |
| 14 | ||
| 15 | export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH" | |
| 16 | ||
| 17 | # Make the `zig version` number consistent. | |
| 18 | # This will affect the cmake command below. | |
| 19 | git config core.abbrev 9 | |
| 20 | git fetch --unshallow || true | |
| 21 | git fetch --tags | |
| 22 | ||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 25 | ||
| 26 | rm -rf build-debug | |
| 27 | mkdir build-debug | |
| 28 | cd build-debug | |
| 29 | cmake .. \ | |
| 30 | -DCMAKE_INSTALL_PREFIX="stage3-debug" \ | |
| 31 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 32 | -DCMAKE_BUILD_TYPE=Debug \ | |
| 33 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 34 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 35 | -DZIG_STATIC=ON \ | |
| 36 | -GNinja | |
| 37 | ||
| 38 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 39 | # so that installation and testing do not get affected by them. | |
| 40 | unset CC | |
| 41 | unset CXX | |
| 42 | ||
| 43 | ninja install | |
| 44 | ||
| 45 | echo "Looking for non-conforming code formatting..." | |
| 46 | stage3-debug/bin/zig fmt --check .. \ | |
| 47 | --exclude ../test/cases/ \ | |
| 48 | --exclude ../build-debug | |
| 49 | ||
| 50 | # simultaneously test building self-hosted without LLVM and with 32-bit arm | |
| 51 | stage3-debug/bin/zig build -Dtarget=arm-linux-musleabihf | |
| 52 | ||
| 53 | # TODO: add -fqemu back to this line | |
| 54 | ||
| 55 | stage3-debug/bin/zig build test docs \ | |
| 56 | -fwasmtime \ | |
| 57 | -Dstatic-llvm \ | |
| 58 | -Dtarget=native-native-musl \ | |
| 59 | --search-prefix "$PREFIX" \ | |
| 60 | --zig-lib-dir "$(pwd)/../lib" | |
| 61 | ||
| 62 | # Look for HTML errors. | |
| 63 | tidy --drop-empty-elements no -qe ../zig-cache/langref.html | |
| 64 | ||
| 65 | # Produce the experimental std lib documentation. | |
| 66 | stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib |
ci/aarch64-linux-release.sh created+66| ... | ... | @@ -0,0 +1,66 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | # Requires cmake ninja-build | |
| 4 | ||
| 5 | set -x | |
| 6 | set -e | |
| 7 | ||
| 8 | ARCH="$(uname -m)" | |
| 9 | TARGET="$ARCH-linux-musl" | |
| 10 | MCPU="baseline" | |
| 11 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" | |
| 12 | PREFIX="$HOME/deps/$CACHE_BASENAME" | |
| 13 | ZIG="$PREFIX/bin/zig" | |
| 14 | ||
| 15 | export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH" | |
| 16 | ||
| 17 | # Make the `zig version` number consistent. | |
| 18 | # This will affect the cmake command below. | |
| 19 | git config core.abbrev 9 | |
| 20 | git fetch --unshallow || true | |
| 21 | git fetch --tags | |
| 22 | ||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 25 | ||
| 26 | rm -rf build-release | |
| 27 | mkdir build-release | |
| 28 | cd build-release | |
| 29 | cmake .. \ | |
| 30 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 31 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 32 | -DCMAKE_BUILD_TYPE=Release \ | |
| 33 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 34 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 35 | -DZIG_STATIC=ON \ | |
| 36 | -GNinja | |
| 37 | ||
| 38 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 39 | # so that installation and testing do not get affected by them. | |
| 40 | unset CC | |
| 41 | unset CXX | |
| 42 | ||
| 43 | ninja install | |
| 44 | ||
| 45 | echo "Looking for non-conforming code formatting..." | |
| 46 | stage3-release/bin/zig fmt --check .. \ | |
| 47 | --exclude ../test/cases/ \ | |
| 48 | --exclude ../build-release | |
| 49 | ||
| 50 | # simultaneously test building self-hosted without LLVM and with 32-bit arm | |
| 51 | stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf | |
| 52 | ||
| 53 | # TODO: add -fqemu back to this line | |
| 54 | ||
| 55 | stage3-release/bin/zig build test docs \ | |
| 56 | -fwasmtime \ | |
| 57 | -Dstatic-llvm \ | |
| 58 | -Dtarget=native-native-musl \ | |
| 59 | --search-prefix "$PREFIX" \ | |
| 60 | --zig-lib-dir "$(pwd)/../lib" | |
| 61 | ||
| 62 | # Look for HTML errors. | |
| 63 | tidy --drop-empty-elements no -qe ../zig-cache/langref.html | |
| 64 | ||
| 65 | # Produce the experimental std lib documentation. | |
| 66 | stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib |
ci/aarch64-macos.sh created+47| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | set -x | |
| 4 | set -e | |
| 5 | ||
| 6 | # Script assumes the presence of the following: | |
| 7 | # s3cmd | |
| 8 | ||
| 9 | ZIGDIR="$(pwd)" | |
| 10 | TARGET="$ARCH-macos-none" | |
| 11 | MCPU="baseline" | |
| 12 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" | |
| 13 | PREFIX="$HOME/$CACHE_BASENAME" | |
| 14 | ZIG="$PREFIX/bin/zig" | |
| 15 | ||
| 16 | cd $ZIGDIR | |
| 17 | ||
| 18 | # Make the `zig version` number consistent. | |
| 19 | # This will affect the cmake command below. | |
| 20 | git config core.abbrev 9 | |
| 21 | git fetch --unshallow || true | |
| 22 | git fetch --tags | |
| 23 | ||
| 24 | mkdir build | |
| 25 | cd build | |
| 26 | PATH="$HOME/local/bin:$PATH" cmake .. \ | |
| 27 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 28 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 29 | -DCMAKE_BUILD_TYPE=Release \ | |
| 30 | -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ | |
| 31 | -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ | |
| 32 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 33 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 34 | -DZIG_STATIC=ON \ | |
| 35 | -GNinja | |
| 36 | ||
| 37 | $HOME/local/bin/ninja install | |
| 38 | ||
| 39 | stage3-release/bin/zig build test docs \ | |
| 40 | --zig-lib-dir "$(pwd)/../lib" \ | |
| 41 | -Denable-macos-sdk \ | |
| 42 | -Dstatic-llvm \ | |
| 43 | -Dskip-non-native \ | |
| 44 | --search-prefix "$PREFIX" | |
| 45 | ||
| 46 | # Produce the experimental std lib documentation. | |
| 47 | stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib |
ci/linux/build-aarch64.sh deleted-66| ... | ... | @@ -1,66 +0,0 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | # Requires cmake ninja-build | |
| 4 | ||
| 5 | set -x | |
| 6 | set -e | |
| 7 | ||
| 8 | ARCH="$(uname -m)" | |
| 9 | TARGET="$ARCH-linux-musl" | |
| 10 | MCPU="baseline" | |
| 11 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" | |
| 12 | PREFIX="$HOME/deps/$CACHE_BASENAME" | |
| 13 | ZIG="$PREFIX/bin/zig" | |
| 14 | ||
| 15 | export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH" | |
| 16 | ||
| 17 | # Make the `zig version` number consistent. | |
| 18 | # This will affect the cmake command below. | |
| 19 | git config core.abbrev 9 | |
| 20 | git fetch --unshallow || true | |
| 21 | git fetch --tags | |
| 22 | ||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 25 | ||
| 26 | rm -rf build-release | |
| 27 | mkdir build-release | |
| 28 | cd build-release | |
| 29 | cmake .. \ | |
| 30 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 31 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 32 | -DCMAKE_BUILD_TYPE=Release \ | |
| 33 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 34 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 35 | -DZIG_STATIC=ON \ | |
| 36 | -GNinja | |
| 37 | ||
| 38 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 39 | # so that installation and testing do not get affected by them. | |
| 40 | unset CC | |
| 41 | unset CXX | |
| 42 | ||
| 43 | ninja install | |
| 44 | ||
| 45 | echo "Looking for non-conforming code formatting..." | |
| 46 | stage3-release/bin/zig fmt --check .. \ | |
| 47 | --exclude ../test/cases/ \ | |
| 48 | --exclude ../build-release | |
| 49 | ||
| 50 | # simultaneously test building self-hosted without LLVM and with 32-bit arm | |
| 51 | stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf | |
| 52 | ||
| 53 | # TODO: add -fqemu back to this line | |
| 54 | ||
| 55 | stage3-release/bin/zig build test docs \ | |
| 56 | -fwasmtime \ | |
| 57 | -Dstatic-llvm \ | |
| 58 | -Dtarget=native-native-musl \ | |
| 59 | --search-prefix "$PREFIX" \ | |
| 60 | --zig-lib-dir "$(pwd)/../lib" | |
| 61 | ||
| 62 | # Look for HTML errors. | |
| 63 | tidy --drop-empty-elements no -qe ../zig-cache/langref.html | |
| 64 | ||
| 65 | # Produce the experimental std lib documentation. | |
| 66 | stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib |
ci/linux/build-x86_64-debug.sh deleted-66| ... | ... | @@ -1,66 +0,0 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | # Requires cmake ninja-build | |
| 4 | ||
| 5 | set -x | |
| 6 | set -e | |
| 7 | ||
| 8 | ARCH="$(uname -m)" | |
| 9 | TARGET="$ARCH-linux-musl" | |
| 10 | MCPU="baseline" | |
| 11 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" | |
| 12 | PREFIX="$HOME/deps/$CACHE_BASENAME" | |
| 13 | ZIG="$PREFIX/bin/zig" | |
| 14 | ||
| 15 | export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH" | |
| 16 | ||
| 17 | # Make the `zig version` number consistent. | |
| 18 | # This will affect the cmake command below. | |
| 19 | git config core.abbrev 9 | |
| 20 | git fetch --unshallow || true | |
| 21 | git fetch --tags | |
| 22 | ||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 25 | ||
| 26 | rm -rf build-debug | |
| 27 | mkdir build-debug | |
| 28 | cd build-debug | |
| 29 | cmake .. \ | |
| 30 | -DCMAKE_INSTALL_PREFIX="stage3-debug" \ | |
| 31 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 32 | -DCMAKE_BUILD_TYPE=Debug \ | |
| 33 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 34 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 35 | -DZIG_STATIC=ON \ | |
| 36 | -GNinja | |
| 37 | ||
| 38 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 39 | # so that installation and testing do not get affected by them. | |
| 40 | unset CC | |
| 41 | unset CXX | |
| 42 | ||
| 43 | ninja install | |
| 44 | ||
| 45 | echo "Looking for non-conforming code formatting..." | |
| 46 | stage3-debug/bin/zig fmt --check .. \ | |
| 47 | --exclude ../test/cases/ \ | |
| 48 | --exclude ../build-debug \ | |
| 49 | --exclude ../build-release | |
| 50 | ||
| 51 | # simultaneously test building self-hosted without LLVM and with 32-bit arm | |
| 52 | stage3-debug/bin/zig build -Dtarget=arm-linux-musleabihf | |
| 53 | ||
| 54 | stage3-debug/bin/zig build test docs \ | |
| 55 | -fqemu \ | |
| 56 | -fwasmtime \ | |
| 57 | -Dstatic-llvm \ | |
| 58 | -Dtarget=native-native-musl \ | |
| 59 | --search-prefix "$PREFIX" \ | |
| 60 | --zig-lib-dir "$(pwd)/../lib" | |
| 61 | ||
| 62 | # Look for HTML errors. | |
| 63 | tidy --drop-empty-elements no -qe ../zig-cache/langref.html | |
| 64 | ||
| 65 | # Produce the experimental std lib documentation. | |
| 66 | stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib |
ci/linux/build-x86_64-release.sh deleted-82| ... | ... | @@ -1,82 +0,0 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | # Requires cmake ninja-build | |
| 4 | ||
| 5 | set -x | |
| 6 | set -e | |
| 7 | ||
| 8 | ARCH="$(uname -m)" | |
| 9 | TARGET="$ARCH-linux-musl" | |
| 10 | MCPU="baseline" | |
| 11 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" | |
| 12 | PREFIX="$HOME/deps/$CACHE_BASENAME" | |
| 13 | ZIG="$PREFIX/bin/zig" | |
| 14 | ||
| 15 | export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH" | |
| 16 | ||
| 17 | # Make the `zig version` number consistent. | |
| 18 | # This will affect the cmake command below. | |
| 19 | git config core.abbrev 9 | |
| 20 | git fetch --unshallow || true | |
| 21 | git fetch --tags | |
| 22 | ||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 25 | ||
| 26 | rm -rf build-release | |
| 27 | mkdir build-release | |
| 28 | cd build-release | |
| 29 | cmake .. \ | |
| 30 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 31 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 32 | -DCMAKE_BUILD_TYPE=Release \ | |
| 33 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 34 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 35 | -DZIG_STATIC=ON \ | |
| 36 | -GNinja | |
| 37 | ||
| 38 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 39 | # so that installation and testing do not get affected by them. | |
| 40 | unset CC | |
| 41 | unset CXX | |
| 42 | ||
| 43 | ninja install | |
| 44 | ||
| 45 | echo "Looking for non-conforming code formatting..." | |
| 46 | stage3-release/bin/zig fmt --check .. \ | |
| 47 | --exclude ../test/cases/ \ | |
| 48 | --exclude ../build-debug \ | |
| 49 | --exclude ../build-release | |
| 50 | ||
| 51 | # simultaneously test building self-hosted without LLVM and with 32-bit arm | |
| 52 | stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf | |
| 53 | ||
| 54 | stage3-release/bin/zig build test docs \ | |
| 55 | -fqemu \ | |
| 56 | -fwasmtime \ | |
| 57 | -Dstatic-llvm \ | |
| 58 | -Dtarget=native-native-musl \ | |
| 59 | --search-prefix "$PREFIX" \ | |
| 60 | --zig-lib-dir "$(pwd)/../lib" | |
| 61 | ||
| 62 | # Look for HTML errors. | |
| 63 | tidy --drop-empty-elements no -qe ../zig-cache/langref.html | |
| 64 | ||
| 65 | # Produce the experimental std lib documentation. | |
| 66 | stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib | |
| 67 | ||
| 68 | stage3-release/bin/zig build \ | |
| 69 | --prefix stage4-release \ | |
| 70 | -Denable-llvm \ | |
| 71 | -Denable-stage1 \ | |
| 72 | -Dno-lib \ | |
| 73 | -Drelease \ | |
| 74 | -Dstrip \ | |
| 75 | -Dtarget=$TARGET \ | |
| 76 | -Duse-zig-libcxx \ | |
| 77 | -Dversion-string="$(stage3-release/bin/zig version)" | |
| 78 | ||
| 79 | # diff returns an error code if the files differ. | |
| 80 | echo "If the following command fails, it means nondeterminism has been" | |
| 81 | echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." | |
| 82 | diff stage3-release/bin/zig stage4-release/bin/zig |
ci/macos/build-aarch64.sh deleted-47| ... | ... | @@ -1,47 +0,0 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | set -x | |
| 4 | set -e | |
| 5 | ||
| 6 | # Script assumes the presence of the following: | |
| 7 | # s3cmd | |
| 8 | ||
| 9 | ZIGDIR="$(pwd)" | |
| 10 | TARGET="$ARCH-macos-none" | |
| 11 | MCPU="baseline" | |
| 12 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" | |
| 13 | PREFIX="$HOME/$CACHE_BASENAME" | |
| 14 | ZIG="$PREFIX/bin/zig" | |
| 15 | ||
| 16 | cd $ZIGDIR | |
| 17 | ||
| 18 | # Make the `zig version` number consistent. | |
| 19 | # This will affect the cmake command below. | |
| 20 | git config core.abbrev 9 | |
| 21 | git fetch --unshallow || true | |
| 22 | git fetch --tags | |
| 23 | ||
| 24 | mkdir build | |
| 25 | cd build | |
| 26 | PATH="$HOME/local/bin:$PATH" cmake .. \ | |
| 27 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 28 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 29 | -DCMAKE_BUILD_TYPE=Release \ | |
| 30 | -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ | |
| 31 | -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ | |
| 32 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 33 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 34 | -DZIG_STATIC=ON \ | |
| 35 | -GNinja | |
| 36 | ||
| 37 | $HOME/local/bin/ninja install | |
| 38 | ||
| 39 | stage3-release/bin/zig build test docs \ | |
| 40 | --zig-lib-dir "$(pwd)/../lib" \ | |
| 41 | -Denable-macos-sdk \ | |
| 42 | -Dstatic-llvm \ | |
| 43 | -Dskip-non-native \ | |
| 44 | --search-prefix "$PREFIX" | |
| 45 | ||
| 46 | # Produce the experimental std lib documentation. | |
| 47 | stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib |
ci/macos/build-x86_64.sh deleted-54| ... | ... | @@ -1,54 +0,0 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | set -x | |
| 4 | set -e | |
| 5 | ||
| 6 | # Script assumes the presence of the following: | |
| 7 | # s3cmd | |
| 8 | ||
| 9 | ZIGDIR="$(pwd)" | |
| 10 | TARGET="$ARCH-macos-none" | |
| 11 | MCPU="baseline" | |
| 12 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" | |
| 13 | PREFIX="$HOME/$CACHE_BASENAME" | |
| 14 | JOBS="-j3" | |
| 15 | ||
| 16 | rm -rf $PREFIX | |
| 17 | cd $HOME | |
| 18 | ||
| 19 | curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" | |
| 20 | tar xf "$CACHE_BASENAME.tar.xz" | |
| 21 | ||
| 22 | ZIG="$PREFIX/bin/zig" | |
| 23 | ||
| 24 | cd $ZIGDIR | |
| 25 | ||
| 26 | # Make the `zig version` number consistent. | |
| 27 | # This will affect the cmake command below. | |
| 28 | git config core.abbrev 9 | |
| 29 | git fetch --unshallow || true | |
| 30 | git fetch --tags | |
| 31 | ||
| 32 | mkdir build | |
| 33 | cd build | |
| 34 | cmake .. \ | |
| 35 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 36 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 37 | -DCMAKE_BUILD_TYPE=Release \ | |
| 38 | -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ | |
| 39 | -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ | |
| 40 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 41 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 42 | -DZIG_STATIC=ON | |
| 43 | ||
| 44 | make $JOBS install | |
| 45 | ||
| 46 | stage3-release/bin/zig build test docs \ | |
| 47 | --zig-lib-dir "$(pwd)/../lib" \ | |
| 48 | -Denable-macos-sdk \ | |
| 49 | -Dstatic-llvm \ | |
| 50 | -Dskip-non-native \ | |
| 51 | --search-prefix "$PREFIX" | |
| 52 | ||
| 53 | # Produce the experimental std lib documentation. | |
| 54 | stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib |
ci/windows/build.ps1 deleted-63| ... | ... | @@ -1,63 +0,0 @@ |
| 1 | $TARGET = "$($Env:ARCH)-windows-gnu" | |
| 2 | $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.25+499dddb4c" | |
| 3 | $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" | |
| 4 | ||
| 5 | Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" | |
| 6 | ||
| 7 | Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" | |
| 8 | ||
| 9 | Write-Output "Extracting..." | |
| 10 | ||
| 11 | Add-Type -AssemblyName System.IO.Compression.FileSystem ; | |
| 12 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") | |
| 13 | ||
| 14 | Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib" | |
| 15 | Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release" | |
| 16 | Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" | |
| 17 | ||
| 18 | function CheckLastExitCode { | |
| 19 | if (!$?) { | |
| 20 | exit 1 | |
| 21 | } | |
| 22 | return 0 | |
| 23 | } | |
| 24 | ||
| 25 | # Make the `zig version` number consistent. | |
| 26 | # This will affect the `zig build` command below which uses `git describe`. | |
| 27 | git config core.abbrev 9 | |
| 28 | git fetch --tags | |
| 29 | ||
| 30 | if ((git rev-parse --is-shallow-repository) -eq "true") { | |
| 31 | git fetch --unshallow # `git describe` won't work on a shallow repo | |
| 32 | } | |
| 33 | ||
| 34 | Write-Output "Building Zig..." | |
| 35 | ||
| 36 | & "$ZIGPREFIXPATH\bin\zig.exe" build ` | |
| 37 | --prefix "$ZIGINSTALLDIR" ` | |
| 38 | --search-prefix "$ZIGPREFIXPATH" ` | |
| 39 | --zig-lib-dir "$ZIGLIBDIR" ` | |
| 40 | -Denable-stage1 ` | |
| 41 | -Dstatic-llvm ` | |
| 42 | -Drelease ` | |
| 43 | -Duse-zig-libcxx ` | |
| 44 | -Dtarget="$TARGET" | |
| 45 | CheckLastExitCode | |
| 46 | ||
| 47 | Write-Output " zig build test docs..." | |
| 48 | ||
| 49 | & "$ZIGINSTALLDIR\bin\zig.exe" build test docs ` | |
| 50 | --search-prefix "$ZIGPREFIXPATH" ` | |
| 51 | -Dstatic-llvm ` | |
| 52 | -Dskip-non-native ` | |
| 53 | -Denable-symlinks-windows | |
| 54 | CheckLastExitCode | |
| 55 | ||
| 56 | # Produce the experimental std lib documentation. | |
| 57 | Write-Output "zig test std/std.zig..." | |
| 58 | ||
| 59 | & "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" ` | |
| 60 | --zig-lib-dir "$ZIGLIBDIR" ` | |
| 61 | -femit-docs ` | |
| 62 | -fno-emit-bin | |
| 63 | CheckLastExitCode |
ci/x86_64-linux-debug.sh created+65| ... | ... | @@ -0,0 +1,65 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | # Requires cmake ninja-build | |
| 4 | ||
| 5 | set -x | |
| 6 | set -e | |
| 7 | ||
| 8 | ARCH="$(uname -m)" | |
| 9 | TARGET="$ARCH-linux-musl" | |
| 10 | MCPU="baseline" | |
| 11 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" | |
| 12 | PREFIX="$HOME/deps/$CACHE_BASENAME" | |
| 13 | ZIG="$PREFIX/bin/zig" | |
| 14 | ||
| 15 | export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH" | |
| 16 | ||
| 17 | # Make the `zig version` number consistent. | |
| 18 | # This will affect the cmake command below. | |
| 19 | git config core.abbrev 9 | |
| 20 | git fetch --unshallow || true | |
| 21 | git fetch --tags | |
| 22 | ||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 25 | ||
| 26 | rm -rf build-debug | |
| 27 | mkdir build-debug | |
| 28 | cd build-debug | |
| 29 | cmake .. \ | |
| 30 | -DCMAKE_INSTALL_PREFIX="stage3-debug" \ | |
| 31 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 32 | -DCMAKE_BUILD_TYPE=Debug \ | |
| 33 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 34 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 35 | -DZIG_STATIC=ON \ | |
| 36 | -GNinja | |
| 37 | ||
| 38 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 39 | # so that installation and testing do not get affected by them. | |
| 40 | unset CC | |
| 41 | unset CXX | |
| 42 | ||
| 43 | ninja install | |
| 44 | ||
| 45 | echo "Looking for non-conforming code formatting..." | |
| 46 | stage3-debug/bin/zig fmt --check .. \ | |
| 47 | --exclude ../test/cases/ \ | |
| 48 | --exclude ../build-debug | |
| 49 | ||
| 50 | # simultaneously test building self-hosted without LLVM and with 32-bit arm | |
| 51 | stage3-debug/bin/zig build -Dtarget=arm-linux-musleabihf | |
| 52 | ||
| 53 | stage3-debug/bin/zig build test docs \ | |
| 54 | -fqemu \ | |
| 55 | -fwasmtime \ | |
| 56 | -Dstatic-llvm \ | |
| 57 | -Dtarget=native-native-musl \ | |
| 58 | --search-prefix "$PREFIX" \ | |
| 59 | --zig-lib-dir "$(pwd)/../lib" | |
| 60 | ||
| 61 | # Look for HTML errors. | |
| 62 | tidy --drop-empty-elements no -qe ../zig-cache/langref.html | |
| 63 | ||
| 64 | # Produce the experimental std lib documentation. | |
| 65 | stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib |
ci/x86_64-linux-release.sh created+82| ... | ... | @@ -0,0 +1,82 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | # Requires cmake ninja-build | |
| 4 | ||
| 5 | set -x | |
| 6 | set -e | |
| 7 | ||
| 8 | ARCH="$(uname -m)" | |
| 9 | TARGET="$ARCH-linux-musl" | |
| 10 | MCPU="baseline" | |
| 11 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" | |
| 12 | PREFIX="$HOME/deps/$CACHE_BASENAME" | |
| 13 | ZIG="$PREFIX/bin/zig" | |
| 14 | ||
| 15 | export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH" | |
| 16 | ||
| 17 | # Make the `zig version` number consistent. | |
| 18 | # This will affect the cmake command below. | |
| 19 | git config core.abbrev 9 | |
| 20 | git fetch --unshallow || true | |
| 21 | git fetch --tags | |
| 22 | ||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 25 | ||
| 26 | rm -rf build-release | |
| 27 | mkdir build-release | |
| 28 | cd build-release | |
| 29 | cmake .. \ | |
| 30 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 31 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 32 | -DCMAKE_BUILD_TYPE=Release \ | |
| 33 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 34 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 35 | -DZIG_STATIC=ON \ | |
| 36 | -GNinja | |
| 37 | ||
| 38 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 39 | # so that installation and testing do not get affected by them. | |
| 40 | unset CC | |
| 41 | unset CXX | |
| 42 | ||
| 43 | ninja install | |
| 44 | ||
| 45 | echo "Looking for non-conforming code formatting..." | |
| 46 | stage3-release/bin/zig fmt --check .. \ | |
| 47 | --exclude ../test/cases/ \ | |
| 48 | --exclude ../build-debug \ | |
| 49 | --exclude ../build-release | |
| 50 | ||
| 51 | # simultaneously test building self-hosted without LLVM and with 32-bit arm | |
| 52 | stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf | |
| 53 | ||
| 54 | stage3-release/bin/zig build test docs \ | |
| 55 | -fqemu \ | |
| 56 | -fwasmtime \ | |
| 57 | -Dstatic-llvm \ | |
| 58 | -Dtarget=native-native-musl \ | |
| 59 | --search-prefix "$PREFIX" \ | |
| 60 | --zig-lib-dir "$(pwd)/../lib" | |
| 61 | ||
| 62 | # Look for HTML errors. | |
| 63 | tidy --drop-empty-elements no -qe ../zig-cache/langref.html | |
| 64 | ||
| 65 | # Produce the experimental std lib documentation. | |
| 66 | stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib | |
| 67 | ||
| 68 | stage3-release/bin/zig build \ | |
| 69 | --prefix stage4-release \ | |
| 70 | -Denable-llvm \ | |
| 71 | -Denable-stage1 \ | |
| 72 | -Dno-lib \ | |
| 73 | -Drelease \ | |
| 74 | -Dstrip \ | |
| 75 | -Dtarget=$TARGET \ | |
| 76 | -Duse-zig-libcxx \ | |
| 77 | -Dversion-string="$(stage3-release/bin/zig version)" | |
| 78 | ||
| 79 | # diff returns an error code if the files differ. | |
| 80 | echo "If the following command fails, it means nondeterminism has been" | |
| 81 | echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." | |
| 82 | diff stage3-release/bin/zig stage4-release/bin/zig |
ci/x86_64-macos.sh created+54| ... | ... | @@ -0,0 +1,54 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | set -x | |
| 4 | set -e | |
| 5 | ||
| 6 | # Script assumes the presence of the following: | |
| 7 | # s3cmd | |
| 8 | ||
| 9 | ZIGDIR="$(pwd)" | |
| 10 | TARGET="$ARCH-macos-none" | |
| 11 | MCPU="baseline" | |
| 12 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" | |
| 13 | PREFIX="$HOME/$CACHE_BASENAME" | |
| 14 | JOBS="-j3" | |
| 15 | ||
| 16 | rm -rf $PREFIX | |
| 17 | cd $HOME | |
| 18 | ||
| 19 | curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" | |
| 20 | tar xf "$CACHE_BASENAME.tar.xz" | |
| 21 | ||
| 22 | ZIG="$PREFIX/bin/zig" | |
| 23 | ||
| 24 | cd $ZIGDIR | |
| 25 | ||
| 26 | # Make the `zig version` number consistent. | |
| 27 | # This will affect the cmake command below. | |
| 28 | git config core.abbrev 9 | |
| 29 | git fetch --unshallow || true | |
| 30 | git fetch --tags | |
| 31 | ||
| 32 | mkdir build | |
| 33 | cd build | |
| 34 | cmake .. \ | |
| 35 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 36 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 37 | -DCMAKE_BUILD_TYPE=Release \ | |
| 38 | -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ | |
| 39 | -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ | |
| 40 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 41 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 42 | -DZIG_STATIC=ON | |
| 43 | ||
| 44 | make $JOBS install | |
| 45 | ||
| 46 | stage3-release/bin/zig build test docs \ | |
| 47 | --zig-lib-dir "$(pwd)/../lib" \ | |
| 48 | -Denable-macos-sdk \ | |
| 49 | -Dstatic-llvm \ | |
| 50 | -Dskip-non-native \ | |
| 51 | --search-prefix "$PREFIX" | |
| 52 | ||
| 53 | # Produce the experimental std lib documentation. | |
| 54 | stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib |
ci/x86_64-windows.ps1 created+63| ... | ... | @@ -0,0 +1,63 @@ |
| 1 | $TARGET = "$($Env:ARCH)-windows-gnu" | |
| 2 | $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.25+499dddb4c" | |
| 3 | $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" | |
| 4 | ||
| 5 | Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" | |
| 6 | ||
| 7 | Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" | |
| 8 | ||
| 9 | Write-Output "Extracting..." | |
| 10 | ||
| 11 | Add-Type -AssemblyName System.IO.Compression.FileSystem ; | |
| 12 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") | |
| 13 | ||
| 14 | Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib" | |
| 15 | Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release" | |
| 16 | Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" | |
| 17 | ||
| 18 | function CheckLastExitCode { | |
| 19 | if (!$?) { | |
| 20 | exit 1 | |
| 21 | } | |
| 22 | return 0 | |
| 23 | } | |
| 24 | ||
| 25 | # Make the `zig version` number consistent. | |
| 26 | # This will affect the `zig build` command below which uses `git describe`. | |
| 27 | git config core.abbrev 9 | |
| 28 | git fetch --tags | |
| 29 | ||
| 30 | if ((git rev-parse --is-shallow-repository) -eq "true") { | |
| 31 | git fetch --unshallow # `git describe` won't work on a shallow repo | |
| 32 | } | |
| 33 | ||
| 34 | Write-Output "Building Zig..." | |
| 35 | ||
| 36 | & "$ZIGPREFIXPATH\bin\zig.exe" build ` | |
| 37 | --prefix "$ZIGINSTALLDIR" ` | |
| 38 | --search-prefix "$ZIGPREFIXPATH" ` | |
| 39 | --zig-lib-dir "$ZIGLIBDIR" ` | |
| 40 | -Denable-stage1 ` | |
| 41 | -Dstatic-llvm ` | |
| 42 | -Drelease ` | |
| 43 | -Duse-zig-libcxx ` | |
| 44 | -Dtarget="$TARGET" | |
| 45 | CheckLastExitCode | |
| 46 | ||
| 47 | Write-Output " zig build test docs..." | |
| 48 | ||
| 49 | & "$ZIGINSTALLDIR\bin\zig.exe" build test docs ` | |
| 50 | --search-prefix "$ZIGPREFIXPATH" ` | |
| 51 | -Dstatic-llvm ` | |
| 52 | -Dskip-non-native ` | |
| 53 | -Denable-symlinks-windows | |
| 54 | CheckLastExitCode | |
| 55 | ||
| 56 | # Produce the experimental std lib documentation. | |
| 57 | Write-Output "zig test std/std.zig..." | |
| 58 | ||
| 59 | & "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" ` | |
| 60 | --zig-lib-dir "$ZIGLIBDIR" ` | |
| 61 | -femit-docs ` | |
| 62 | -fno-emit-bin | |
| 63 | CheckLastExitCode |
doc/langref.html.in+15-7| ... | ... | @@ -7029,8 +7029,7 @@ test "fibonacci" { |
| 7029 | 7029 | undefined behavior, which is always a compile error if the compiler knows it happened. |
| 7030 | 7030 | But what would have happened if we used a signed integer? |
| 7031 | 7031 | </p> |
| 7032 | {#code_begin|test_err|evaluation exceeded 1000 backwards branches#} | |
| 7033 | {#backend_stage1#} | |
| 7032 | {#code_begin|syntax#} | |
| 7034 | 7033 | const assert = @import("std").debug.assert; |
| 7035 | 7034 | |
| 7036 | 7035 | fn fibonacci(index: i32) i32 { |
| ... | ... | @@ -7045,13 +7044,22 @@ test "fibonacci" { |
| 7045 | 7044 | } |
| 7046 | 7045 | {#code_end#} |
| 7047 | 7046 | <p> |
| 7048 | The compiler noticed that evaluating this function at compile-time took a long time, | |
| 7049 | and thus emitted a compile error and gave up. If the programmer wants to increase | |
| 7050 | the budget for compile-time computation, they can use a built-in function called | |
| 7051 | {#link|@setEvalBranchQuota#} to change the default number 1000 to something else. | |
| 7047 | The compiler is supposed to notice that evaluating this function at | |
| 7048 | compile-time took more than 1000 branches, and thus emits an error and | |
| 7049 | gives up. If the programmer wants to increase the budget for compile-time | |
| 7050 | computation, they can use a built-in function called | |
| 7051 | {#link|@setEvalBranchQuota#} to change the default number 1000 to | |
| 7052 | something else. | |
| 7053 | </p> | |
| 7054 | <p> | |
| 7055 | However, there is a <a href="https://github.com/ziglang/zig/issues/13724">design | |
| 7056 | flaw in the compiler</a> causing it to stack overflow instead of having the proper | |
| 7057 | behavior here. I'm terribly sorry about that. I hope to get this resolved | |
| 7058 | before the next release. | |
| 7052 | 7059 | </p> |
| 7053 | 7060 | <p> |
| 7054 | What if we fix the base case, but put the wrong value in the {#syntax#}expect{#endsyntax#} line? | |
| 7061 | What if we fix the base case, but put the wrong value in the | |
| 7062 | {#syntax#}expect{#endsyntax#} line? | |
| 7055 | 7063 | </p> |
| 7056 | 7064 | {#code_begin|test_err|reached unreachable#} |
| 7057 | 7065 | const assert = @import("std").debug.assert; |