Variety of preprocessor fixes reported by Sebastien Recio.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4454 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f7d68ac801
commit
d594981a12
1 changed files with 20 additions and 5 deletions
|
|
@ -212,9 +212,18 @@ Hash *Preprocessor_define(const String_or_char *_str, int swigmacro)
|
||||||
Putc(c,macroname);
|
Putc(c,macroname);
|
||||||
} else if (isspace(c)) {
|
} else if (isspace(c)) {
|
||||||
break;
|
break;
|
||||||
|
} else if (c == '\\') {
|
||||||
|
c = Getc(str);
|
||||||
|
if (c != '\n') {
|
||||||
|
Ungetc(c,str);
|
||||||
|
Ungetc('\\',str);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Swig_error(Getfile(str),Getline(str),"Illegal character in macro name\n");
|
/*Swig_error(Getfile(str),Getline(str),"Illegal character in macro name\n");
|
||||||
goto macro_error;
|
goto macro_error; */
|
||||||
|
Ungetc(c,str);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!swigmacro)
|
if (!swigmacro)
|
||||||
|
|
@ -924,6 +933,7 @@ check_id(DOH *s)
|
||||||
{
|
{
|
||||||
static SwigScanner *scan = 0;
|
static SwigScanner *scan = 0;
|
||||||
int c;
|
int c;
|
||||||
|
int hastok = 0;
|
||||||
|
|
||||||
Seek(s,0,SEEK_SET);
|
Seek(s,0,SEEK_SET);
|
||||||
|
|
||||||
|
|
@ -936,10 +946,11 @@ check_id(DOH *s)
|
||||||
Seek(s,SEEK_SET,0);
|
Seek(s,SEEK_SET,0);
|
||||||
SwigScanner_push(scan,s);
|
SwigScanner_push(scan,s);
|
||||||
while ((c = SwigScanner_token(scan))) {
|
while ((c = SwigScanner_token(scan))) {
|
||||||
|
hastok = 1;
|
||||||
if ((c == SWIG_TOKEN_ID) || (c == SWIG_TOKEN_LBRACE) || (c == SWIG_TOKEN_RBRACE)) return 1;
|
if ((c == SWIG_TOKEN_ID) || (c == SWIG_TOKEN_LBRACE) || (c == SWIG_TOKEN_RBRACE)) return 1;
|
||||||
}
|
}
|
||||||
|
if (!hastok) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* addline(). Utility function for adding lines to a chunk */
|
/* addline(). Utility function for adding lines to a chunk */
|
||||||
|
|
@ -1140,8 +1151,12 @@ Preprocessor_parse(String *s)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 44:
|
case 44:
|
||||||
if (c == '\n') cpp_lines++;
|
if (c == '\n') {
|
||||||
Putc(c,value);
|
Putc(c,value);
|
||||||
|
cpp_lines++;
|
||||||
|
} else {
|
||||||
|
Ungetc(c,s);
|
||||||
|
}
|
||||||
state = 43;
|
state = 43;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue