Only recognise spaceship operator for C++

I don't think any valid C program can contain `<=>` in a tokenisable
context, but it's more helpful to fail with a syntax error at SWIG
parse time and not potentially generate C code trying to use `<=>` in
an expression which then fails at compile time.
This commit is contained in:
Olly Betts 2022-07-27 13:32:20 +12:00
commit 100d4d5350
3 changed files with 5 additions and 1 deletions

View file

@ -896,7 +896,7 @@ static int look(Scanner *s) {
else if (c == '=') {
if ((c = nextchar(s)) == 0) {
return SWIG_TOKEN_LTEQUAL;
} else if (c == '>') { /* Spaceship operator */
} else if (c == '>' && cparse_cplusplus) { /* Spaceship operator */
return SWIG_TOKEN_LTEQUALGT;
} else {
retract(s, 1);