diff --git a/CHANGES.current b/CHANGES.current index 90391fbfb..7213a66c0 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,10 +5,18 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.1 (in progress) =========================== +2010-09-02: wsfulton + Fix line numbers in error and warning messages which were accumulately one + less than they should have been after parsing each %include/%import - bug + introduced in swig-1.3.32. Also fix line numbers in error and warning messages + when new line characters appear between the %include / %import statement and + the filename. + 2010-08-30: wsfulton Fix line number and file name reporting for some macro preprocessor warnings. The line number of the macro argument has been corrected and the line number - of the start of the macro instead of one past the end is used. Some examples: + of the start of the macro instead of one past the end of the macro is used. + Some examples: file.h:11: Error: Illegal macro argument name '..' file.h:19: Error: Macro 'DUPLICATE' redefined, file.h:15: Error: previous definition of 'DUPLICATE'. @@ -50,7 +58,7 @@ Version 2.0.1 (in progress) adjust your regular expressions syntax as the new regex encoder uses Perl-compatible syntax and not (extended) POSIX syntax as the old one. - *** POTENTIAL INCOMPATIBILITY *** + *** POTENTIAL INCOMPATIBILITY *** 2010-07-13: vadz Add "regexmatch", "regextarget" and "notregexmatch" which can be diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 6e41fa565..f0df6684d 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -2121,7 +2121,7 @@ include_directive: includetype options string LBRACKET { } interface RBRACKET { String *mname = 0; $$ = $6; - scanner_set_location($1.filename,$1.line); + scanner_set_location($1.filename,$1.line+1); if (strcmp($1.type,"include") == 0) set_nodeType($$,"include"); if (strcmp($1.type,"import") == 0) { mname = $2 ? Getattr($2,"module") : 0; diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index f044e344c..83ccdfca9 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -642,7 +642,6 @@ static String *get_filename(String *str, int *sysfile) { String *fn; int c; - skip_whitespace(str, 0); fn = NewStringEmpty(); copy_location(str, fn); c = Getc(str); @@ -668,9 +667,7 @@ static String *get_filename(String *str, int *sysfile) { } static String *get_options(String *str) { - int c; - skip_whitespace(str, 0); c = Getc(str); if (c == '(') { String *opt; @@ -1648,8 +1645,8 @@ String *Preprocessor_parse(String *s) { pop_imported(); } Delete(s2); + Delete(s1); } - Delete(s1); Delete(fn); } } else if (Equal(id, kpp_pragma)) { @@ -1749,6 +1746,8 @@ String *Preprocessor_parse(String *s) { /* Got some kind of file inclusion directive */ if (allow) { DOH *s1, *s2, *fn, *opt; + String *options_whitespace = NewString(""); + String *filename_whitespace = NewString(""); int sysfile = 0; if (Equal(decl, kpp_dextern)) { @@ -1756,14 +1755,16 @@ String *Preprocessor_parse(String *s) { Clear(decl); Append(decl, "%%import"); } + skip_whitespace(s, options_whitespace); opt = get_options(s); + skip_whitespace(s, filename_whitespace); fn = get_filename(s, &sysfile); s1 = cpp_include(fn, sysfile); if (s1) { char *dirname; copy_location(s, chunk); add_chunk(ns, chunk, allow); - Printf(ns, "%sfile%s \"%s\" [\n", decl, opt, Swig_filename_escape(Swig_last_file())); + Printf(ns, "%sfile%s%s%s\"%s\" [\n", decl, options_whitespace, opt, filename_whitespace, Swig_filename_escape(Swig_last_file())); if (Equal(decl, kpp_dimport)) { push_imported(); } @@ -1787,6 +1788,8 @@ String *Preprocessor_parse(String *s) { Delete(s1); } Delete(fn); + Delete(filename_whitespace); + Delete(options_whitespace); } state = 1; } else if (Equal(decl, kpp_dline)) {