• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #define __noreturn __attribute__((__noreturn__))
2 
3 void set_die(void (*)(void));
4 void set_die_nr(__noreturn void (*)(void));
5 
6 void die(void);
7 void __noreturn die_nr(void);
8 
foo(void)9 static void foo(void)
10 {
11 	set_die(die);
12 	set_die(die_nr);
13 	set_die_nr(die_nr);
14 	set_die_nr(die);
15 
16 	           void (*fptr0)(void) = die;
17 	           void (*fptr1)(void) = die_nr;
18 	__noreturn void (*fptr3)(void) = die_nr;
19 	__noreturn void (*fptr2)(void) = die;
20 }
21 
22 /*
23  * check-name: function-attribute-pointer
24  *
25  * check-error-start
26 function-attribute-pointer.c:14:20: warning: incorrect type in argument 1 (different modifiers)
27 function-attribute-pointer.c:14:20:    expected void ( [noreturn] * )( ... )
28 function-attribute-pointer.c:14:20:    got void ( * )( ... )
29 function-attribute-pointer.c:19:42: warning: incorrect type in initializer (different modifiers)
30 function-attribute-pointer.c:19:42:    expected void ( [noreturn] *fptr2 )( ... )
31 function-attribute-pointer.c:19:42:    got void ( * )( ... )
32  * check-error-end
33  */
34