From 016860e199378098daff8897efebf00783285628 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Thu, 20 Nov 2003 21:37:24 +0000 Subject: [PATCH] Fixed the include/import error reported by Kerim Borchaev git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5359 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/CHANGES.current | 12 ++++++++++++ SWIG/Examples/test-suite/common.mk | 4 ++-- SWIG/Examples/test-suite/python/inctest_runme.py | 1 + SWIG/Examples/test-suite/testdir/subdir1/subinc1.i | 1 + SWIG/Source/Preprocessor/cpp.c | 12 ++++++++---- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/SWIG/CHANGES.current b/SWIG/CHANGES.current index 17144c60a..618c13dcd 100644 --- a/SWIG/CHANGES.current +++ b/SWIG/CHANGES.current @@ -1,5 +1,17 @@ Version 1.3.20 (In progress) ============================ +11/20/2003: mmatus + Fixed the include/import error reported by Kerim Borchaev, + where two files with names like + + 'dir1/hello.i' + 'dir2/hello.i' + + can not be include at the same time. Swig was including + just the first one, assuming the second one was not a + different one, since it was checking/keeping just the + basename 'hello.i'. + 11/19/2003: beazley Changes to the SWIG runtime library support. - The -c command line option has been renamed to -noruntime diff --git a/SWIG/Examples/test-suite/common.mk b/SWIG/Examples/test-suite/common.mk index a2823e44e..9e3afadd3 100644 --- a/SWIG/Examples/test-suite/common.mk +++ b/SWIG/Examples/test-suite/common.mk @@ -56,8 +56,7 @@ CPP_TEST_BROKEN += \ using_namespace # Broken C test cases. (Can be run individually using make testcase.ctest.) -C_TEST_BROKEN += \ - inctest.i +C_TEST_BROKEN += # C++ test cases. (Can be run individually using make testcase.cpptest.) @@ -276,6 +275,7 @@ C_TEST_CASES += \ defines \ enums \ function_typedef \ + inctest.i \ lib_carrays \ lib_cdata \ lib_cmalloc \ diff --git a/SWIG/Examples/test-suite/python/inctest_runme.py b/SWIG/Examples/test-suite/python/inctest_runme.py index 8273c9e67..98cf9e4ff 100644 --- a/SWIG/Examples/test-suite/python/inctest_runme.py +++ b/SWIG/Examples/test-suite/python/inctest_runme.py @@ -1,5 +1,6 @@ import inctest +error = 0 try: a = inctest.A() except: diff --git a/SWIG/Examples/test-suite/testdir/subdir1/subinc1.i b/SWIG/Examples/test-suite/testdir/subdir1/subinc1.i index 159d54b0a..f0b6a6bbd 100644 --- a/SWIG/Examples/test-suite/testdir/subdir1/subinc1.i +++ b/SWIG/Examples/test-suite/testdir/subdir1/subinc1.i @@ -1 +1,2 @@ %include "hello.i" +%include "hello.i" diff --git a/SWIG/Source/Preprocessor/cpp.c b/SWIG/Source/Preprocessor/cpp.c index dcef77d68..12ed4e9cd 100644 --- a/SWIG/Source/Preprocessor/cpp.c +++ b/SWIG/Source/Preprocessor/cpp.c @@ -78,11 +78,15 @@ copy_location(DOH *s1, DOH *s2) { static String *cpp_include(String_or_char *fn) { String *s; - if (single_include) { - if (Getattr(included_files,fn)) return 0; - Setattr(included_files,fn,fn); - } s = Swig_include(fn); + if (single_include) { + String *file = Getfile(s); + if (Getattr(included_files,file)) { + Delete(s); + return 0; + } + Setattr(included_files,file,file); + } if (!s) { Seek(fn,0,SEEK_SET); if (ignore_missing) {