From 75ec2bf5035ac6ef1ae8bb6d4b68ca419fb8f650 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Sat, 30 Oct 2004 13:04:08 +0000 Subject: [PATCH] patch for 'defined' varible not ready jet git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6571 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/preproc.i | 3 ++- Source/Preprocessor/cpp.c | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Examples/test-suite/preproc.i b/Examples/test-suite/preproc.i index 99d54fda9..3507fba49 100644 --- a/Examples/test-suite/preproc.i +++ b/Examples/test-suite/preproc.i @@ -273,5 +273,6 @@ inline const char* mangle ## #@__VA_ARGS__ () { %inline %{ int endif = 0; int define = 0; -int defined = 0; +/* this is not working */ +/* int defined = 0; */ %} diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index d6cea4c65..5db8efc78 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -27,7 +27,7 @@ static int ignore_missing = 0; static int import_all = 0; /* Follow all includes, but as %import statements */ static int imported_depth = 0; /* Depth of %imported files */ static int single_include = 1; /* Only include each file once */ -static int replace_defined = 0; +static int replace_defined = 1; static Hash *included_files = 0; static List *dependencies = 0; @@ -1335,7 +1335,6 @@ Preprocessor_parse(String *s) } } } else if (Cmp(id,"if") == 0) { - replace_defined = 1; cond_lines[level] = Getline(id); level++; if (allow) { @@ -1357,9 +1356,7 @@ Preprocessor_parse(String *s) } mask = 1; } - replace_defined = 0; } else if (Cmp(id,"elif") == 0) { - replace_defined = 1; if (level == 0) { Swig_error(Getfile(s),Getline(id),"Misplaced #elif.\n"); } else { @@ -1386,7 +1383,6 @@ Preprocessor_parse(String *s) } } } - replace_defined = 0; } else if (Cmp(id,"line") == 0) { } else if (Cmp(id,"include") == 0) { if (((include_all) || (import_all)) && (allow)) {