diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2010-09-10 23:44:27 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2010-09-10 23:44:27 +0000 |
commit | f82811dbcd135f37544d20d75354efe70f5d548d (patch) | |
tree | afa79d279646f31445dc38c0330b03dac1cf2daf /Source/Preprocessor | |
parent | 4435fe4f4adec4c04d6c1df1949dfc3080d85fd4 (diff) | |
download | swig-f82811dbcd135f37544d20d75354efe70f5d548d.tar.gz |
Fix incorrect line number reporting in errors/warnings after parsing macro invocations with parameters given over more than one line.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12214 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Source/Preprocessor')
-rw-r--r-- | Source/Preprocessor/cpp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index bb56c21d2..23896fc50 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -1075,10 +1075,14 @@ static DOH *Preprocessor_replace(DOH *s) { /* See if the macro is defined in the preprocessor symbol table */ DOH *args = 0; DOH *e; + int macro_additional_lines = 0; /* See if the macro expects arguments */ if (Getattr(m, kpp_args)) { /* Yep. We need to go find the arguments and do a substitution */ + int line = Getline(s); args = find_args(s, 1, id); + macro_additional_lines = Getline(s) - line; + assert(macro_additional_lines >= 0); if (!Len(args)) { Delete(args); args = 0; @@ -1090,6 +1094,9 @@ static DOH *Preprocessor_replace(DOH *s) { if (e) { Append(ns, e); } + while (macro_additional_lines--) { + Putc('\n', ns); + } Delete(e); Delete(args); } else { |