arm: cleanup legacy ARM_PE code
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / switch-enum-pr105273-git-vreportf-2.c
blobbb1ef085691274e18e295b4084e1eb3d00cc727b
1 /* Currently the warning only fires at -O0
2 (needs to inline the call without optimizing the
3 implicit default of the switch). */
5 /* { dg-additional-options "-O0" } */
7 typedef __SIZE_TYPE__ size_t;
8 int snprintf(char *str, size_t size, const char *format, ...);
10 enum usage_kind {
11 USAGE_ERROR,
12 USAGE_BUG,
15 static void __analyzer_vreportf(enum usage_kind kind)
17 char buf[256];
18 const char *pfx;
20 switch (kind) { /* { dg-message "following 'default:' branch" } */
21 case USAGE_ERROR:
22 pfx = "error: ";
23 break;
24 case USAGE_BUG:
25 pfx = "BUG: ";
26 break;
29 if (kind == USAGE_BUG)
30 snprintf(buf, sizeof(buf), "%s%s:%d: ", pfx, "file", 123);
31 else
32 snprintf(buf, sizeof(buf), "%s", pfx); /* { dg-warning "uninitialized" } */
35 int main(void)
37 __analyzer_vreportf((enum usage_kind) 42);
39 return 0;