File: noreturn.i

package info (click to toggle)
frama-c 20161101%2Bsilicon%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 42,324 kB
  • ctags: 35,695
  • sloc: ml: 200,142; ansic: 31,465; makefile: 2,334; sh: 1,643; lisp: 259; python: 85; asm: 26
file content (37 lines) | stat: -rw-r--r-- 659 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
33
34
35
36
37
void stop(void) __attribute__ ((noreturn)) ;

int haltme(void) __attribute__ ((noreturn)) ;


void never_ends(void)  __attribute__ ((noreturn)) 
{  while(1) ;
 return;
}; 

void should_never_end(int c)  __attribute__ ((noreturn)) 
{ 
  if (c) while(1) ;} ;

void warn_never_ends(void)
{ while(1) ;} ;

void warn_may_never_end(int c)
{ 
  if (c) while(1) ;} ;

static volatile int v=55,w=66;
int main(int c) {
  int x=0;

  if (v) warn_may_never_end (v);
  if (v) warn_may_never_end (1);
  if (v) warn_never_ends ();
  if (v) stop();
  if (v) x = haltme ();
  if (v) never_ends ();
  if (v) should_never_end (v);
  if (v) should_never_end (1);

  return x;
}