<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Dec 19, 2014 at 6:08 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Forgot to say: Fixes PR21974.</div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 19, 2014 at 6:07 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>the attached patch disables trigraphs by default in clang-cl mode. To do so, I'm renaming the cc1 trigraph flag to -ftrigraphs, and I'm adding a -fno-trigraphs flag. (This requires updating a handful of cc1 tests, and translating -trigraphs to -ftrigraphs in the driver.)</div><div><br>The driver grows parsing logic for /Zc:, everything other than trigraphs is ignored for now. (We probably want to implement at least /Zc:inline at some point, which is why I added parsing code for this instead of always sending -fno-trigraphs to cc1 in clang-cl mode.)</div></div></blockquote></div></div></div></div></blockquote><div><br></div><div><div>-def trigraphs : Flag<["-", "--"], "trigraphs">, Flags<[CC1Option]>,</div><div>+def trigraphs : Flag<["-", "--"], "trigraphs">, Flags<[DriverOption]>,</div></div><div><br></div><div>I don't think DriverOption is right here; that means we don't forward the flag to a gcc invocation. Now, we never invoke GCC for C-like languages any more, but if we did, this would be wrong (and for all I know, it's wrong for Fortran...). You should be able to just drop the Flags.</div><div><br></div><div><br></div><div><div>     if (Arg *A = Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi,</div><div>-                                 options::OPT_trigraphs))</div><div>-      if (A != Std)</div><div>+                                 options::OPT_trigraphs)) {</div><div>+      if (A->getOption().matches(options::OPT_trigraphs))</div><div>+        CmdArgs.push_back("-ftrigraphs");</div><div>+      else if (A != Std)</div><div>         A->render(Args, CmdArgs);</div></div><div><br></div><div>Std here is Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi), so your 'else if' clause is unreachable. Something like this would be simpler and more obvious:</div><div><br></div><div>// If -trigraphs appears after the language standard flag, honor it.</div><div>if (Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi, options::OPT_trigraphs) != Std)</div><div>  CmdArgs.push_back("-ftrigraphs");</div><div><br></div><div>You could even sink this below the 'if (Std)' block to avoid duplicating it between the cases where we do and don't have a Std flag.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Ok?</div><span><font color="#888888"><div><br></div><div>Nico</div></font></span></div>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div></div></div>