- Normalize the 'Swig_error' calls and formats, before some

of the strings start like "Error. XXX", others like "XXX".
  The format is now defined in 'error.c:Swig_error_msg_format()'.

- Normalize the multiline error/warning messages to correctly
  use -Fformat definition.

- Centralize the error/warning format definitions in
  'error.c:Swig_error_msg_format()'.

- Fix a minor error in cpp.c, that after finding an error, still
  was emitting a redefined macro, producing duplicated error/warning
  messages in parser.y.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5635 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-01-15 08:33:12 +00:00
commit 48d11474ee
8 changed files with 65 additions and 41 deletions

View file

@ -345,7 +345,6 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
/* Go create the macro */
macro = NewHash();
Setattr(macro,"name", macroname);
Delete(macroname);
if (arglist) {
Setattr(macro,"args",arglist);
Delete(arglist);
@ -362,17 +361,23 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
}
symbols = Getattr(cpp,"symbols");
if ((m1 = Getattr(symbols,macroname))) {
if (Cmp(Getattr(m1,"value"),macrovalue))
Swig_error(Getfile(str),Getline(str),"Macro '%s' redefined. Previous definition in \'%s\', Line %d\n", macroname, Getfile(m1), Getline(m1));
if (Cmp(Getattr(m1,"value"),macrovalue)) {
Swig_error(Getfile(str),Getline(str),"Macro '%s' redefined,\n",macroname);
Swig_error(Getfile(m1),Getline(m1),"previous definition of '%s'.\n",macroname);
goto macro_error;
}
}
Setattr(symbols,macroname,macro);
Delete(str);
Delete(argstr);
Delete(macroname);
return macro;
macro_error:
Delete(str);
Delete(argstr);
Delete(macroname);
return 0;
}