File: type-attribute-as.c

package info (click to toggle)
sparse 0.6.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,868 kB
  • sloc: ansic: 46,050; sh: 614; python: 301; perl: 293; makefile: 279
file content (33 lines) | stat: -rw-r--r-- 704 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
#define	__as		__attribute__((address_space(__as)))

struct s {
	int i;
} __as;


extern void use0(void *);
extern void use1(void __as *);

void main(void)
{
	struct s s;
	int i;

	use0(&s);	// KO
	use0(&i);	// OK
	use1(&s);	// OK
	use1(&i);	// KO
}

/*
 * check-name: type-attribute-as
 *
 * check-error-start
type-attribute-as.c:16:15: warning: incorrect type in argument 1 (different address spaces)
type-attribute-as.c:16:15:    expected void *
type-attribute-as.c:16:15:    got struct s __as *
type-attribute-as.c:19:15: warning: incorrect type in argument 1 (different address spaces)
type-attribute-as.c:19:15:    expected void __as *
type-attribute-as.c:19:15:    got int *
 * check-error-end
 */