<div dir="ltr">On Wed, Jun 26, 2013 at 1:58 PM, Bill Schmidt <span dir="ltr"><<a href="mailto:wschmidt@linux.vnet.ibm.com" target="_blank" class="cremed">wschmidt@linux.vnet.ibm.com</a>></span> wrote:<br><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><a href="http://llvm.org/bugs/show_bug.cgi?id=16454" target="_blank" class="cremed">http://llvm.org/bugs/show_bug.cgi?id=16454</a> demonstrates that altivec.h<br>

is being included along paths where it doesn't make much sense to do so.<br>
This file is auto-included when compiling with -faltivec.  What I'm<br>
proposing is to avoid copying the -faltivec flag when the action being<br>
taken is to invoke the assembler or the preprocessor.<br>
<br>
I've verified that this fixes the test case in question without<br>
introducing any unit-test or test-suite regressions.  I also verified<br>
that preprocessing a file requiring altivec extensions (like "vector<br>
float x;") with the revised Clang and then compiling the resulting<br>
preprocessed file still works correctly.<br>
<br>
However, I really don't know anything about how all the driver machinery<br>
works, so I'd appreciate some extra eyes on this before I commit.  I'm<br>
CC'ing a few folks that were suggested.<br>
<br>
For what it's worth, the test case in question is fixed by the<br>
isa<PreprocessJobAction> test.  The other test is there just because it<br>
makes sense to me.<br>
<br>
I will add the original test from the PR as a unit test if this approach<br>
passes muster.<br></blockquote><div><br></div><div>This is fine. Also add tests for the other cases you highlight. You can do this very easily as driver tests that just check for the existence or non-existence of -faltivec in the CC1 invocation, and uses '-x ...' and other flags to control the actions selected.</div>
<div><br></div><div>Some comments on the patch:</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-  Args.AddLastArg(CmdArgs, options::OPT_faltivec);<br>

+  // -faltivec causes inclusion of altivec.h, which makes no sense for<br>
+  // an assembly or preprocess action.<br></blockquote><div><br></div><div>I would say instead that the AltiVec language extensions aren't relevant for assembling or processing. It's not about the flag, it's about the extensions being C language extensions.</div>
<div><br></div><div>I wonder if it would be useful to also add an error to lib/Frontend when -faltivec is passed for these weird job types... Maybe just an assert...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+  if (!isa<AssembleJobAction>(JA) && !isa<PreprocessJobAction>(JA))<br>
+    Args.AddLastArg(CmdArgs, options::OPT_faltivec);<br>
   Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_show_template_tree);<br>
   Args.AddLastArg(CmdArgs, options::OPT_fno_elide_type);<br>
<br>
<br>
<br>
</blockquote></div><br></div></div>