fix cpp + defined variable name

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6570 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-10-30 12:27:55 +00:00
commit 2fe4996068

View file

@ -1096,9 +1096,7 @@ Preprocessor_parse(String *s)
case 0: /* Initial state - in first column */ case 0: /* Initial state - in first column */
/* Look for C preprocessor directives. Otherwise, go directly to state 1 */ /* Look for C preprocessor directives. Otherwise, go directly to state 1 */
if (c == '#') { if (c == '#') {
replace_defined = 1;
add_chunk(ns,chunk,allow); add_chunk(ns,chunk,allow);
replace_defined = 0;
copy_location(s,chunk); copy_location(s,chunk);
cpp_lines = 1; cpp_lines = 1;
state = 40; state = 40;
@ -1337,6 +1335,7 @@ Preprocessor_parse(String *s)
} }
} }
} else if (Cmp(id,"if") == 0) { } else if (Cmp(id,"if") == 0) {
replace_defined = 1;
cond_lines[level] = Getline(id); cond_lines[level] = Getline(id);
level++; level++;
if (allow) { if (allow) {
@ -1358,7 +1357,9 @@ Preprocessor_parse(String *s)
} }
mask = 1; mask = 1;
} }
replace_defined = 0;
} else if (Cmp(id,"elif") == 0) { } else if (Cmp(id,"elif") == 0) {
replace_defined = 1;
if (level == 0) { if (level == 0) {
Swig_error(Getfile(s),Getline(id),"Misplaced #elif.\n"); Swig_error(Getfile(s),Getline(id),"Misplaced #elif.\n");
} else { } else {
@ -1385,6 +1386,7 @@ Preprocessor_parse(String *s)
} }
} }
} }
replace_defined = 0;
} else if (Cmp(id,"line") == 0) { } else if (Cmp(id,"line") == 0) {
} else if (Cmp(id,"include") == 0) { } else if (Cmp(id,"include") == 0) {
if (((include_all) || (import_all)) && (allow)) { if (((include_all) || (import_all)) && (allow)) {
@ -1457,9 +1459,7 @@ Preprocessor_parse(String *s)
} }
/* %#cpp - an embedded C preprocessor directive (we strip off the %) */ /* %#cpp - an embedded C preprocessor directive (we strip off the %) */
else if (c == '#') { else if (c == '#') {
replace_defined = 1;
add_chunk(ns,chunk,allow); add_chunk(ns,chunk,allow);
replace_defined = 0;
Putc(c,chunk); Putc(c,chunk);
state = 107; state = 107;
} else if (isidentifier(c)) { } else if (isidentifier(c)) {