Skip to content

Commit 128ef37

Browse files
committed
Split complextest into separate C and C++
1 parent 5177f08 commit 128ef37

File tree

3 files changed

+29
-26
lines changed

3 files changed

+29
-26
lines changed

Examples/test-suite/complextest.i

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
%include <complex.i>
44

5-
#ifdef __cplusplus
65
%{
76
#include <algorithm>
87
#include <functional>
@@ -62,27 +61,3 @@
6261
return b;
6362
}
6463
}
65-
66-
67-
#else
68-
69-
70-
%{
71-
%}
72-
73-
%inline
74-
{
75-
complex Conj(complex a)
76-
{
77-
return conj(a);
78-
}
79-
80-
81-
complex float Conjf(float complex a)
82-
{
83-
return conj(a);
84-
}
85-
}
86-
87-
88-
#endif

Examples/test-suite/complextest_c.i

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
%module complextest_c
2+
3+
%include <complex.i>
4+
5+
/* NOTE: SWIG's parser defines 'complex' as a builtin, whereas it should define
6+
* _Complex and then have `ccomplex.i` add `#define complex _Complex`. */
7+
8+
%inline
9+
{
10+
double _Complex Conj(double _Complex a)
11+
{
12+
return conj(a);
13+
}
14+
15+
/* complex should alias to _Complex when including <complex.h> */
16+
double complex Conj2(double complex a)
17+
{
18+
return conj(a);
19+
}
20+
21+
22+
float _Complex Conjf(float _Complex a)
23+
{
24+
return conj(a);
25+
}
26+
}
27+
28+

Examples/test-suite/python/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ C_TEST_CASES += \
102102
# This test only works with modern C compilers
103103
#
104104
#C_TEST_CASES += \
105-
# complextest
105+
# complextest_c
106106

107107
include $(srcdir)/../common.mk
108108

0 commit comments

Comments
 (0)