From nobody@FreeBSD.org  Thu Feb  7 17:44:44 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id 83B63DB0
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  7 Feb 2013 17:44:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 53E77DD
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  7 Feb 2013 17:44:44 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r17Hiixh019305
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 7 Feb 2013 17:44:44 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r17HiiCw019304;
	Thu, 7 Feb 2013 17:44:44 GMT
	(envelope-from nobody)
Message-Id: <201302071744.r17HiiCw019304@red.freebsd.org>
Date: Thu, 7 Feb 2013 17:44:44 GMT
From: "Tim &#268;as" <tim@stdrand.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: CLang does not define __STDC_ISO_10646__, despite having Unicode in wchar_t
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         175930
>Category:       bin
>Synopsis:       [headers] clang does not define __STDC_ISO_10646__, despite having Unicode in wchar_t
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-toolchain
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 07 17:50:00 UTC 2013
>Closed-Date:    Sat May 25 16:40:12 UTC 2013
>Last-Modified:  Sat May 25 16:40:12 UTC 2013
>Originator:     Tim &#268;as
>Release:        9.1-RELEASE
>Organization:
n/a
>Environment:
FreeBSD tsibsd.tsi 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
wchar_t appears to be Unicode, but __STDC_ISO_10646__ is not defined.

Tested with both the core and the ports versions:

FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
Target: x86_64-unknown-freebsd9.0
Thread model: posix

clang version 3.1 (branches/release_31)
Target: amd64-portbld-freebsd9.0
Thread model: posix

Test file:
----------
#include <stdlib.h>
#include <wchar.h>
#include <stdio.h>

int main(void)
{
#ifdef __STDC_ISO_10646__ 
    printf("__STDC_ISO_10646__ defined\n");
#else
    printf("__STDC_ISO_10646__ NOT defined\n");
#endif
    return 0;
}

>How-To-Repeat:
Compile and run the above test file (here "test.c"):

$ clang test.c -o test
$ ./test
__STDC_ISO_10646__ NOT defined

$ /usr/local/bin/clang test.c -o test
$ ./test
__STDC_ISO_10646__ NOT defined

>Fix:
Have the compiler define the macro to its appropriate value.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-toolchain 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Feb 9 16:02:36 UTC 2013 
Responsible-Changed-Why:  
let's see if anyone on toolchain@ has an opinion. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=175930 

From: Ed Schouten <ed@80386.nl>
To: bug-followup@FreeBSD.org, tim@stdrand.com
Cc:  
Subject: Re: bin/175930: [headers] clang does not define __STDC_ISO_10646__,
 despite having Unicode in wchar_t
Date: Sat, 25 May 2013 18:38:28 +0200

 Hi Tim,
 
 On FreeBSD, we should explicitly not define __STDC_ISO_10646__, as
 this condition does not hold. On FreeBSD, wchar_t contains the code
 point of the character as represented in the original character set.
 
 For example, if your LC_CTYPE is en_US.ISO8859-15 and you convert a
 Euro symbol to a wchar_t, it is stored internally as 0xa4 -- not
 0x20ac. There is no character conversion.
 
 Related to this, I am working on a change right now to let Clang at
 least define __STDC_MB_MIGHT_NEQ_WC__, __STDC_UTF_16__ and
 __STDC_UTF_32__.
 
 --
 Ed Schouten <ed@80386.nl>
State-Changed-From-To: open->closed 
State-Changed-By: ed 
State-Changed-When: Sat May 25 16:40:11 UTC 2013 
State-Changed-Why:  
Closing, as we should not define __STDC_ISO_10646__. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=175930 
>Unformatted:
