Debian Codegraph @

gcc/testsuite/gfortran.dg/c-interop/typecodes-array-char-c.c

raw
1 #include <stdlib.h>
2 #include <stdint.h>
3 #include <stdio.h>
4 #include <string.h>
5
6 #include <ISO_Fortran_binding.h>
7 #include "dump-descriptors.h"
8
9 extern void ctest_1 (CFI_cdesc_t *arg_char, CFI_cdesc_t *arg_ucs4);
10
11 /* Sanity check the type info in the descriptor a. */
12
13 static void
14 check (CFI_cdesc_t *a, size_t size, int typecode)
15 {
16 dump_CFI_cdesc_t (a);
17 if (a->attribute != CFI_attribute_other)
18 abort ();
19 if (a->base_addr == NULL)
20 abort ();
21 if (a->rank != 1)
22 abort ();
23 if (size && a->elem_len != size)
24 abort ();
25 if (a->type != typecode)
26 abort ();
27 }
28
29 void
30 ctest_1 (CFI_cdesc_t *arg_char, CFI_cdesc_t *arg_ucs4)
31 {
32 check (arg_char, 1, CFI_type_char);
33 check (arg_ucs4, 4, CFI_type_ucs4_char);
34 }
35
36 void
37 ctest_5 (CFI_cdesc_t *arg_char, CFI_cdesc_t *arg_ucs4)
38 {
39 check (arg_char, 5*1, CFI_type_char);
40 check (arg_ucs4, 5*4, CFI_type_ucs4_char);
41 }