Imported Upstream version 7.9
[platform/upstream/gdb.git] / gdb / testsuite / gdb.base / structs.c
index 62b227a..82fd47c 100644 (file)
@@ -1,6 +1,6 @@
 /* This testcase is part of GDB, the GNU debugger.
 
-   Copyright 1996, 1999, 2003, 2007-2012 Free Software Foundation, Inc.
+   Copyright 1996-2015 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -193,169 +193,80 @@ struct struct18 fun18()
   return foo18; 
 }
 
-#ifdef PROTOTYPES
 void Fun1(struct struct1 foo1)
-#else
-void Fun1(foo1)
-     struct struct1 foo1;
-#endif
 {
   L1 = foo1;
 }
-#ifdef PROTOTYPES
 void Fun2(struct struct2 foo2)
-#else
-void Fun2(foo2)
-     struct struct2 foo2;
-#endif
 {
   L2 = foo2;
 }
-#ifdef PROTOTYPES
 void Fun3(struct struct3 foo3)
-#else
-void Fun3(foo3)
-     struct struct3 foo3;
-#endif
 {
   L3 = foo3;
 }
-#ifdef PROTOTYPES
 void Fun4(struct struct4 foo4)
-#else
-void Fun4(foo4)
-     struct struct4 foo4;
-#endif
 {
   L4 = foo4;
 }
-#ifdef PROTOTYPES
 void Fun5(struct struct5 foo5)
-#else
-void Fun5(foo5)
-     struct struct5 foo5;
-#endif
 {
   L5 = foo5;
 }
-#ifdef PROTOTYPES
 void Fun6(struct struct6 foo6)
-#else
-void Fun6(foo6)
-     struct struct6 foo6;
-#endif
 {
   L6 = foo6;
 }
-#ifdef PROTOTYPES
 void Fun7(struct struct7 foo7)
-#else
-void Fun7(foo7)
-     struct struct7 foo7;
-#endif
 {
   L7 = foo7;
 }
-#ifdef PROTOTYPES
 void Fun8(struct struct8 foo8)
-#else
-void Fun8(foo8)
-     struct struct8 foo8;
-#endif
 {
   L8 = foo8;
 }
-#ifdef PROTOTYPES
 void Fun9(struct struct9 foo9)
-#else
-void Fun9(foo9)
-     struct struct9 foo9;
-#endif
 {
   L9 = foo9;
 }
-#ifdef PROTOTYPES
 void Fun10(struct struct10 foo10)
-#else
-void Fun10(foo10)
-     struct struct10 foo10;
-#endif
 {
   L10 = foo10; 
 }
-#ifdef PROTOTYPES
 void Fun11(struct struct11 foo11)
-#else
-void Fun11(foo11)
-     struct struct11 foo11;
-#endif
 {
   L11 = foo11; 
 }
-#ifdef PROTOTYPES
 void Fun12(struct struct12 foo12)
-#else
-void Fun12(foo12)
-     struct struct12 foo12;
-#endif
 {
   L12 = foo12; 
 }
-#ifdef PROTOTYPES
 void Fun13(struct struct13 foo13)
-#else
-void Fun13(foo13)
-     struct struct13 foo13;
-#endif
 {
   L13 = foo13; 
 }
-#ifdef PROTOTYPES
 void Fun14(struct struct14 foo14)
-#else
-void Fun14(foo14)
-     struct struct14 foo14;
-#endif
 {
   L14 = foo14; 
 }
-#ifdef PROTOTYPES
 void Fun15(struct struct15 foo15)
-#else
-void Fun15(foo15)
-     struct struct15 foo15;
-#endif
 {
   L15 = foo15; 
 }
-#ifdef PROTOTYPES
 void Fun16(struct struct16 foo16)
-#else
-void Fun16(foo16)
-     struct struct16 foo16;
-#endif
 {
   L16 = foo16; 
 }
-#ifdef PROTOTYPES
 void Fun17(struct struct17 foo17)
-#else
-void Fun17(foo17)
-     struct struct17 foo17;
-#endif
 {
   L17 = foo17; 
 }
-#ifdef PROTOTYPES
 void Fun18(struct struct18 foo18)
-#else
-void Fun18(foo18)
-     struct struct18 foo18;
-#endif
 {
   L18 = foo18; 
 }
 
+void
 zed ()
 {
 
@@ -425,12 +336,14 @@ int main()
   Fun17(foo17);
   Fun18(foo18);
 
-  /* An infinite loop that first clears all the variables and then
+  /* An (almost-)infinite loop that first clears all the variables and then
      calls each function.  This "hack" is to make testing random
      functions easier - "advance funN" is guaranteed to have always
-     been preceded by a global variable clearing zed call.  */
+     been preceded by a global variable clearing zed call.
+     We don't let this run forever in case gdb crashes while testing,
+     we don't want to be left eating all cpu on the user's system.  */
 
-  while (1)
+  for (i = 0; i < 1000000; ++i)
     {
       zed ();
       L1  = fun1();