2013-09-20 Chung-Lin Tang <cltang@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / scope0.c
index ad994fc0b21e2152c8c2cdd7eb6663cb44d89526..775f8dcd10dffeb171ba641a2561c2f0d791d231 100644 (file)
@@ -11,6 +11,7 @@ extern void foo();
 int autovars (int bcd, int abc);
 int localscopes (int x);
 int useit (int val);
+int useitp (const int *val);
 void init0();
 void marker1 ();
 void marker2 ();
@@ -19,10 +20,6 @@ void marker4 ();
 
 int main ()
 {
-#ifdef usestubs
-  set_debug_traps();
-  breakpoint();
-#endif
   init0 ();
   foo ();
   autovars (5, 6);
@@ -30,12 +27,13 @@ int main ()
 }
 
 /* On some systems, such as AIX, unreferenced variables are deleted
-   from the executable.  */
+   from the executable.  On other compilers, such as ARM RealView,
+   const variables without their address taken are deleted.  */
 void usestatics ()
 {
-  useit (filelocal);
-  useit (filelocal_bss);
-  useit (filelocal_ro);
+  useitp (&filelocal);
+  useitp (&filelocal_bss);
+  useitp (&filelocal_ro);
 }
 
 void init0 ()
@@ -68,7 +66,7 @@ int
 useit (int val)
 #else
 int
-useit (val)
+useit (val) int val;
 #endif
 {
     static int usedval;
@@ -77,6 +75,20 @@ useit (val)
     return val + sum_upto (0);
 }
 
+#ifdef PROTOTYPES
+int
+useitp (const int *val)
+#else
+int
+useitp (val) const int *val;
+#endif
+{
+    static int usedval;
+
+    usedval = *val;
+    return *val + sum_upto (0);
+}
+
 #ifdef PROTOTYPES
 int
 autovars (int bcd, int abc)
This page took 0.024172 seconds and 4 git commands to generate.