diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2010-09-03 06:03:48 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2010-09-03 06:03:48 +0000 |
commit | a44f83cf0538c48c47ebae71545269fa0fa04a64 (patch) | |
tree | f1bf42b099ff5a010a4576a77554bd010e8fd360 /Source/Preprocessor | |
parent | 1e6ed0843fdc303abffab1e117b062e6c26de4fa (diff) | |
download | swig-a44f83cf0538c48c47ebae71545269fa0fa04a64.tar.gz |
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.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12199 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Source/Preprocessor')
-rw-r--r-- | Source/Preprocessor/cpp.c | 13 |
1 files changed, 8 insertions, 5 deletions
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)) { |