From owner-freebsd-ppc@FreeBSD.ORG Sat Apr 11 03:17:18 2015 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DFB24D3C for ; Sat, 11 Apr 2015 03:17:17 +0000 (UTC) Received: from asp.reflexion.net (outbound-242.asp.reflexion.net [69.84.129.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85755F89 for ; Sat, 11 Apr 2015 03:17:16 +0000 (UTC) Received: (qmail 9700 invoked from network); 11 Apr 2015 03:17:15 -0000 Received: from unknown (HELO rtc-sm-01.app.dca.reflexion.local) (10.81.150.1) by 0 (rfx-qmail) with SMTP; 11 Apr 2015 03:17:15 -0000 Received: by rtc-sm-01.app.dca.reflexion.local (Reflexion email security v7.40.1) with SMTP; Fri, 10 Apr 2015 23:17:15 -0400 (EDT) Received: (qmail 17364 invoked from network); 11 Apr 2015 03:17:15 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (DHE-RSA-AES256-SHA encrypted) SMTP; 11 Apr 2015 03:17:15 -0000 X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.8] (c-67-189-19-145.hsd1.or.comcast.net [67.189.19.145]) by iron2.pdx.net (Postfix) with ESMTPSA id A9E741C43AF; Fri, 10 Apr 2015 20:17:08 -0700 (PDT) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: powerc64-xtoolchain-gcc with -m32 on powerpc64 vs. lib32/libedit and wchar_t use: gcc 4.9.1 forces __WCHAR_TYPE__ (underlying type?) long int Date: Fri, 10 Apr 2015 20:17:13 -0700 Message-Id: <5B228278-A967-46D4-8F56-08E47008D009@dsl-only.net> To: freebsd-toolchain@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) X-Mailer: Apple Mail (2.2098) Cc: FreeBSD PowerPC ML X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2015 03:17:18 -0000 I got the following when trying WITH_LIB32=3D with = powerpc64-xtoolchain-gcc (on a powerpc64 box, WITHOUT_BOOT=3D ) : > . . . parse.c:181:25: error: array of inappropriate type initialized = from string constant > const Char hex[] =3D STR("0123456789ABCDEF"); > ^ The rest of this note is about what I found when I looked into this. = Read only if you care. File for later if you likely would care later? =20= The libedit/Makefile uses -DWIDECHAR and libedit/chartype.h defines for = that case: > #define Char wchar_t > . . . > #define STR(x) L ## x > #define UC(c) c There were lots of warnings for incompatible pointer types for libedit/. = . . including the following one that was explicit about which type is = involved: > note: expected 'const wchar_t *' but argument is of type 'long int *' > int wcscmp(const wchar_t *, const wchar_t *) __pure; > ^ So how did the long int type end up involved? I expect the following may = contribute. Turns out that long int (and L suffix use in __WCHAR_MAX__) is specific = to 4.9.1 -m32 handling when compared to gcc 4.2.1 . . . > # gcc -dM -E -m32 - < /dev/null | grep WCHAR > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > # /usr/local/bin/powerpc64-portbld-freebsd11.0-gcc-4.9.1 -dM -E -m32 - = < /dev/null | grep WCHAR > #define __WCHAR_MAX__ 2147483647L > #define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1) > #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 > #define __WCHAR_TYPE__ long int > #define __SIZEOF_WCHAR_T__ 4 and compared to -m64 for both 4.2.1 and 4.9.1 . . . > # gcc -dM -E -m64 - < /dev/null | grep WCHAR > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_TYPE__ int > # /usr/local/bin/powerpc64-portbld-freebsd11.0-gcc-4.9.1 -dM -E -m64 - = < /dev/null | grep WCHAR > #define __WCHAR_MAX__ 2147483647 > #define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1) > #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 > #define __WCHAR_TYPE__ int > #define __SIZEOF_WCHAR_T__ 4 (where I expect that __WCHAR_TYPE__ is the underlying type used for = wchar_t). The following ended up installed for the 4.9.1 compiler . . . > #undef WCHAR_TYPE > #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int") > #undef WCHAR_TYPE_SIZE > #define WCHAR_TYPE_SIZE 32 > = /usr/local/lib/gcc/powerpc64-portbld-freebsd11.0/4.9.1/plugin/include/conf= ig/rs6000/freebsd64.h > #undef WCHAR_TYPE > #define WCHAR_TYPE "long int" > #undef WCHAR_TYPE_SIZE > #define WCHAR_TYPE_SIZE 32 > = /usr/local/lib/gcc/powerpc64-portbld-freebsd11.0/4.9.1/plugin/include/conf= ig/rs6000/sysv4.h =3D=3D=3D Mark Millard markmi at dsl-only.net