avoid useless warning for 'bool <- restricted type' conversion
[smatch.git] / validation / bool-cast-restricted.c
blobf6776b0500e4856916edc568fdcc8b56e5a4cc7b
1 typedef unsigned int __attribute__((bitwise)) large_t;
2 #define LBIT ((__attribute__((force)) large_t) 1)
4 _Bool lfoo(large_t x) { return x; }
5 _Bool lbar(large_t x) { return ~x; }
6 _Bool lbaz(large_t x) { return !x; }
7 _Bool lqux(large_t x) { return x & LBIT; }
10 typedef unsigned short __attribute__((bitwise)) small_t;
11 #define SBIT ((__attribute__((force)) small_t) 1)
13 _Bool sfoo(small_t x) { return x; }
14 _Bool sbar(small_t x) { return ~x; }
15 _Bool sbaz(small_t x) { return !x; }
16 _Bool squx(small_t x) { return x & SBIT; }
19 * check-name: bool-cast-restricted.c
20 * check-command: sparse -Wno-decl $file
22 * check-error-start
23 bool-cast-restricted.c:14:32: warning: restricted small_t degrades to integer
24 * check-error-end