test.c:3:1: error: 'main' must return 'int'
clang은 int main() 아니면 배쨰는 중 -_-
음.. 코드가 허접한거라..
$ cat test.c #include <stdio.h> int main() { int *p; free(p); return 0; } |
시간은 큰 의미가 없지만.. 아무튼 빌드가 아니라 --analyze만 해서는
$ time gcc -o gcc.o test.c
test.c: In function ‘main’:
test.c:7:2: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
real 0m0.611s
user 0m0.510s
sys 0m0.070s
$ time clang -o gcc.o test.c
test.c:7:2: warning: implicit declaration of function 'free' is invalid in C99
[-Wimplicit-function-declaration]
free(p);
^
1 warning generated.
real 0m0.728s
user 0m0.560s
sys 0m0.110s
$ time clang -o gcc.o test.c --analyze
test.c:7:2: warning: Function call argument is an uninitialized value
free(p);
^ ~
1 warning generated.
real 0m0.325s
user 0m0.220s
sys 0m0.080s
'프로그램 사용 > clang' 카테고리의 다른 글
semgrep (0) | 2023.04.17 |
---|---|
cppcheck 사용 (0) | 2023.04.17 |
clang on ubnutu (0) | 2015.08.03 |
llvm / clang / cppcheck (0) | 2015.02.21 |