Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / docs / analyzer / checkers / unix_api_example.c
blob66ed56fd8663b7f3b10413f7883575366e028a68
2 // Currently the check is performed for apple targets only.
3 void test(const char *path) {
4 int fd = open(path, O_CREAT);
5 // warn: call to 'open' requires a third argument when the
6 // 'O_CREAT' flag is set
9 void f();
11 void test() {
12 pthread_once_t pred = {0x30B1BCBA, {0}};
13 pthread_once(&pred, f);
14 // warn: call to 'pthread_once' uses the local variable
17 void test() {
18 void *p = malloc(0); // warn: allocation size of 0 bytes
21 void test() {
22 void *p = calloc(0, 42); // warn: allocation size of 0 bytes
25 void test() {
26 void *p = malloc(1);
27 p = realloc(p, 0); // warn: allocation size of 0 bytes
30 void test() {
31 void *p = alloca(0); // warn: allocation size of 0 bytes
34 void test() {
35 void *p = valloc(0); // warn: allocation size of 0 bytes