[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gfortran.dg / c_f_tests_driver.c
blob5079cf7990024b9f02a9e06ffad0c7c979bb5aa5
1 extern void abort(void);
3 typedef struct myCDerived
5 int cInt;
6 double cDouble;
7 float cFloat;
8 short cShort;
9 void *ptr;
10 }myCDerived_t;
12 #define DERIVED_ARRAY_LEN 10
13 #define ARRAY_LEN_2 3
14 #define DIM1 2
15 #define DIM2 3
17 void testDerivedPtrs(myCDerived_t *cDerivedPtr,
18 myCDerived_t *derivedArray, int arrayLen,
19 myCDerived_t *derived2d, int dim1, int dim2);
21 int main(int argc, char **argv)
23 myCDerived_t cDerived;
24 myCDerived_t derivedArray[DERIVED_ARRAY_LEN];
25 myCDerived_t derived2DArray[DIM1][DIM2];
26 int i = 0;
27 int j = 0;
29 cDerived.cInt = 1;
30 cDerived.cDouble = 2.0;
31 cDerived.cFloat = 3.0;
32 cDerived.cShort = 4;
33 /* cDerived.ptr = NULL; */
34 /* nullify the ptr */
35 cDerived.ptr = 0;
37 for(i = 0; i < DERIVED_ARRAY_LEN; i++)
39 derivedArray[i].cInt = (i+1) * 1;
40 derivedArray[i].cDouble = (i+1) * 1.0; /* 2.0; */
41 derivedArray[i].cFloat = (i+1) * 1.0; /* 3.0; */
42 derivedArray[i].cShort = (i+1) * 1; /* 4; */
43 /* derivedArray[i].ptr = NULL; */
44 derivedArray[i].ptr = 0;
47 for(i = 0; i < DIM1; i++)
49 for(j = 0; j < DIM2; j++)
51 derived2DArray[i][j].cInt = ((i*DIM1) * 1) + j;
52 derived2DArray[i][j].cDouble = ((i*DIM1) * 1.0) + j;
53 derived2DArray[i][j].cFloat = ((i*DIM1) * 1.0) + j;
54 derived2DArray[i][j].cShort = ((i*DIM1) * 1) + j;
55 /* derived2DArray[i][j].ptr = NULL; */
56 derived2DArray[i][j].ptr = 0;
60 /* send in the transpose size (dim2 is dim1, dim1 is dim2) */
61 testDerivedPtrs(&cDerived, derivedArray, DERIVED_ARRAY_LEN,
62 derived2DArray[0], DIM2, DIM1);
64 return 0;
65 }/* end main() */