[cfe-commits] [PATCH] -fshort-wchar

John Thompson john.thompson.jtsoftware at gmail.com
Wed Nov 4 13:53:47 PST 2009


Here's another go at it, adding stuff for PCH and the driver.  I put in a
partial test of the driver change in test/Driver/clang_f_opts.c, which I
hope is an appropriate place.

>There is some weird spacing in this patch... are you using tabs in your
editor?
Sorry, I'm trying a new editor (Programmer's Notepad), and thought I had it
set up correctly, but didn't.
On Tue, Nov 3, 2009 at 10:15 PM, Douglas Gregor <dgregor at apple.com> wrote:

>
> On Nov 2, 2009, at 7:01 PM, John Thompson wrote:
>
>  Here's a stab at implementing -fshort-wchar.
>>
>
> Thanks! This looks good, except for two missing pieces:
>
>  - The PCH reader and writer need to load/save the ShortWChar bit.
>  - You'll need to update the clang driver to pass -fshort-wchar through to
> clang-cc
>
> There is some weird spacing in this patch... are you using tabs in your
> editor?
>
> +void TargetInfo::setForcedLangOptions(LangOptions &Opts) {
> +       if (Opts.ShortWChar) {
> +    WCharType = UnsignedShort;
> +    WCharWidth = WCharAlign = 16;
> +       }
> +}
>
>
>> The change to the wchar.c test allows it to pass on Windows (and still
>> pass on Linux, which defaults to int for wchar_t).
>>
>
>  I'd like to retain the test that we use "int" for the other targets.
> Could you do something like
>
>  RUN: clang-cc %s -fsyntax-only -triple i686-pc-linux-gnu -verify
> -DWCHAR_T_TYPE="int" &&
>  RUN: clang-cc %s -fsyntax-only -fshort-wchar -verify
> -DWCHAR_T_TYPE="unsigned short"
>
> then use WCHAR_T_TYPE as the element type of the t1 and t2 arrays?
>
>        - Doug
>



-- 
John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20091104/0498b8b0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shortwchar1.patch
Type: application/octet-stream
Size: 9049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20091104/0498b8b0/attachment.obj>


More information about the cfe-commits mailing list