Fixed [ 663632 ] incompatibility with standard cpp.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4257 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2003-02-07 21:17:40 +00:00
commit a17049fe0d

View file

@ -384,7 +384,8 @@ find_args(String *s)
if (c != '(') { if (c != '(') {
/* Not a macro, bail out now! */ /* Not a macro, bail out now! */
Seek(s,pos, SEEK_SET); Seek(s,pos, SEEK_SET);
return args; Delete(args);
return 0;
} }
c = Getc(s); c = Getc(s);
/* Okay. This appears to be a macro so we will start isolating arguments */ /* Okay. This appears to be a macro so we will start isolating arguments */
@ -532,7 +533,7 @@ expand_macro(String_or_char *name, List *args)
assert(mvalue); assert(mvalue);
margs = Getattr(macro,"args"); margs = Getattr(macro,"args");
if (Getattr(macro,"varargs")) { if (args && Getattr(macro,"varargs")) {
isvarargs = 1; isvarargs = 1;
/* Variable length argument macro. We need to collect all of the extra arguments into a single argument */ /* Variable length argument macro. We need to collect all of the extra arguments into a single argument */
if (Len(args) >= (Len(margs)-1)) { if (Len(args) >= (Len(margs)-1)) {
@ -556,7 +557,7 @@ expand_macro(String_or_char *name, List *args)
} }
} }
/* If there are arguments, see if they match what we were given */ /* If there are arguments, see if they match what we were given */
if ((margs) && (Len(margs) != Len(args))) { if (args && (margs) && (Len(margs) != Len(args))) {
if (Len(margs) > (1+isvarargs)) if (Len(margs) > (1+isvarargs))
Swig_error(Getfile(args),Getline(args),"Macro '%s' expects %d arguments\n", name, Len(margs)-isvarargs); Swig_error(Getfile(args),Getline(args),"Macro '%s' expects %d arguments\n", name, Len(margs)-isvarargs);
else if (Len(margs) == (1+isvarargs)) else if (Len(margs) == (1+isvarargs))
@ -581,7 +582,7 @@ expand_macro(String_or_char *name, List *args)
temp = NewString(""); temp = NewString("");
tempa = NewString(""); tempa = NewString("");
if (margs) { if (args && margs) {
l = Len(margs); l = Len(margs);
for (i = 0; i < l; i++) { for (i = 0; i < l; i++) {
DOH *arg, *aname; DOH *arg, *aname;