• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdio.h>
2 #include "inlines.h"
3 
4 #define INLINE_ME __inline__ __attribute__((always_inline))
5 
6 int
not_inlined_2(int input)7 not_inlined_2 (int input)
8 {
9   printf ("Called in not_inlined_2 with : %d.\n", input);
10   return input;
11 }
12 
13 int
not_inlined_1(int input)14 not_inlined_1 (int input)
15 {
16   printf ("Called in not_inlined_1 with %d.\n", input);
17   return not_inlined_2(input);
18 }
19 
20 INLINE_ME int
inner_inline(int inner_input,int mod_value)21 inner_inline (int inner_input, int mod_value)
22 {
23   int inner_result;
24   inner_result = inner_input % mod_value;
25   printf ("Returning: %d.\n", inner_result);
26   return not_inlined_1 (inner_result);
27 }
28 
29 INLINE_ME int
outer_inline(int outer_input)30 outer_inline (int outer_input)
31 {
32   int outer_result;
33 
34   outer_result = inner_inline (outer_input, outer_input % 3);
35   return outer_result;
36 }
37 
38 int
main(int argc,char ** argv)39 main (int argc, char **argv)
40 {
41   printf ("Starting...\n");
42 
43   int (*func_ptr) (int);
44   func_ptr = outer_inline;
45 
46   outer_inline (argc);
47 
48   func_ptr (argc);
49 
50   return 0;
51 }
52 
53 
54