aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/function-attribute-pointer.c
blob: fd08ac7106d5f59a2d08f940efb950e5a6a03f11 (plain)
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 __noreturn __attribute__((__noreturn__))

void set_die(void (*)(void));
void set_die_nr(__noreturn void (*)(void));

void die(void);
void __noreturn die_nr(void);

static void foo(void)
{
	set_die(die);
	set_die(die_nr);
	set_die_nr(die_nr);
	set_die_nr(die);

	           void (*fptr0)(void) = die;
	           void (*fptr1)(void) = die_nr;
	__noreturn void (*fptr3)(void) = die_nr;
	__noreturn void (*fptr2)(void) = die;
}

/*
 * check-name: function-attribute-pointer
 *
 * check-error-start
function-attribute-pointer.c:14:20: warning: incorrect type in argument 1 (different modifiers)
function-attribute-pointer.c:14:20:    expected void ( [noreturn] * )( ... )
function-attribute-pointer.c:14:20:    got void ( * )( ... )
function-attribute-pointer.c:19:42: warning: incorrect type in initializer (different modifiers)
function-attribute-pointer.c:19:42:    expected void ( [noreturn] *fptr2 )( ... )
function-attribute-pointer.c:19:42:    got void ( * )( ... )
 * check-error-end
 */