<div dir="ltr"><span style="font-size:13px">Hello,</span><br><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">I am trying to parse c file using clang. I have created python binding using libclang.so and passing my .c file as and argument to my python script.</span></div><div><span style="font-size:13px"><br></span></div><div><div style="font-size:13px">I see that it is not able to parse header file, due to which file linux/errno.h is also not parsed and hence it is not able to get values of macro definition of all error codes. </div><div style="font-size:13px">Ex:</div><div style="font-size:13px">----</div><div style="font-size:13px"><b>file bcm63xx_wdt.c:</b></div><div style="font-size:13px"><div>#include <linux/bitops.h></div><div>#include <linux/errno.h></div><div>#include <linux/fs.h></div><div>#include <linux/io.h></div></div><div style="font-size:13px">...</div><div style="font-size:13px">...</div><div style="font-size:13px"><div>static int bcm63xx_wdt_open(struct inode *inode, struct file *file)</div><div>{</div><div><span style="white-space:pre-wrap">        </span>if (test_and_set_bit(0, &bcm63xx_wdt_device.inuse))</div><div><span style="white-space:pre-wrap">          </span>return -EBUSY;                     <b>// not able to find value of EBUSY,hence returns error when I try to print node.spelling()</b></div><div>}</div><div><br></div><div><div>I try to parse same file using clang command directly in command prompt and I see that </div><div><br></div><div><b>:~$ clang -Xclang -ast-dump -fsyntax-only bcm63xx_wdt.c</b><br></div><div><b>O/P:</b></div><div><div>|   | |-ReturnStmt 0x1c23858 <line:119:3, /usr/include/asm-generic/errno-base.h:19:16></div><div>|   | | `-UnaryOperator 0x1c23838 <bcm63xx_wdt.c:119:10, /usr/include/asm-generic/errno-base.h:19:16> 'int' prefix '-'</div><div>|   | |   `-IntegerLiteral 0x1c23818 <col:16> <b>'int' 16</b></div></div><div><b><br></b></div><div><b><br></b></div><div>Also if I include Macro definition in source file</div><div>#define EBUSY           16      /* Device or resource busy */<br></div><div> </div><div>Then I get correct output</div></div><div><br></div><div><div>I am searching for issues in libclang but not able to find reason for failiure, can you guide me some steps which can help.</div><div><br></div><div>Thanks,</div><div>Moiz Ali</div></div></div></div></div>