[cfe-dev] [LLVMdev] Reminder: 3.6 branch is coming

Hans Wennborg hans at chromium.org
Mon Jan 12 09:31:06 PST 2015


On Mon, Jan 12, 2015 at 1:26 AM, David Chisnall
<David.Chisnall at cl.cam.ac.uk> wrote:
> On 12 Jan 2015, at 08:07, Dimitry Andric <dimitry at andric.com> wrote:
>>
>>
>> On 15 Oct 2014, at 19:42, Richard Smith <richard at metafoo.co.uk> wrote:
>>> On 15 Oct 2014 05:12, "Ed Schouten" <ed at 80386.nl> wrote:
>> ...
>>> The test case in the LLVM tree is invalid and should be discarded. It
>>> erroneously assumes that the encoding of wchar_t is independent of the
>>> locale.
>>>
>> That makes no sense. These value are compile-time constants and cannot possibly depend on the locale.
>
> I believe Richard is wrong here.  There are a number of similar compile-time constant macros in the C spec.  I believe the clue as to the correct reading of the spec is in the name of the macro: __STDC_MB_MIGHT_NEQ_WC__
>
> Note the word *might*.  It means that it is not safe for code to assume that a cast will give the corresponding char value if one exists.  i.e. that assumption is not true for all locales.
>
> As dim says, the test is wrong.  It would be a valid test for it to fail if __STDC_MB_MIGHT_NEQ_WC__ is *not* defined and not all characters in the basic set have the same encoding as wide chars, but it is not correct to fail if it is set unless that have the same encoding in *all* locales, *and* the vendor is willing to guarantee that they will have the same encoding for all locales in all future binary-compatible versions of the system (which an automated test can't check).
>
> In summary: the test is nonsense and should be removed.

I couldn't find an existing PR for this, so I filed
http://llvm.org/PR22208 with folks on this thread cc'd. It would be
great if we could get it resolved soon.

Thanks,
Hans




More information about the cfe-dev mailing list