$ wget https://raw.githubusercontent.com/bminor/glibc/glibc-2.32/include/features.h
$ pcpp --passthru-unfound-includes features.h
features.h:432 warning: couldn't evaluate expression due to Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pcpp/preprocessor.py", line 1161, in evalexpr
result = int(eval(expr, evalfuncts, evalvars))
File "<string>", line 1
(0 and (0 < 201103 and not 0) if (0 else ( not 0 or 0 < 199901)))
^
SyntaxError: invalid syntax
Converted expression was (0 and (0 < 201103 and not 0) if (0 else ( not 0 or 0 < 199901))) with evalvars = {}
#line 443 "features.h"
#include <stdc-predef.h>
#line 465 "features.h"
# include <sys/cdefs.h>
#line 489 "features.h"
#include <gnu/stubs.h>
I'll get even more of the same exception when the includes are actually resolved:
$ pcpp -I/usr/include /usr/include/features.h
../features.h:432 warning: couldn't evaluate expression due to Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pcpp/preprocessor.py", line 1161, in evalexpr
result = int(eval(expr, evalfuncts, evalvars))
File "<string>", line 1
(0 and (0 < 201103 and not 0) if (0 else ( not 0 or 0 < 199901)))
^
SyntaxError: invalid syntax
Converted expression was (0 and (0 < 201103 and not 0) if (0 else ( not 0 or 0 < 199901))) with evalvars = {}
../sys/cdefs.h:415 warning: couldn't evaluate expression due to Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pcpp/preprocessor.py", line 1161, in evalexpr
result = int(eval(expr, evalfuncts, evalvars))
File "<string>", line 1
( not 0 and 0 if (0 else 0) < 201112 and not 0)
^
SyntaxError: invalid syntax
Converted expression was ( not 0 and 0 if (0 else 0) < 201112 and not 0) with evalvars = {}
../sys/cdefs.h:444 warning: couldn't evaluate expression due to Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pcpp/preprocessor.py", line 1161, in evalexpr
result = int(eval(expr, evalfuncts, evalvars))
File "<string>", line 1
( not 0 and not 0 and 0 if (0 else 0) < 201112 and ( not 0 or 0))
^
SyntaxError: invalid syntax
Converted expression was ( not 0 and not 0 and 0 if (0 else 0) < 201112 and ( not 0 or 0)) with evalvars = {}
As described in the Readme, the expression evaluator in pcpp is based on a lossy conversion to a Python expression, and for complex expressions this breaks down.
The lines at https://github.com/bminor/glibc/blob/glibc-2.32/include/features.h#L432-L439 throw an exception:
I'll get even more of the same exception when the includes are actually resolved:
I'm using pcpp 1.22