grace/lilac
An Experimental C Library using modern features
git clone https://git.gae.moe/grace/lilac
f3dea09
main
1set unstable 2set lists 3 4CC_ARGS := [ 5"-I" , "build" , 6"-std=c2y" , 7"-fdefer-ts" , 8"-Wall" , 9"-Werror" , 10"-Wpedantic" , 11"-Wnullability" , 12"-Wnullability-completeness" , 13"-Wnullability-completeness-on-arrays" , 14"-Wnullability-declspec" , 15"-Wnullability-inferred-on-nested-type" , 16"-Wnullable-to-nonnull-conversion" , 17"-Wnonnull" , 18"-Wnull-dereference" , 19"-Wnull-pointer-arithmetic" , 20"-Wnull-pointer-subtraction" , 21"-Wno-nullability-extension" , 22"-Wno-dollar-in-identifier-extension" , 23"-Wno-unused-command-line-argument" 24] 25 26ANALYZE_ARGS := [ 27"--analyze" , 28"--analyzer-output" , "text" , 29"-Xclang" , "-analyzer-werror" , 30] 31 32default : all_tests 33 34all_tests : \ 35( test_compile_succ "usage_ignore" ) \ 36( test_compile_fail "usage_fail" ) \ 37( test_compile_succ "defer" ) \ 38( test_compile_succ "nonull" ) \ 39( test_compile_fail "null" ) \ 40( test_compile_succ "countof" ) \ 41 42@ echo "All Tests Pass" 43 44@ build : 45mkdir -p build 46echo "// lilac.h" > build/lilac.h 47 48cat src/attrs.h>> build/lilac.h 49cat src/builtins.h>> build/lilac.h 50cat src/mem.h>> build/lilac.h 51cat src/types.h>> build/lilac.h 52cat src/usage.h>> build/lilac.h 53 54@ logs_dir : build 55mkdir -p build/logs 56 57test_compile_succ name : logs_dir 58@ clang "test/ {{ name }} .c" -o"build/ {{ name }} " {{ CC_ARGS }} > "build/logs/ {{ name }} " 2>& 1\ 59&& clang "test/ {{ name }} .c" {{ CC_ARGS }} {{ ANALYZE_ARGS }} >> "build/logs/ {{ name }} " 2>& 1\ 60|| ( cat "build/logs/ {{ name }} " ; echo " {{ name }} incorrectly failed to compile" ; false ) 61 62test_compile_fail name : logs_dir 63@ if clang "test/ {{ name }} .c" -o"build/ {{ name }} " {{ CC_ARGS }} > "build/logs/ {{ name }} " 2>& 1\ 64&& clang "test/ {{ name }} .c" {{ CC_ARGS }} {{ ANALYZE_ARGS }} >> "build/logs/ {{ name }} " 2>& 1; then \ 65echo " {{ name }} incorrectly succeeded to compile" ; \ 66exit 1; \ 67fi 68 69test_compile name : logs_dir 70clang "test/ {{ name }} .c" -o"build/ {{ name }} " {{ CC_ARGS }} 71clang "test/ {{ name }} .c" {{ CC_ARGS }} {{ ANALYZE_ARGS }}