Kristof Umann | 1a17032 | 2019-02-05 00:39:33 +0000 | [diff] [blame] | 1 | |
| 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 |
| 7 | } |
| 8 | |
| 9 | void f(); |
| 10 | |
| 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 |
| 15 | } |
| 16 | |
| 17 | void test() { |
| 18 | void *p = malloc(0); // warn: allocation size of 0 bytes |
| 19 | } |
| 20 | |
| 21 | void test() { |
| 22 | void *p = calloc(0, 42); // warn: allocation size of 0 bytes |
| 23 | } |
| 24 | |
| 25 | void test() { |
| 26 | void *p = malloc(1); |
| 27 | p = realloc(p, 0); // warn: allocation size of 0 bytes |
| 28 | } |
| 29 | |
| 30 | void test() { |
| 31 | void *p = alloca(0); // warn: allocation size of 0 bytes |
| 32 | } |
| 33 | |
| 34 | void test() { |
| 35 | void *p = valloc(0); // warn: allocation size of 0 bytes |
| 36 | } |
| 37 | |