diff options
| author | steven-vd <steven@vandorp.lu> | 2026-08-16 15:00:32 +0200 |
|---|---|---|
| committer | steven-vd <steven@vandorp.lu> | 2026-08-17 09:31:42 +0200 |
| commit | ee081ca70322cd01d0642fdb1860e6bfbfb48e85 (patch) | |
| tree | 295fdba93b08b24562c6d49e971bbf3425eac50c /.env/build.sh | |
Diffstat (limited to '.env/build.sh')
| -rw-r--r-- | .env/build.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/.env/build.sh b/.env/build.sh new file mode 100644 index 0000000..5846fd7 --- /dev/null +++ b/.env/build.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +set -e + +CLANG_TIDY_FLAGS=" + *, + -llvm-header-guard, + -readability-identifier-length + -readability-braces-around-statements + -readability-else-after-return + -readability-function-cognitive-complexity + -readability-magic-numbers + -cppcoreguidelines-init-variables + -cppcoreguidelines-avoid-non-const-global-variables + -cppcoreguidelines-avoid-magic-numbers + -bugprone-macro-parentheses + -bugprone-easily-swappable-parameters + -altera-unroll-loops + -altera-id-dependent-backward-branch + -llvm-else-after-return + -hicpp-braces-around-statements +" + +CC_FLAGS=" + --std=c89 \ + -Werror=vla \ + + -Wall -Wpedantic -Wextra -pedantic-errors \ + -Wswitch-enum \ +" +CC_FLAGS+=" -Werror" + +CC_FLAGS+=" -I." + +CC_FLAGS+=" -O0 -g3 -march=native -fsanitize=array-bounds -fsanitize=bounds" +#CC_FLAGS+=" -O3 -flto -g3 -march=native -fno-omit-frame-pointer" # for profiling +#CC_FLAGS+=" -O3 -DNDEBUG -flto -march=native" + +CC_FLAGS+=" -Wgnu -Weverything -Wno-unsafe-buffer-usage \ + -Wno-padded -Wno-covered-switch-default \ + " + +#TARGET="examples/simple.c" +TARGET="examples/c89.c" +#clang-tidy $TARGET -checks="$CLANG_TIDY_FLAGS" -- $CC_FLAGS +clang $CC_FLAGS $TARGET + +#clang -Os -nostdlib -ffreestanding -static -fno-stack-protector -fuse-ld=lld -I. examples/nolibc.c -o smallest + |
