Fix garbage line number and empty file name reporting for some '}' or ')' error messages

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13976 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-12-16 13:56:50 +00:00
commit 093dc60d2d
6 changed files with 32 additions and 2 deletions

View file

@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.9 (in progress)
===========================
2012-12-16: wsfulton
Fix garbage line number / empty file name reporting for some missing
'}' or ')' error messages.
2012-12-15: kkaempf
[Ruby] Apply patch 3530444, Class#methods and Class#constants returns array of
symbols in Ruby 1.9+

View file

@ -0,0 +1,13 @@
%module xxx
%inline %{
class Klass {
Klass(int i) : m_i(
{
}
};
%}
void something() {
}

View file

@ -46,7 +46,7 @@ c_long_short.i:5: Error: Extra long specifier.
c_long_short.i:6: Error: Extra short specifier.
:::::::::::::::::::::::::::::::: c_missing_rbrace.i :::::::::::::::::::::::::::::::::::
:168430090: Error: Missing '}'. Reached end of input.
c_missing_rbrace.i:3: Error: Missing '}'. Reached end of input.
c_missing_rbrace.i:3: Error: Syntax error in input(1).
:::::::::::::::::::::::::::::::: c_missing_semi.i :::::::::::::::::::::::::::::::::::
@ -296,6 +296,10 @@ cpp_macro_locator.i:97: Warning 509: as it is shadowed by overloadinline2(int *)
cpp_macro_locator.i:101: Warning 509: Overloaded method overload5(int const *) effectively ignored,
cpp_macro_locator.i:100: Warning 509: as it is shadowed by overload5(int *).
:::::::::::::::::::::::::::::::: cpp_missing_rparenthesis.i :::::::::::::::::::::::::::::::::::
cpp_missing_rparenthesis.i:5: Error: Missing ')'. Reached end of input.
cpp_missing_rparenthesis.i:5: Error: Syntax error in input(3).
:::::::::::::::::::::::::::::::: cpp_missing_rtemplate.i :::::::::::::::::::::::::::::::::::
cpp_missing_rtemplate.i:4: Error: Syntax error in input(1).

View file

@ -70,6 +70,7 @@ cpp_extend_undefined
cpp_inline_namespace
cpp_inherit
cpp_macro_locator
cpp_missing_rparenthesis
cpp_missing_rtemplate
cpp_namespace_alias
cpp_namespace_aliasnot

View file

@ -103,10 +103,11 @@ void start_inline(char *text, int line) {
* ----------------------------------------------------------------------------- */
void skip_balanced(int startchar, int endchar) {
int start_line = Scanner_line(scan);
Clear(scanner_ccode);
if (Scanner_skip_balanced(scan,startchar,endchar) < 0) {
Swig_error(Scanner_file(scan),Scanner_errline(scan), "Missing '%c'. Reached end of input.\n", endchar);
Swig_error(cparse_file, start_line, "Missing '%c'. Reached end of input.\n", endchar);
return;
}

View file

@ -65,6 +65,7 @@ Scanner *NewScanner(void) {
s->text = NewStringEmpty();
s->str = 0;
s->error = 0;
s->error_line = 0;
s->freeze_line = 0;
return s;
}
@ -104,6 +105,12 @@ void Scanner_clear(Scanner * s) {
s->nexttoken = -1;
s->start_line = 0;
s->yylen = 0;
/* Should these be cleared too?
s->idstart;
s->file;
s->error_line;
s->freeze_line;
*/
}
/* -----------------------------------------------------------------------------