[cfe-commits] [Patch] Enabling/disabling support for wchar_t type.

Enea Zaffanella zaffanella at cs.unipr.it
Sun Sep 2 23:02:19 PDT 2012


Resending to cfe-commit.

On 08/31/2012 12:09 PM, Enea Zaffanella wrote:
> Hello.
>
> According to language standards, the wchar_t type is
>    - a library provided type in C
>    - a native type in C++.
>
> There are C++ compilers allowing users to enable/disable the native
> support. For instance, MSVC has option /Zc:wchar_t. Even though the
> default in newer versions of MSVC is to enable wchar_t support, there is
> much code in the real world that will only work if this is disabled
> (e.g., Qt X.Y.Z with X < 5).
>
> The attached simple patch adds flag WChar to LangOptions.
> The flag is similar to Bool: if set, the native wchar_t type is
> supported (i.e., wchar_t will be lexed as a keyword), otherwise it won't
> be supported (i.e., it will be a normal identifier). Currently, the flag
> is initialized the same as CPlusPlus, so that the addition should cause
> no visible change.
>
> The addition of this flag will be enough for people using clang as a set
> of libraries. For more "conventional" uses, it might be worth
> considering the addition of a suitable command line option to toggle the
> flag.
>
> Opinions?
>
> Enea.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: WChar.patch
Type: text/x-diff
Size: 4016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120903/2cd5f6f6/attachment.patch>


More information about the cfe-commits mailing list