aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/return-type-2.c
blob: 183c6a88d4045926f86cf0fe11ab9dced481f827 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* Bogus warnings claiming we fall off the end of a non-void function.
   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/27/2000.  */
/* { dg-do compile } */
/* { dg-options "-O2 -Wreturn-type" } */

extern void abort (void) __attribute__ ((__noreturn__));

int
foo1 (int i)
{
  if (i)
    return i;

  abort ();
} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */

__inline__ int
foo2 (int i)
{
  if (i)
    return i;

  abort ();
} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */

static int
foo3 (int i)
{
  if (i)
    return i;

  abort ();
} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */

static __inline__ int
foo4 (int i)
{
  if (i)
    return i;

  abort ();
} /* { dg-bogus "control reaches end of non-void function" "warning for falling off end of non-void function" } */

int bar (int i)
{
  return foo1 (i) + foo2 (i) + foo3 (i) + foo4 (i);
}