File: typesign.c

package info (click to toggle)
sparse 0.4.1-1
  • links: PTS, VCS
  • area: non-free
  • in suites: lenny
  • size: 1,268 kB
  • ctags: 2,691
  • sloc: ansic: 23,892; perl: 204; sh: 181; makefile: 174
file content (61 lines) | stat: -rw-r--r-- 1,620 bytes parent folder | download | duplicates (2)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
static unsigned int * s_to_u_return(signed int *sp)
{
	return sp;
}

static signed int * u_to_s_return(unsigned int *up)
{
	return up;
}

static unsigned int * s_to_u_init(signed int *sp)
{
	unsigned int *up = sp;
	return up;
}

static signed int * u_to_s_init(unsigned int *up)
{
	signed int *sp = up;
	return sp;
}

static unsigned int * s_to_u_assign(signed int *sp)
{
	unsigned int *up;
	up = sp;
	return up;
}

static signed int * u_to_s_assign(unsigned int *up)
{
	signed int *sp;
	sp = up;
	return sp;
}

/*
 * check-name: -Wtypesign
 * check-command: sparse -Wtypesign $file
 *
 * check-error-start
typesign.c:3:9: warning: incorrect type in return expression (different signedness)
typesign.c:3:9:    expected unsigned int *
typesign.c:3:9:    got signed int *sp
typesign.c:8:9: warning: incorrect type in return expression (different signedness)
typesign.c:8:9:    expected signed int *
typesign.c:8:9:    got unsigned int *up
typesign.c:13:21: warning: incorrect type in initializer (different signedness)
typesign.c:13:21:    expected unsigned int *up
typesign.c:13:21:    got signed int *sp
typesign.c:19:19: warning: incorrect type in initializer (different signedness)
typesign.c:19:19:    expected signed int *sp
typesign.c:19:19:    got unsigned int *up
typesign.c:26:5: warning: incorrect type in assignment (different signedness)
typesign.c:26:5:    expected unsigned int *up
typesign.c:26:5:    got signed int *sp
typesign.c:33:5: warning: incorrect type in assignment (different signedness)
typesign.c:33:5:    expected signed int *sp
typesign.c:33:5:    got unsigned int *up
 * check-error-end
 */