Debian Codegraph @

clang/test/Sema/format-strings-pedantic.c

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-format -Wformat-pedantic %s
2 // RUN: %clang_cc1 -xobjective-c -fblocks -fsyntax-only -verify -Wno-format -Wformat-pedantic %s
3 // RUN: %clang_cc1 -xc++ -fsyntax-only -verify -Wno-format -Wformat-pedantic %s
4 // RUN: %clang_cc1 -std=c23 -fsyntax-only -verify -Wno-format -Wformat-pedantic %s
5
6 __attribute__((format(printf, 1, 2)))
7 int printf(const char *restrict, ...);
8
9 int main(void) {
10 printf("%p", (int *)0); // expected-warning {{format specifies type 'void *' but the argument has type 'int *'}}
11 printf("%p", (void *)0);
12
13 #ifdef __OBJC__
14 printf("%p", ^{}); // expected-warning {{format specifies type 'void *' but the argument has type 'void (^)(void)'}}
15 printf("%p", (id)0); // expected-warning {{format specifies type 'void *' but the argument has type 'id'}}
16 #endif
17
18 #if !__is_identifier(nullptr)
19 printf("%p", nullptr);
20 #endif
21 }