@
Cenizafirstly, thanks for the hint, the calculation of expression value in your CCPP code is still a bit hard for me, so you can see, in CC_BRANCH, we still use another way. (CC_branch has a way to calculate the #if XXX kind of conditional preprocessor value now).
I have some time to test your CCPP project. I'm using it under MinGW.
To build the lib, we need to do a modification in the file:
include\stdstring.h
Under Windows, the function sprintf is not under std namespace, instead, you need to add the #include <cstdio>
/**
\brief Creates a new STDString from an \c int value.
\param value Value to convert.
\return New STDString containing the string representation of
\p value.
*/
static STDString fromInt(int value) { char buffer[24]; std::sprintf(buffer, "%d", value); return STDString(buffer); }
Also, I have find a bug, When I'm running your test-debug target, I set the argument like this:
../../tests/file_line.cpp
So, the file_line.cpp will be parsed.
Here is the log output:
const char * fGetFILE ( ) {
return "bwehehe.h" ;
}
int fGetLINE ( ) {
return 58 ;
}
# define getLINE ( ) 201 int main ( ) {
int line0 = 206 ;
int line1 = getLINE ( ) ;
const char * file1 = "src/test/../../tests/file_line.cpp" ;
int line2 = fGetLINE ( ) ;
const char * file2 = fGetFILE ( ) ;
const char * today = "Jul 04 2010" ;
const char * now = "20:52:31" ;
int cpp = 199711L ;
}
Process returned 0 (0x0) execution time : 0.047 s
Press any key to continue.
See the log :
int line1 = getLINE ( ) ;
But in the file_line.cpp, the getLine() is defined by a macro.
file_line.cpp
#line 200
#include "file_line.h"
#define getLINE() __LINE__
int main()
{
#if __LINE__ == 205
int line0 = __LINE__;
#endif
int line1 = getLINE();
const char *file1 = getFILE();
int line2 = fGetLINE();
const char *file2 = fGetFILE();
const char *today = __DATE__;
const char *now = __TIME__;
int cpp = __cplusplus;
}
So, it should output the current line number instead of getLINE().
BTW: it seems the CCPP project was currently develop freeze, would like to improve it or you just abandon it?
Thanks.