warn if "source" fails to open the file when from_tty == 0
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / nodebug.c
CommitLineData
085dd6e6 1#include <stdlib.h>
c906108c
SS
2/* Test that things still (sort of) work when compiled without -g. */
3
4int dataglobal = 3; /* Should go in global data */
5static int datalocal = 4; /* Should go in local data */
6int bssglobal; /* Should go in global bss */
7static int bsslocal; /* Should go in local bss */
8
085dd6e6
JM
9#ifdef PROTOTYPES
10int
11inner (int x)
12#else
c906108c
SS
13int
14inner (x)
15 int x;
085dd6e6 16#endif
c906108c
SS
17{
18 return x + dataglobal + datalocal + bssglobal + bsslocal;
19}
20
085dd6e6
JM
21#ifdef PROTOTYPES
22static short
23middle (int x)
24#else
c906108c
SS
25static short
26middle (x)
27 int x;
085dd6e6 28#endif
c906108c
SS
29{
30 return 2 * inner (x);
31}
32
085dd6e6
JM
33#ifdef PROTOTYPES
34short
35top (int x)
36#else
c906108c
SS
37short
38top (x)
39 int x;
085dd6e6 40#endif
c906108c
SS
41{
42 return 2 * middle (x);
43}
44
085dd6e6
JM
45#ifdef PROTOTYPES
46int
47main (int argc, char **argv)
48#else
c906108c
SS
49int
50main (argc, argv)
51 int argc;
52 char **argv;
085dd6e6 53#endif
c906108c 54{
c906108c
SS
55 return top (argc);
56}
57
c906108c
SS
58int *x;
59
085dd6e6
JM
60#ifdef PROTOTYPES
61int array_index (char *arr, int i)
62#else
c906108c
SS
63int
64array_index (arr, i)
65 char *arr;
66 int i;
085dd6e6 67#endif
c906108c
SS
68{
69 /* The basic concept is just "return arr[i];". But call malloc so that gdb
70 will be able to call functions. */
71 char retval;
72 x = (int *) malloc (sizeof (int));
73 *x = i;
74 retval = arr[*x];
75 free (x);
76 return retval;
77}
This page took 2.551361 seconds and 4 git commands to generate.