Date: Fri, 10 Apr 2015 20:17:13 -0700 From: Mark Millard <markmi@dsl-only.net> To: freebsd-toolchain@freebsd.org Cc: FreeBSD PowerPC ML <freebsd-ppc@freebsd.org> 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 Message-ID: <5B228278-A967-46D4-8F56-08E47008D009@dsl-only.net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5B228278-A967-46D4-8F56-08E47008D009>