Issue error for missing ; after %constant

Previously there was no warning or error, no files were produced,
but exit status was 0.

Fixes #346
This commit is contained in:
Olly Betts 2022-01-27 15:35:24 +13:00
commit 282e4ed4ab
3 changed files with 8 additions and 0 deletions

View file

@ -0,0 +1,3 @@
%module xxx
%constant int BAR=0
int foo(int);

View file

@ -0,0 +1 @@
swig_constant_missing_semi.i:3: Warning 305: Bad constant value (ignored).

View file

@ -2010,6 +2010,10 @@ constant_directive : CONSTANT identifier EQUAL definetype SEMI {
Swig_warning(WARN_PARSE_BAD_VALUE,cparse_file,cparse_line,"Bad constant value (ignored).\n");
$$ = 0;
}
| CONSTANT error YYEOF {
Swig_error(cparse_file,cparse_line,"Missing ';' after %%constant.\n");
SWIG_exit(EXIT_FAILURE);
}
;
/* ------------------------------------------------------------