<div dir="auto">Hi Richard,<div dir="auto">                     Thanks for the quick response.</div><div dir="auto">I tried the -I- option.</div><div dir="auto">I ran the below command</div><div dir="auto">clang.exe -E path of cfile.c -I path of dir y -I-</div><div dir="auto">With this I get the below error</div><div dir="auto">clang.exe:error :-I- not supported , please use -iquote instead.</div><div dir="auto"><br></div><div dir="auto">I tried using -iquote as well</div><div dir="auto">clang.exe -E path of cfile.c -I path of dir y -iquote path of dir y</div><div dir="auto"><br></div><div dir="auto">Even this did not work and it is still picking up the header file from the same directory as that of the c file ie dir x.</div><div dir="auto"><br></div><div dir="auto">I am using clang 6.0.1 </div><div dir="auto">Is the -I- option deprecated in clang 6.0.1?</div><div dir="auto">If not is the usage of the flag(-I- and -iquote) not proper.</div><div dir="auto"><br></div><div dir="auto">Thanks in advance</div><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On May 10, 2019 1:10 PM, "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="quoted-text">On Thu, 9 May 2019 at 22:47, Sudhindra kulkarni<br>
<<a href="mailto:sudhindrakkulkarni102@gmail.com">sudhindrakkulkarni102@gmail.<wbr>com</a>> wrote:<br>
><br>
> Thanks Richard for the answer.<br>
><br>
> I have another question regarding the include(-I) option.<br>
><br>
> 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<br>
> #include "header.h"<br>
> 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,<br>
> clang.exe -E path of cfile.c -I path of dir y<br>
> The header.h present in the directory dir x is getting considered even though -I points to dir y.<br>
><br>
> 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.<br>
> If not how to make clang consider only the directories provided against the -I option and not the current directory.<br>
<br>
</div>I think the only way to suppress the search in the directory of the<br>
file containing the #include is with the -I- (dash, capital i, dash)<br>
option. (That option also has other effects on the #include path, and<br>
it matters where you place it relative to other -I flags.) It'd<br>
probably be worth adding a dedicated flag for just the "don't look in<br>
the directory containing the file" effect.<br>
<div class="elided-text"><br>
> Thanks in advance<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On May 9, 2019 5:01 AM, "Richard Smith" <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>
><br>
> 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>
> 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>
><br>
><br>
</div></blockquote></div><br></div></div>