I am trying to creat AST for a kernel file using pyCparser and met ParseError.
I preprocessed the file using command like, and no error generated.
clang -E -D'__attribute__(x)=' -D'__extension__=' -D'__signed__=signed' -D'__builtin_va_list=int' ...-c -o /mnt/os_tmp/cparser/test1/clk-pp.c linux/drivers/clk/xx/clk.cI met errors when parse the file with commands:
pycparser.parse_file('/mnt/os_tmp/cparser/test1/clk-pp.c') pycparser.plyparser.ParseError: linux/arch/arm64/include/asm/barrier.h:77:6: before: volatile
barrier.h:72
static inline unsigned long array_index_mask_nospec(unsigned long idx,
unsigned long sz)
{
unsigned long mask;
asm volatile(
" cmp %1, %2\n"
" sbc %0, xzr, xzr\n"
: "=r" (mask)
: "r" (idx), "Ir" (sz)
: "cc");
csdb();
return mask;
}
Can somebody help me on the issue?