Fix __LINE__ and __FILE__ expansion in macros with no arguments

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12197 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-09-01 21:06:10 +00:00
commit aa728ece67
3 changed files with 23 additions and 6 deletions

View file

@ -45,5 +45,8 @@ public class preproc_line_file_runme {
if (SillyStruct.LINE_NUMBER != 41)
throw new RuntimeException("preproc failure");
if (SillyMacroClass.LINE_NUM != 45)
throw new RuntimeException("preproc failure");
}
}

View file

@ -40,3 +40,13 @@ struct SillyStruct {
int num;
static const int LINE_NUMBER = __LINE__; /* This is a C test case, but we can still use a C++ feature to wrap a constant to test __LINE__ here */
};
#define SILLY_CLASS struct SillyMacroClass { int num; static const int LINE_NUM = __LINE__; };
SILLY_CLASS
%{
#define SILLY_CLASS struct SillyMacroClass { int num; };
SILLY_CLASS
%}