File: foul-bitwise.c

package info (click to toggle)
sparse 0.4.5~rc1-1
  • links: PTS, VCS
  • area: non-free
  • in suites: jessie-kfreebsd
  • size: 1,752 kB
  • sloc: ansic: 27,795; perl: 237; sh: 225; makefile: 162
file content (32 lines) | stat: -rw-r--r-- 707 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
typedef unsigned short __attribute__((bitwise))__le16;
static __le16 foo(__le16 a)
{
	return a |= ~a;
}

static int baz(__le16 a)
{
	return ~a == ~a;
}

static int barf(__le16 a)
{
	return a == (a & ~a);
}

static __le16 bar(__le16 a)
{
	return -a;
}

/*
 * check-name: foul bitwise
 * check-error-start
foul-bitwise.c:9:16: warning: restricted __le16 degrades to integer
foul-bitwise.c:9:22: warning: restricted __le16 degrades to integer
foul-bitwise.c:19:16: warning: restricted __le16 degrades to integer
foul-bitwise.c:19:16: warning: incorrect type in return expression (different base types)
foul-bitwise.c:19:16:    expected restricted __le16
foul-bitwise.c:19:16:    got int
 * check-error-end
 */