Stop assuming no-debug-info functions return int
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / nodebug.c
1 #include <stdlib.h>
2 #include <stdint.h>
3
4 /* Test that things still (sort of) work when compiled without -g. */
5
6 int dataglobal = 3; /* Should go in global data */
7 static int datalocal = 4; /* Should go in local data */
8 int bssglobal; /* Should go in global bss */
9 static int bsslocal; /* Should go in local bss */
10
11 int
12 inner (int x)
13 {
14 return x + dataglobal + datalocal + bssglobal + bsslocal;
15 }
16
17 static short
18 middle (int x)
19 {
20 return 2 * inner (x);
21 }
22
23 short
24 top (int x)
25 {
26 return 2 * middle (x);
27 }
28
29 int
30 main (int argc, char **argv)
31 {
32 return top (argc);
33 }
34
35 int *x;
36
37 int array_index (char *arr, int i)
38 {
39 /* The basic concept is just "return arr[i];". But call malloc so that gdb
40 will be able to call functions. */
41 char retval;
42 x = (int *) malloc (sizeof (int));
43 *x = i;
44 retval = arr[*x];
45 free (x);
46 return retval;
47 }
48
49 float
50 multf (float v1, float v2)
51 {
52 return v1 * v2;
53 }
54
55 float
56 multf_noproto (v1, v2)
57 float v1, v2;
58 {
59 return v1 * v2;
60 }
61
62 double
63 mult (double v1, double v2)
64 {
65 return v1 * v2;
66 }
67
68 double
69 mult_noproto (v1, v2)
70 double v1, v2;
71 {
72 return v1 * v2;
73 }
74
75 uint8_t
76 add8 (uint8_t v1, uint8_t v2)
77 {
78 return v1 + v2;
79 }
80
81 uint8_t
82 add8_noproto (v1, v2)
83 uint8_t v1, v2;
84 {
85 return v1 + v2;
86 }
This page took 0.03147 seconds and 4 git commands to generate.