From 197c8e899d8d3bf16bf696728cfe8edcd7829a8f Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 3 Sep 2010 18:44:01 +0000 Subject: [PATCH] Fix erroneous line numbers in argument count error messages for macro expansions git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12201 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- CHANGES.current | 10 ++++++++++ Source/Preprocessor/cpp.c | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 6d5cc9327..c09ff3409 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,16 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.1 (in progress) =========================== +2010-09-03: wsfulton + Fix erroneous line numbers in error messages for macro expansions, for example, + the error message now points to instantation of the macro, ie the last line here: + + #define MACRO2(a, b) + + #define MACRO1(NAME) MACRO2(NAME,2,3) + + MACRO1(abc) + 2010-09-02: wsfulton Fix line numbers in error and warning messages for preprocessor messages within %inline, for example: diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index 83ccdfca9..16a9ce1d3 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -773,11 +773,11 @@ static String *expand_macro(String *name, List *args, String *line_file) { /* If there are arguments, see if they match what we were given */ if (args && (margs) && (Len(margs) != Len(args))) { if (Len(margs) > (1 + isvarargs)) - Swig_error(Getfile(args), Getline(args), "Macro '%s' expects %d arguments\n", name, Len(margs) - isvarargs); + Swig_error(macro_start_file, macro_start_line, "Macro '%s' expects %d arguments\n", name, Len(margs) - isvarargs); else if (Len(margs) == (1 + isvarargs)) - Swig_error(Getfile(args), Getline(args), "Macro '%s' expects 1 argument\n", name); + Swig_error(macro_start_file, macro_start_line, "Macro '%s' expects 1 argument\n", name); else - Swig_error(Getfile(args), Getline(args), "Macro '%s' expects no arguments\n", name); + Swig_error(macro_start_file, macro_start_line, "Macro '%s' expects no arguments\n", name); macro_level--; return 0; }