]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.fortran/mixed-lang-stack.c
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / mixed-lang-stack.c
1 /* Copyright 2020-2024 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 <stdio.h>
17 #include <complex.h>
18 #include <string.h>
19
20 struct some_struct
21 {
22 float a, b;
23 };
24
25 /* See https://gcc.gnu.org/onlinedocs/gfortran/\
26 Argument-passing-conventions.html. */
27 #if !defined (__GNUC__) || __GNUC__ > 7
28 typedef size_t fortran_charlen_t;
29 #else
30 typedef int fortran_charlen_t;
31 #endif
32
33 extern void mixed_func_1d_ (int *, float *, double *, complex float *,
34 char *, fortran_charlen_t);
35
36 void
37 mixed_func_1c (int a, float b, double c, complex float d, char *f,
38 struct some_struct *g)
39 {
40 printf ("a = %d, b = %f, c = %e, d = (%f + %fi)\n", a, b, c,
41 creal(d), cimag(d));
42
43 char *string = "this is a string from C";
44 mixed_func_1d_ (&a, &b, &c, &d, string, strlen (string));
45 }