set unstable set lists CC_ARGS := [ "-I", "build", "-std=c2y", "-fdefer-ts", "-Wall", "-Werror", "-Wpedantic", "-Wnullability", "-Wnullability-completeness", "-Wnullability-completeness-on-arrays", "-Wnullability-declspec", "-Wnullability-inferred-on-nested-type", "-Wnullable-to-nonnull-conversion", "-Wnonnull", "-Wnull-dereference", "-Wnull-pointer-arithmetic", "-Wnull-pointer-subtraction", "-Wno-nullability-extension", "-Wno-dollar-in-identifier-extension", "-Wno-unused-command-line-argument" ] ANALYZE_ARGS := [ "--analyze", "--analyzer-output", "text", "-Xclang", "-analyzer-werror", ] default: all_tests all_tests: \ (test_compile_succ "usage_ignore") \ (test_compile_fail "usage_fail") \ (test_compile_succ "defer") \ (test_compile_succ "nonull") \ (test_compile_fail "null") \ (test_compile_succ "countof") \ @echo "All Tests Pass" @build: mkdir -p build echo "// lilac.h" > build/lilac.h cat src/attrs.h >> build/lilac.h cat src/builtins.h >> build/lilac.h cat src/mem.h >> build/lilac.h cat src/types.h >> build/lilac.h cat src/usage.h >> build/lilac.h @logs_dir: build mkdir -p build/logs test_compile_succ name: logs_dir @clang "test/{{name}}.c" -o "build/{{name}}" {{CC_ARGS}} > "build/logs/{{name}}" 2>&1 \ && clang "test/{{name}}.c" {{CC_ARGS}} {{ANALYZE_ARGS}} >> "build/logs/{{name}}" 2>&1 \ || (cat "build/logs/{{name}}"; echo "{{name}} incorrectly failed to compile"; false) test_compile_fail name: logs_dir @if clang "test/{{name}}.c" -o "build/{{name}}" {{CC_ARGS}} > "build/logs/{{name}}" 2>&1 \ && clang "test/{{name}}.c" {{CC_ARGS}} {{ANALYZE_ARGS}} >> "build/logs/{{name}}" 2>&1; then \ echo "{{name}} incorrectly succeeded to compile"; \ exit 1; \ fi test_compile name: logs_dir clang "test/{{name}}.c" -o "build/{{name}}" {{CC_ARGS}} clang "test/{{name}}.c" {{CC_ARGS}} {{ANALYZE_ARGS}}