| 1 |
static void __attribute__((noinline)) |
| 2 |
__analyzer_consume_n_ints (int num, ...) |
| 3 |
{ |
| 4 |
__builtin_va_list ap; |
| 5 |
__builtin_va_start (ap, num); |
| 6 |
|
| 7 |
int i, v; |
| 8 |
for (i = 0; i < num; i++) |
| 9 |
v = __builtin_va_arg (ap, int); |
| 10 |
|
| 11 |
__builtin_va_end (ap); |
| 12 |
} |
| 13 |
|
| 14 |
void test_int (int x) |
| 15 |
{ |
| 16 |
__analyzer_consume_n_ints (1, x); |
| 17 |
} |
| 18 |
|
| 19 |
void test_3_ints (int x, int y, int z) |
| 20 |
{ |
| 21 |
__analyzer_consume_n_ints (3, x, y, z); |
| 22 |
} |
| 23 |
|
| 24 |
/* Verify that we don't complain about types that get promoted to int |
| 25 |
at the variadic call. */ |
| 26 |
|
| 27 |
void test_short (short s) |
| 28 |
{ |
| 29 |
__analyzer_consume_n_ints (1, s); |
| 30 |
} |
| 31 |
|
| 32 |
void test_ushort (unsigned short s) |
| 33 |
{ |
| 34 |
__analyzer_consume_n_ints (1, s); |
| 35 |
} |
| 36 |
|
| 37 |
void test_schar (signed char ch) |
| 38 |
{ |
| 39 |
__analyzer_consume_n_ints (1, ch); |
| 40 |
} |
| 41 |
|
| 42 |
void test_uchar (unsigned char ch) |
| 43 |
{ |
| 44 |
__analyzer_consume_n_ints (1, ch); |
| 45 |
} |
| 46 |
|
| 47 |
struct ust |
| 48 |
{ |
| 49 |
int b0123 : 4; |
| 50 |
int b4567 : 4; |
| 51 |
}; |
| 52 |
|
| 53 |
void test_signed_bitfield (struct ust s) |
| 54 |
{ |
| 55 |
__analyzer_consume_n_ints (2, s.b0123, s.b4567); |
| 56 |
} |
| 57 |
|
| 58 |
struct sst |
| 59 |
{ |
| 60 |
unsigned int b0123 : 4; |
| 61 |
unsigned int b4567 : 4; |
| 62 |
}; |
| 63 |
|
| 64 |
void test_unsigned_bitfield (struct sst s) |
| 65 |
{ |
| 66 |
__analyzer_consume_n_ints (2, s.b0123, s.b4567); |
| 67 |
} |