I got the following when trying WITH_LIB32= with powerpc64-xtoolchain-gcc (on a 
powerpc64 box, WITHOUT_BOOT= ) :

> . . . parse.c:181:25: error: array of inappropriate type initialized from 
> string constant
>                          const Char hex[] = 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?  




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/config/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/config/rs6000/sysv4.h



===
Mark Millard
markmi at dsl-only.net

_______________________________________________
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"

Reply via email to