1 /* { dg-options "-fdiagnostics-show-caret -Wreturn-local-addr" } */
3 int *address_of_local (void)
6 return &some_local
; /* { dg-warning "function returns address of local variable" } */
7 /* { dg-begin-multiline-output "" }
10 { dg-end-multiline-output "" } */
13 void surplus_return_when_void_1 (void)
15 return 500; /* { dg-warning "'return' with a value, in function returning void" } */
16 /* { dg-begin-multiline-output "" }
19 { dg-end-multiline-output "" } */
20 /* { dg-begin-multiline-output "" }
21 void surplus_return_when_void_1 (void)
22 ^~~~~~~~~~~~~~~~~~~~~~~~~~
23 { dg-end-multiline-output "" } */
26 void surplus_return_when_void_2 (int i
, int j
)
28 return i
* j
; /* { dg-warning "'return' with a value, in function returning void" } */
29 /* { dg-begin-multiline-output "" }
32 { dg-end-multiline-output "" } */
33 /* { dg-begin-multiline-output "" }
34 void surplus_return_when_void_2 (int i, int j)
35 ^~~~~~~~~~~~~~~~~~~~~~~~~~
36 { dg-end-multiline-output "" } */
39 int missing_return_value (void)
41 return; /* { dg-warning "'return' with no value, in function returning non-void" } */
42 /* { dg-begin-multiline-output "" }
45 { dg-end-multiline-output "" } */
46 /* { dg-begin-multiline-output "" }
47 int missing_return_value (void)
49 { dg-end-multiline-output "" } */
50 /* TODO: ideally we'd underline the return type i.e. "int", but that
51 location isn't captured. */