From f82811dbcd135f37544d20d75354efe70f5d548d Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 10 Sep 2010 23:44:27 +0000 Subject: 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 --- Source/Preprocessor/cpp.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Source/Preprocessor') 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 { -- cgit v1.2.1