<div dir="ltr"><div>From my understanding, /Zc: are sema-level flags. /GF- maps to -fwritable-strings and seems to be the codegen-level flag.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 21, 2014 at 6:07 PM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Should we map /<span></span>Zc:strictStrings- to fwritable-strings?<div class="HOEnZb"><div class="h5"><br><br>On Sunday, December 21, 2014, Nico Weber <<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">That's much nicer, thanks. I couldn't figure out how to alias a clang-cl option to a cc1 option, so I added 4 lines to explicitly translate OPT__SLASH_Zc_trigraphs to -ftrigraphs, but it's still much simpler.<div><br>I also used the same technique to map /Zc:strictStrings to -Werror=c++11-compat-deprecated-writable-strings while here.</div><div><br></div><div>(Disabling trigraphs in -fms-compatibility mode for the gcc driver makes sense to me too, but I think that should happen in a different patch.)</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 21, 2014 at 4:36 AM, Hans Wennborg <span dir="ltr"><<a>hans@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I would have broken out /Zc:trigraphs[-] into two separate CLFlag<br>
options instead.<br>
<br>
That way we don't need parser code for it, the flags can have<br>
individual help texts, and they can just be aliases to the cc1 flags.<br>
<br>
Also, instead of passing -fno-trigraphs each time, maybe we should<br>
change the default in CompilerInvocation based on the language<br>
options. It seems we currently disable them in gnu mode for example.<br>
Maybe we should do the same if -fms-extensions or -fms-compatibility<br>
if enabled?<br>
<div><div><br>
On Sat, Dec 20, 2014 at 11:16 AM, Nico Weber <<a>thakis@chromium.org</a>> wrote:<br>
> Thanks! All done.<br>
><br>
> On Fri, Dec 19, 2014 at 6:47 PM, Richard Smith <<a>richard@metafoo.co.uk</a>><br>
> wrote:<br>
>><br>
>> On Fri, Dec 19, 2014 at 6:08 PM, Nico Weber <<a>thakis@chromium.org</a>> wrote:<br>
>>><br>
>>> Forgot to say: Fixes PR21974.<br>
>>><br>
>>> On Fri, Dec 19, 2014 at 6:07 PM, Nico Weber <<a>thakis@chromium.org</a>> wrote:<br>
>>>><br>
>>>> Hi,<br>
>>>><br>
>>>> the attached patch disables trigraphs by default in clang-cl mode. To do<br>
>>>> so, I'm renaming the cc1 trigraph flag to -ftrigraphs, and I'm adding a<br>
>>>> -fno-trigraphs flag. (This requires updating a handful of cc1 tests, and<br>
>>>> translating -trigraphs to -ftrigraphs in the driver.)<br>
>>>><br>
>>>> The driver grows parsing logic for /Zc:, everything other than trigraphs<br>
>>>> is ignored for now. (We probably want to implement at least /Zc:inline at<br>
>>>> some point, which is why I added parsing code for this instead of always<br>
>>>> sending -fno-trigraphs to cc1 in clang-cl mode.)<br>
>><br>
>><br>
>> -def trigraphs : Flag<["-", "--"], "trigraphs">, Flags<[CC1Option]>,<br>
>> +def trigraphs : Flag<["-", "--"], "trigraphs">, Flags<[DriverOption]>,<br>
>><br>
>> I don't think DriverOption is right here; that means we don't forward the<br>
>> flag to a gcc invocation. Now, we never invoke GCC for C-like languages any<br>
>> more, but if we did, this would be wrong (and for all I know, it's wrong for<br>
>> Fortran...). You should be able to just drop the Flags.<br>
>><br>
>><br>
>>      if (Arg *A = Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi,<br>
>> -                                 options::OPT_trigraphs))<br>
>> -      if (A != Std)<br>
>> +                                 options::OPT_trigraphs)) {<br>
>> +      if (A->getOption().matches(options::OPT_trigraphs))<br>
>> +        CmdArgs.push_back("-ftrigraphs");<br>
>> +      else if (A != Std)<br>
>>          A->render(Args, CmdArgs);<br>
>><br>
>> Std here is Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi), so<br>
>> your 'else if' clause is unreachable. Something like this would be simpler<br>
>> and more obvious:<br>
>><br>
>> // If -trigraphs appears after the language standard flag, honor it.<br>
>> if (Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi,<br>
>> options::OPT_trigraphs) != Std)<br>
>>   CmdArgs.push_back("-ftrigraphs");<br>
>><br>
>> You could even sink this below the 'if (Std)' block to avoid duplicating<br>
>> it between the cases where we do and don't have a Std flag.<br>
>><br>
>>>> Ok?<br>
>>>><br>
>>>> Nico<br>
>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> cfe-commits mailing list<br>
>>> <a>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>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a>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>
</div></div></blockquote></div><br></div>
</blockquote>
</div></div></blockquote></div><br></div>