xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.fortran/mixed-lang-stack.cpp (revision 6881a4007f077b54e5f51159c52b9b25f57deb0d)
1*6881a400Schristos /* Copyright 2020-2023 Free Software Foundation, Inc.
27d62b00eSchristos 
37d62b00eSchristos    This program is free software; you can redistribute it and/or modify
47d62b00eSchristos    it under the terms of the GNU General Public License as published by
5*6881a400Schristos    the Free Software Foundation; either version 3 of the License, or
67d62b00eSchristos    (at your option) any later version.
77d62b00eSchristos 
87d62b00eSchristos    This program is distributed in the hope that it will be useful,
97d62b00eSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
107d62b00eSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
117d62b00eSchristos    GNU General Public License for more details.
127d62b00eSchristos 
137d62b00eSchristos    You should have received a copy of the GNU General Public License
147d62b00eSchristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
157d62b00eSchristos 
167d62b00eSchristos #include <cstring>
177d62b00eSchristos #include <cstdlib>
187d62b00eSchristos 
197d62b00eSchristos class base_one
207d62b00eSchristos {
217d62b00eSchristos   int num1 = 1;
227d62b00eSchristos   int num2 = 2;
237d62b00eSchristos   int num3 = 3;
247d62b00eSchristos };
257d62b00eSchristos 
267d62b00eSchristos class base_two
277d62b00eSchristos {
287d62b00eSchristos public:
29*6881a400Schristos   const char *string = "Something in C++";
307d62b00eSchristos   float val = 3.5;
317d62b00eSchristos };
327d62b00eSchristos 
337d62b00eSchristos class derived_type : public base_one, base_two
347d62b00eSchristos {
357d62b00eSchristos public:
367d62b00eSchristos   derived_type ()
377d62b00eSchristos     : base_one (),
387d62b00eSchristos       base_two ()
397d62b00eSchristos   {
407d62b00eSchristos     /* Nothing.  */
417d62b00eSchristos   }
427d62b00eSchristos 
437d62b00eSchristos private:
447d62b00eSchristos   int xxx = 9;
457d62b00eSchristos   float yyy = 10.5;
467d62b00eSchristos };
477d62b00eSchristos 
487d62b00eSchristos static void mixed_func_1f ();
497d62b00eSchristos static void mixed_func_1g ();
507d62b00eSchristos 
517d62b00eSchristos extern "C"
527d62b00eSchristos {
537d62b00eSchristos   /* Entry point to be called from Fortran. */
547d62b00eSchristos   void
557d62b00eSchristos   mixed_func_1e ()
567d62b00eSchristos   {
577d62b00eSchristos     mixed_func_1f ();
587d62b00eSchristos   }
597d62b00eSchristos 
607d62b00eSchristos   /* The entry point back into Fortran.  */
617d62b00eSchristos   extern void mixed_func_1h_ ();
627d62b00eSchristos }
637d62b00eSchristos 
647d62b00eSchristos static void
657d62b00eSchristos mixed_func_1g (derived_type obj)
667d62b00eSchristos {
677d62b00eSchristos   mixed_func_1h_ ();
687d62b00eSchristos }
697d62b00eSchristos 
707d62b00eSchristos static void
717d62b00eSchristos mixed_func_1f () {
727d62b00eSchristos   derived_type obj;
737d62b00eSchristos 
747d62b00eSchristos   mixed_func_1g (obj);
757d62b00eSchristos }
76