testsuite: Skip analyzer tests on AIX.
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / pragma-2.c
blob2453223d9392a9fcdae5ebcfacb86ab993af31c8
1 /* { dg-skip-if "" { powerpc*-*-aix* } } */
2 /* Verify that we can disable -Wanalyzer-too-complex via pragmas. */
3 /* { dg-additional-options "-Wanalyzer-too-complex -Werror=analyzer-too-complex -fno-analyzer-state-merge -g" } */
5 #include <stdlib.h>
7 extern int get (void);
9 /* In theory each of p0...p4 can be in various malloc states,
10 independently, so the total combined number of states
11 at any program point within the loop is NUM_VARS * NUM_STATES. */
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wanalyzer-too-complex"
16 void test (void)
18 void *p0 = NULL, *p1 = NULL, *p2 = NULL, *p3 = NULL, *p4 = NULL;
19 void **pp = NULL;
20 while (get ())
22 switch (get ())
24 default:
25 case 0:
26 pp = &p0;
27 break;
28 case 1:
29 pp = &p1;
30 break;
31 case 2:
32 pp = &p2;
33 break;
34 case 3:
35 pp = &p3;
36 break;
37 case 4:
38 pp = &p4;
39 break;
42 switch (get ())
44 default:
45 case 0:
46 *pp = malloc (16); /* { dg-warning "leak" } */
47 break;
48 case 1:
49 free (*pp);
50 break;
51 case 2:
52 /* no-op. */
53 break;
58 #pragma GCC diagnostic pop