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
This commit is contained in:
William S Fulton 2010-09-10 23:44:27 +00:00
commit f82811dbcd
5 changed files with 50 additions and 0 deletions

View file

@ -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 {