<div dir="auto"><div>Thanks Richard for the answer.</div><div dir="auto"><br></div><div dir="auto">I have another question regarding the include(-I) option.</div><div dir="auto"><br></div><div dir="auto">If we have a c file called cfile.c and a header file called header.h both in the same directory say (dir x).  cfile.c includes header.h as shown below</div><div dir="auto">#include "header.h"</div><div dir="auto">And if in some other directory say (dir y)we have another header file with the same name(header.h) but with a different content then when I try to generate the preprocessed file using the below command,</div><div dir="auto">clang.exe -E path of cfile.c -I path of dir y</div><div dir="auto">The header.h present in the directory dir x is getting considered even though -I points to dir y. </div><div dir="auto"><br></div><div dir="auto">Is this the intended behavior that the current directory is searched first for the header files irrespective of the directory provided against the -I option.</div><div dir="auto">If not how to make clang consider only the directories provided against the -I option and not the current directory.</div><div dir="auto"><br></div><div dir="auto">Thanks in advance</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div dir="auto"><br><div dir="auto"><br></div></div><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On May 9, 2019 5:01 AM, "Richard Smith" <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="elided-text">On Mon, 6 May 2019 at 23:09, Sudhindra kulkarni via cfe-users<br>
<<a href="mailto:cfe-users@lists.llvm.org">cfe-users@lists.llvm.org</a>> wrote:<br>
><br>
><br>
> ---------- Forwarded message ----------<br>
> From: "Tim Northover" <<a href="mailto:t.p.northover@gmail.com">t.p.northover@gmail.com</a>><br>
> Date: May 1, 2019 3:48 PM<br>
> Subject: Re: [llvm-dev] Overriding macro values defined in source code<br>
> To: "Sudhindra kulkarni" <<a href="mailto:sudhindrakkulkarni102@gmail.com">sudhindrakkulkarni102@gmail.<wbr>com</a>><br>
> Cc: "LLVM Developers Mailing List" <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>
><br>
> On Tue, 30 Apr 2019 at 22:28, Sudhindra kulkarni via llvm-dev<br>
> <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> > Is it possible to override the value of AVAL through the -D option?<br>
> > For eg is it possible to set the value of AVAL to 2 through -D in clang ?<br>
><br>
> This is more a question for the cfe-users list, but as far as I know<br>
> there's no way to prevent redefinitions in source files.<br>
><br>
> Cheers.<br>
><br>
> Tim.<br>
><br>
> Hi Team,<br>
>                  Consider the below C code,<br>
> #define AVAL 5<br>
> void func()<br>
> {<br>
> int a=5;<br>
> if(a==AVAL)<br>
> {<br>
> //Do something<br>
> }<br>
> else<br>
> {<br>
> //Do something else<br>
> }<br>
><br>
> }<br>
> My question is<br>
> Is it possible to override the value of AVAL through the -D option?<br>
> For eg is it possible to set the value of AVAL to 2 through -D in clang so that the else part executes?<br>
> Also apart from -D option we are also open to other ways of achieving this<br>
<br>
</div>The normal approach is to change the source to something like<br>
<br>
#ifndef AVAL<br>
#define AVAL 5<br>
#endif<br>
<br>
> Thanks in advance<br>
> ______________________________<wbr>_________________<br>
> cfe-users mailing list<br>
> <a href="mailto:cfe-users@lists.llvm.org">cfe-users@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-<wbr>bin/mailman/listinfo/cfe-users</a><br>
</blockquote></div><br></div></div></div>