<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 10/25/2017 11:54 AM, Reid Kleckner
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CACs=ty+nS-QP4Gu=4waNPaDjOUcAz95SRGESe+0G2qcSVOC1fQ@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Wed, Oct 25, 2017 at 10:56 AM,
            Friedman, Eli <span dir="ltr"><<a
                href="mailto:efriedma@codeaurora.org" target="_blank"
                moz-do-not-send="true">efriedma@codeaurora.org</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div class="HOEnZb">
                <div class="h5">On 10/6/2017 4:09 PM, Saleem Abdulrasool
                  via cfe-commits wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    Modified: cfe/trunk/lib/Driver/ToolChain<wbr>s/Clang.cpp<br>
                    URL: <a
href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=315126&r1=315125&r2=315126&view=diff"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Driver/Too<wbr>lChains/Clang.cpp?rev=315126&<wbr>r1=315125&r2=315126&view=diff</a><br>
                    ==============================<wbr>==============================<wbr>==================<br>
                    --- cfe/trunk/lib/Driver/ToolChain<wbr>s/Clang.cpp
                    (original)<br>
                    +++ cfe/trunk/lib/Driver/ToolChain<wbr>s/Clang.cpp
                    Fri Oct  6 16:09:55 2017<br>
                    @@ -2601,6 +2601,33 @@ static void
                    RenderModulesOptions(Compila<br>
                        Args.AddLastArg(CmdArgs,
                    options::OPT_fmodules_disable_<wbr>diagnostic_validation);<br>
                      }<br>
                      +static void RenderCharacterOptions(const ArgList
                    &Args, const llvm::Triple &T,<br>
                    +                                   ArgStringList
                    &CmdArgs) {<br>
                    +  // -fsigned-char is default.<br>
                    +  if (const Arg *A = Args.getLastArg(options::OPT_f<wbr>signed_char,<br>
                    +                                   
                     options::OPT_fno_signed_char,<br>
                    +                                   
                     options::OPT_funsigned_char,<br>
                    +                                   
                     options::OPT_fno_unsigned_cha<wbr>r)) {<br>
                    +    if (A->getOption().matches(option<wbr>s::OPT_funsigned_char)
                    ||<br>
                    +        A->getOption().matches(options<wbr>::OPT_fno_signed_char))
                    {<br>
                    +      CmdArgs.push_back("-fno-signed<wbr>-char");<br>
                    +    }<br>
                    +  } else if (!isSignedCharDefault(T)) {<br>
                    +    CmdArgs.push_back("-fno-signed<wbr>-char");<br>
                    +  }<br>
                    +<br>
                    +  if (const Arg *A = Args.getLastArg(options::OPT_f<wbr>short_wchar,<br>
                    +                                   
                     options::OPT_fno_short_wchar)<wbr>) {<br>
                    +    if (A->getOption().matches(option<wbr>s::OPT_fshort_wchar))
                    {<br>
                    +      CmdArgs.push_back("-fwchar-typ<wbr>e=short");<br>
                    +      CmdArgs.push_back("-fno-signed<wbr>-wchar");<br>
                    +    } else {<br>
                    +      CmdArgs.push_back("-fwchar-typ<wbr>e=int");<br>
                    +      CmdArgs.push_back("-fsigned-wc<wbr>har");<br>
                    +    }<br>
                    +  }<br>
                    +}<br>
                  </blockquote>
                  <br>
                </div>
              </div>
              It looks like this changes the behavior of
              "-fno-short-wchar". Specifically, on targets where the
              default wchar_t type is "unsigned int" (like ARM AAPCS),
              "-fno-short-wchar" used to be a no-op, but now it changes
              the sign of wchar_t.  Why are we overriding the default
              here?</blockquote>
            <div><br>
            </div>
            <div>Overriding the default was more or less the intention,
              but it was for bitwidth, not signedness. The idea was that
              if you pass -fno-short-wchar, then you want the 4 byte
              one.</div>
            <div><br>
            </div>
            <div>Users probably don't care about signedness when using 4
              byte wchars, so we could probably remove the
              -fsigned-wchar flag from the else block and take the
              original sign of wchar_t when overriding the width in
              Basic. They probably want an 'unsigned short' when
              -fshort-wchar is passed, though.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <p>Maybe we should just ignore -fno-short-wchar, instead?  I think
      that's what gcc and released versions of clang do (that means
      -fno-short-wchar doesn't do anything for Windows targets, but
      that's probably fine).</p>
    <p>-Eli<br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
  </body>
</html>