Parser is failing on a compiler switch. Can these types of things be accounted for?
CODE:
from CppHeaderParser import CppHeader code1 = """ enum myEnum1 { en1, eb2, en3, } __attribute__((packed)); """ code2 = """ enum myEnum2 { en1, eb2, en3, } #if MACRO_TO_PACK __attribute__((packed)); #else ; #endif """ cppheader = CppHeader(code2, argType="string") print cppheader
OUTPUT code1:
Traceback (most recent call last):
File "C:\eclipse_wa_python_local\t4\defect01.py", line 10, in <module>
cppheader = CppHeader(code, argType="string")
File "/cygdrive/c/eclipse_wa_python_local/t4/CppHeaderParser/CppHeaderParser.py", line 2197, in init
% (self.headerFileName, tok.lineno, tok.value, " ".join(self.nameStack)))
CppHeaderParser.CppHeaderParser.CppParseError: Not able to parse on line 7 evaluating ";"
Error around: myEnum (
OUTPUT code2:
Traceback (most recent call last):
File "C:\eclipse_wa_python_local\t4\defect01.py", line 26, in <module>
cppheader = CppHeader(code2, argType="string")
File "/cygdrive/c/eclipse_wa_python_local/t4/CppHeaderParser/CppHeaderParser.py", line 2197, in init
% (self.headerFileName, tok.lineno, tok.value, " ".join(self.nameStack)))
CppHeaderParser.CppHeaderParser.CppParseError: Not able to parse on line 9 evaluating ";"
Error around: attribute ( ( packed ) )
For code2: CppHeaderParser doesnt handle macros including #if statements. Those statements will break the parser. #defines are too complex to handle, expecially considering that definitions can be environmental or defined in #include files which are in a search path etc.
Fixed as of commit 112:e76db7fdfb27
To be clear code1 is fixed, code2 wont be fixed
Ok. Thanks. I'll see what we can do in the header.
Closing as fixed