xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.fortran/mixed-lang-stack.cpp (revision f8cf1a9151c7af1cb0bd8b09c13c66bca599c027)
1 /* Copyright 2020-2023 Free Software Foundation, Inc.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License as published by
5    the Free Software Foundation; either version 3 of the License, or
6    (at your option) any later version.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 
13    You should have received a copy of the GNU General Public License
14    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
15 
16 #include <cstring>
17 #include <cstdlib>
18 
19 class base_one
20 {
21   int num1 = 1;
22   int num2 = 2;
23   int num3 = 3;
24 };
25 
26 class base_two
27 {
28 public:
29   const char *string = "Something in C++";
30   float val = 3.5;
31 };
32 
33 class derived_type : public base_one, base_two
34 {
35 public:
36   derived_type ()
37     : base_one (),
38       base_two ()
39   {
40     /* Nothing.  */
41   }
42 
43 private:
44   int xxx = 9;
45   float yyy = 10.5;
46 };
47 
48 static void mixed_func_1f ();
49 static void mixed_func_1g ();
50 
51 extern "C"
52 {
53   /* Entry point to be called from Fortran. */
54   void
55   mixed_func_1e ()
56   {
57     mixed_func_1f ();
58   }
59 
60   /* The entry point back into Fortran.  */
61   extern void mixed_func_1h_ ();
62 }
63 
64 static void
65 mixed_func_1g (derived_type obj)
66 {
67   mixed_func_1h_ ();
68 }
69 
70 static void
71 mixed_func_1f () {
72   derived_type obj;
73 
74   mixed_func_1g (obj);
75 }
76