From ee081ca70322cd01d0642fdb1860e6bfbfb48e85 Mon Sep 17 00:00:00 2001 From: steven-vd Date: Sun, 16 Aug 2026 15:00:32 +0200 Subject: Initial commit --- .env/build.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ .env/debug.sh | 5 +++++ 2 files changed, 54 insertions(+) create mode 100644 .env/build.sh create mode 100644 .env/debug.sh (limited to '.env') 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 + diff --git a/.env/debug.sh b/.env/debug.sh new file mode 100644 index 0000000..2a61b04 --- /dev/null +++ b/.env/debug.sh @@ -0,0 +1,5 @@ +set -e +. ./.env/build.sh + +./a.out + -- cgit v1.2.3