This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] g++.dg/cpp1y/pr58708.C wchar_t size
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: David Edelsohn <dje dot gcc at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 17 Nov 2015 16:22:55 +0000
- Subject: Re: [PATCH] g++.dg/cpp1y/pr58708.C wchar_t size
- Authentication-results: sourceware.org; auth=none
- References: <CAGWvnym6qLBn7=kpHdwnCNSDPSX5Jk4=wjvtH822hPey_P9Hbg at mail dot gmail dot com>
On 17 November 2015 at 16:04, David Edelsohn wrote:
> The testcase in the GCC testsuite assumes that wchar_t is 32 bits,
> which is not correct on AIX. 32 bit AIX maintains 16 bit wchar_t for
> backward compatibility (64 bit AIX uses 32 bit wchar_t).
>
> What is the preferred method to make the testcase safe for smaller wchar_t?
>
> The following patch works for me. I wasn't sure what header file and
> what macro test would be considered portable. I could include
> stdint.h and compare
>
> WCHAR_MAX == UINT16_MAX
>
> or
>
> WCHAR_MAX < UINT32_MAX
__SIZEOF_WCHAR_T__ is always pre-defined by the compiler, so that
could be used.