[gdb/testsuite] Factor out lib/valgrind.exp
[external/binutils.git] / gdb / testsuite / gdb.base / scope1.c
1 static int filelocal = 2;       /* In Data section */
2 static int filelocal_bss;       /* In BSS section */
3 #ifndef __STDC__
4 #define const   /**/
5 #endif
6 static const int filelocal_ro = 202;    /* In Read-Only Data section */
7
8 void foo ()
9 {
10
11   void bar ();
12   
13   static int funclocal = 3;     /* In Data section */
14   static int funclocal_bss;     /* In BSS section */
15   static const int funclocal_ro = 203;  /* RO Data */
16   static const int funclocal_ro_bss;    /* RO Data */
17
18   funclocal_bss = 103;
19   bar ();
20 }
21
22 void bar ()
23 {
24   static int funclocal = 4;     /* In data section */
25   static int funclocal_bss;     /* In BSS section */
26   funclocal_bss = 104;
27 }
28
29 void init1 ()
30 {
31   filelocal_bss = 102;
32 }
33
34 /* On some systems, such as AIX, unreferenced variables are deleted
35    from the executable.  On other compilers, such as ARM RealView,
36    const variables without their address taken are deleted.  */
37 void usestatics1 ()
38 {
39   void useit1 (const int *val);
40   
41   useit1 (&filelocal);
42   useit1 (&filelocal_bss);
43   useit1 (&filelocal_ro);
44 }
45
46 void useit1 (const int *val)
47 {
48     static int usedval;
49
50     usedval = *val;
51 }