mirror of https://github.com/swig/swig
complex can now be used as an identifier
Remove final vestiges of 'complex' keyword. Closes #252
This commit is contained in:
parent
8edb047785
commit
638ca8152d
|
@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.1.0 (in progress)
|
||||
===========================
|
||||
|
||||
2020-10-10: wsfulton
|
||||
#252 complex can now be used as a C identifier and doesn't give a syntax error.
|
||||
|
||||
2020-10-10: lpsinger
|
||||
#1770 Correct C complex support.
|
||||
_Complex is now parsed as a keyword rather than complex as per the C99 standard.
|
||||
|
|
|
@ -718,6 +718,7 @@ C_TEST_CASES += \
|
|||
nested_extend_c \
|
||||
nested_structs \
|
||||
newobject2 \
|
||||
not_ckeywords \
|
||||
overload_extend_c \
|
||||
overload_extend2 \
|
||||
preproc \
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
%module not_c_keywords
|
||||
|
||||
%extend ComplexStruct {
|
||||
void init() {
|
||||
$self->complex = 123;
|
||||
}
|
||||
}
|
||||
|
||||
%inline %{
|
||||
struct ComplexStruct {
|
||||
int complex; /* complex as variable name */
|
||||
};
|
||||
%}
|
|
@ -0,0 +1,7 @@
|
|||
from not_c_keywords import *
|
||||
|
||||
cs = ComplexStruct()
|
||||
cs.init()
|
||||
if cs.complex != 123:
|
||||
raise RuntimeError("complex not correct")
|
||||
cs.complex = 456
|
|
@ -134,7 +134,7 @@ SwigType *NewSwigType(int t) {
|
|||
return NewString("double");
|
||||
break;
|
||||
case T_COMPLEX:
|
||||
return NewString("complex");
|
||||
return NewString("_Complex");
|
||||
break;
|
||||
case T_CHAR:
|
||||
return NewString("char");
|
||||
|
|
Loading…
Reference in New Issue