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
5 changed files with 25 additions and 1 deletions
|
|
@ -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)
|
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
|
2020-10-10: lpsinger
|
||||||
#1770 Correct C complex support.
|
#1770 Correct C complex support.
|
||||||
_Complex is now parsed as a keyword rather than complex as per the C99 standard.
|
_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_extend_c \
|
||||||
nested_structs \
|
nested_structs \
|
||||||
newobject2 \
|
newobject2 \
|
||||||
|
not_ckeywords \
|
||||||
overload_extend_c \
|
overload_extend_c \
|
||||||
overload_extend2 \
|
overload_extend2 \
|
||||||
preproc \
|
preproc \
|
||||||
|
|
|
||||||
13
Examples/test-suite/not_c_keywords.i
Normal file
13
Examples/test-suite/not_c_keywords.i
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
%module not_c_keywords
|
||||||
|
|
||||||
|
%extend ComplexStruct {
|
||||||
|
void init() {
|
||||||
|
$self->complex = 123;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
struct ComplexStruct {
|
||||||
|
int complex; /* complex as variable name */
|
||||||
|
};
|
||||||
|
%}
|
||||||
7
Examples/test-suite/python/not_c_keywords_runme.py
Normal file
7
Examples/test-suite/python/not_c_keywords_runme.py
Normal file
|
|
@ -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");
|
return NewString("double");
|
||||||
break;
|
break;
|
||||||
case T_COMPLEX:
|
case T_COMPLEX:
|
||||||
return NewString("complex");
|
return NewString("_Complex");
|
||||||
break;
|
break;
|
||||||
case T_CHAR:
|
case T_CHAR:
|
||||||
return NewString("char");
|
return NewString("char");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue