Small corrections for handling C99 _Complex

This commit is contained in:
Leo Singer 2020-06-16 19:55:50 -04:00
commit 1adc7dac5d
7 changed files with 6 additions and 18 deletions

View file

@ -908,10 +908,6 @@ 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) {
yylval.type = NewSwigType(T_COMPLEX);
return (TYPE_COMPLEX);
}
if (strcmp(yytext, "_Complex") == 0) {
yylval.type = NewSwigType(T_COMPLEX);
return (TYPE_COMPLEX);

View file

@ -6232,18 +6232,18 @@ 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 || Cmp($2.type,"_Complex") == 0) {
} 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 || Cmp($2.type,"_Complex") == 0) {
if (Cmp($2.type,"_Complex") == 0) {
$$.type = NewString("float _Complex");
} else {
err = 1;
}
} else if (Cmp($1.type,"complex") == 0 || Cmp($1.type,"_Complex") == 0) {
} else if (Cmp($1.type,"_Complex") == 0) {
$$.type = NewStringf("%s _Complex", $2.type);
} else {
err = 1;