gcc/testsuite/gfortran.dg/c_funloc_tests_3_funcs.c
raw| 1 | /* These functions support the test case c_funloc_tests_3. */ |
| 2 | #include <stdlib.h> |
| 3 | #include <stdio.h> |
| 4 | |
| 5 | int printIntC(int i) |
| 6 | { |
| 7 | return 3*i; |
| 8 | } |
| 9 | |
| 10 | int (*returnFunc(void))(int) |
| 11 | { |
| 12 | return &printIntC; |
| 13 | } |
| 14 | |
| 15 | void callFunc(int(*func)(int), int pass, int compare) |
| 16 | { |
| 17 | int result = (*func)(pass); |
| 18 | if(result != compare) |
| 19 | { |
| 20 | printf("FAILED: Got %d, expected %d\n", result, compare); |
| 21 | abort(); |
| 22 | } |
| 23 | else |
| 24 | printf("SUCCESS: Got %d, expected %d\n", result, compare); |
| 25 | } |