diff --git a/CHANGES.current b/CHANGES.current index 5a7c98e9c..22c9a3301 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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+ diff --git a/Examples/test-suite/errors/cpp_missing_rparenthesis.i b/Examples/test-suite/errors/cpp_missing_rparenthesis.i new file mode 100644 index 000000000..5d0627e86 --- /dev/null +++ b/Examples/test-suite/errors/cpp_missing_rparenthesis.i @@ -0,0 +1,13 @@ +%module xxx + +%inline %{ +class Klass { +Klass(int i) : m_i( +{ +} +}; +%} + +void something() { +} + diff --git a/Examples/test-suite/errors/expected.log b/Examples/test-suite/errors/expected.log index 4f56e7146..9d4e5db77 100644 --- a/Examples/test-suite/errors/expected.log +++ b/Examples/test-suite/errors/expected.log @@ -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). diff --git a/Examples/test-suite/errors/make.sh b/Examples/test-suite/errors/make.sh index e243315ec..90f17a92a 100755 --- a/Examples/test-suite/errors/make.sh +++ b/Examples/test-suite/errors/make.sh @@ -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 diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index d4678ffdf..64875a4d1 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -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; } diff --git a/Source/Swig/scanner.c b/Source/Swig/scanner.c index 8b1c6183e..8c4bf26a2 100644 --- a/Source/Swig/scanner.c +++ b/Source/Swig/scanner.c @@ -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; + */ } /* -----------------------------------------------------------------------------