Fix Fix #1927852 - #include directives don't preprocess the file passed to it
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12457 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ac42dd8153
commit
e0ee14c3ba
8 changed files with 72 additions and 7 deletions
|
|
@ -494,6 +494,7 @@ C_TEST_CASES += \
|
|||
preproc \
|
||||
preproc_constants_c \
|
||||
preproc_defined \
|
||||
preproc_include \
|
||||
preproc_line_file \
|
||||
ret_by_value \
|
||||
simple_array \
|
||||
|
|
@ -518,6 +519,7 @@ MULTI_CPP_TEST_CASES += \
|
|||
|
||||
# Custom tests - tests with additional commandline options
|
||||
wallkw.cpptest: SWIGOPT += -Wallkw
|
||||
preproc_include.ctest: SWIGOPT += -includeall
|
||||
|
||||
|
||||
NOT_BROKEN_TEST_CASES = $(CPP_TEST_CASES:=.cpptest) \
|
||||
|
|
|
|||
18
Examples/test-suite/preproc_include.i
Normal file
18
Examples/test-suite/preproc_include.i
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
%module preproc_include
|
||||
|
||||
%{
|
||||
#include "preproc_include_a.h"
|
||||
#include "preproc_include_b.h"
|
||||
int multiply10(int a) { return a*10; }
|
||||
int multiply20(int a) { return a*20; }
|
||||
int multiply30(int a) { return a*30; }
|
||||
%}
|
||||
|
||||
#define INCLUDE_B preproc_include_b.h
|
||||
#define FILE_INCLUDE(FNAME) #FNAME
|
||||
|
||||
%include FILE_INCLUDE(preproc_include_a.h)
|
||||
|
||||
// Note that this test uses -includeall, so including preproc_include_b.h also includes preproc_include_c.h
|
||||
%include INCLUDE_B
|
||||
|
||||
3
Examples/test-suite/preproc_include_a.h
Normal file
3
Examples/test-suite/preproc_include_a.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
int multiply10(int a);
|
||||
|
||||
7
Examples/test-suite/preproc_include_b.h
Normal file
7
Examples/test-suite/preproc_include_b.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
int multiply20(int a);
|
||||
|
||||
#define PREPROC_INCLUDE_C "preproc_include_c.h"
|
||||
|
||||
#include PREPROC_INCLUDE_C
|
||||
|
||||
3
Examples/test-suite/preproc_include_c.h
Normal file
3
Examples/test-suite/preproc_include_c.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
int multiply30(int a);
|
||||
|
||||
11
Examples/test-suite/python/preproc_include_runme.py
Normal file
11
Examples/test-suite/python/preproc_include_runme.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import preproc_include
|
||||
|
||||
if preproc_include.multiply10(10) != 100:
|
||||
raise RuntimeError
|
||||
|
||||
if preproc_include.multiply20(10) != 200:
|
||||
raise RuntimeError
|
||||
|
||||
if preproc_include.multiply30(10) != 300:
|
||||
raise RuntimeError
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue