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
This commit is contained in:
William S Fulton 2010-09-03 18:44:01 +00:00
commit 197c8e899d
2 changed files with 13 additions and 3 deletions

View file

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

View file

@ -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;
}