OSDN Git Service

Updated copyright notices for most files.
[pf3gnuchains/pf3gnuchains3x.git] / gdb / testsuite / gdb.base / call-sc.c
1 /* This testcase is part of GDB, the GNU debugger.
2
3    Copyright 2004, 2007, 2008 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 */
19
20 /* Useful abreviations.  */
21 typedef void t;
22 typedef char tc;
23 typedef short ts;
24 typedef int ti;
25 typedef long tl;
26 typedef long long tll;
27 typedef float tf;
28 typedef double td;
29 typedef long double tld;
30 typedef enum { e = '1' } te;
31
32 /* Force the type of each field.  */
33 #ifndef T
34 typedef t T;
35 #endif
36
37 T foo = '1', L;
38
39 T fun()
40 {
41   return foo;  
42 }
43
44 #ifdef PROTOTYPES
45 void Fun(T foo)
46 #else
47 void Fun(foo)
48      T foo;
49 #endif
50 {
51   L = foo;
52 }
53
54 zed ()
55 {
56   L = 'Z';
57 }
58
59 int main()
60 {
61 #ifdef usestubs
62   set_debug_traps();
63   breakpoint();
64 #endif
65   int i;
66
67   Fun(foo);     
68
69   /* An infinite loop that first clears all the variables and then
70      calls the function.  This "hack" is to make re-testing easier -
71      "advance fun" is guaranteed to have always been preceeded by a
72      global variable clearing zed call.  */
73
74   zed ();
75   while (1)
76     {
77       L = fun ();       
78       zed ();
79     }
80
81   return 0;
82 }