Certain versions of system headers will declare WCHAR_MAX like:
#define __WCHAR_MAX ( (wchar_t) - 1 )
#define WCHAR_MAX __WCHAR_MAX
In particular on ARM (see e.g.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=598937 )
In this case, defined(WCHAR_MAX) is true, but attempting to use the
value of WCHAR_MAX in a preprocessor expression will not give the
desired results - "wchar_t" is unknown to the preprocessor, so
WCHAR_MAX silently (without -Wundef) evaluates to ( (0) - 1 ) == -1.
A simple workaround is to avoid looking at WCHAR_MAX when the
superior __SIZEOF_WCHAR_T__ is defined.
Change-Id: I439b166cffb93416737ee19025fb6e8d51c27876
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>