Merge commit '8245277ad3' into c99-complex

* commit '8245277ad3':
  Remove test for unsupported complex or _Complex by itself
  More C99 complex fixes, plus Python tests
  Restore _Complex as standalone type
  Small corrections for handling C99 _Complex
  Properly handle C99 complex types even in C++ mode

Conflicts:
	Examples/test-suite/python/complextest_runme.py
This commit is contained in:
William S Fulton 2020-10-10 14:53:33 +01:00
commit 4f184500d7
9 changed files with 99 additions and 41 deletions

View file

@ -908,7 +908,7 @@ int yylex(void) {
if (strcmp(yytext, "class") == 0) {
Swig_warning(WARN_PARSE_CLASS_KEYWORD, cparse_file, cparse_line, "class keyword used, but not in C++ mode.\n");
}
if (strcmp(yytext, "complex") == 0) {
if (strcmp(yytext, "_Complex") == 0) {
yylval.type = NewSwigType(T_COMPLEX);
return (TYPE_COMPLEX);
}

View file

@ -6232,19 +6232,19 @@ primitive_type_list : type_specifier {
} else if (Cmp($1.type,"double") == 0) {
if (Cmp($2.type,"long") == 0) {
$$.type = NewString("long double");
} else if (Cmp($2.type,"complex") == 0) {
$$.type = NewString("double complex");
} else if (Cmp($2.type,"_Complex") == 0) {
$$.type = NewString("double _Complex");
} else {
err = 1;
}
} else if (Cmp($1.type,"float") == 0) {
if (Cmp($2.type,"complex") == 0) {
$$.type = NewString("float complex");
if (Cmp($2.type,"_Complex") == 0) {
$$.type = NewString("float _Complex");
} else {
err = 1;
}
} else if (Cmp($1.type,"complex") == 0) {
$$.type = NewStringf("%s complex", $2.type);
} else if (Cmp($1.type,"_Complex") == 0) {
$$.type = NewStringf("%s _Complex", $2.type);
} else {
err = 1;
}
@ -6294,7 +6294,7 @@ type_specifier : TYPE_INT {
$$.type = 0;
}
| TYPE_COMPLEX {
$$.type = NewString("complex");
$$.type = NewString("_Complex");
$$.us = 0;
}
| TYPE_NON_ISO_INT8 {

View file

@ -1453,11 +1453,11 @@ int SwigType_type(const SwigType *t) {
return T_DOUBLE;
if (strcmp(c, "long double") == 0)
return T_LONGDOUBLE;
if (!cparse_cplusplus && (strcmp(c, "float complex") == 0))
if (!cparse_cplusplus && (strcmp(c, "float _Complex") == 0))
return T_FLTCPLX;
if (!cparse_cplusplus && (strcmp(c, "double complex") == 0))
if (!cparse_cplusplus && (strcmp(c, "double _Complex") == 0))
return T_DBLCPLX;
if (!cparse_cplusplus && (strcmp(c, "complex") == 0))
if (!cparse_cplusplus && (strcmp(c, "_Complex") == 0))
return T_COMPLEX;
if (strcmp(c, "void") == 0)
return T_VOID;