blob: 5846fd790e71eeadd398f52da82d557a1ccf0ea8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
|