Change the wchar_t logic once more to make it a bit simplier.

A host can only have one special wchar_t definition, so we don't need to define all. Also _WCHAR_T_DEFINED is the only definition used for overriding the wchar_t setting by applications.
So use the previous logic to check and define the wchar_t definitions for the host and at the end check for _WCHAR_T_DEFINED. In all cases, define _WCHAR_T_DEFINED.

Additionally, __need_wchar_t has to be undefined after including "ctype.h" as "ctype.h" defines it.

svn path=/trunk/; revision=28422
This commit is contained in:
Colin Finck 2007-08-19 14:04:20 +00:00
parent 4a878b945f
commit fd468bc98a

View file

@ -52,11 +52,13 @@ extern "C" {
/* wchar_t checks /* wchar_t checks
* First check if wchar_t has already been defined by any host/OS */ * First check if wchar_t has already been defined by any host/OS */
#ifndef _WCHAR_T_DEFINED
#ifndef _WCHAR_T_DECLARED /* for FreeBSD 5 and later */ #ifndef _WCHAR_T_DECLARED /* for FreeBSD 5 and later */
#define _WCHAR_T_DECLARED
#ifndef _WCHAR_T /* for Mac OS X */ #ifndef _WCHAR_T /* for Mac OS X */
#define _WCHAR_T
#ifndef _WCHAR_T_ #ifndef _WCHAR_T_
#undef __need_wchar_t #define _WCHAR_T_
#ifndef _WCHAR_T_DEFINED /* If you want to override the wchar_t setting, define this */
#ifndef __cplusplus #ifndef __cplusplus
typedef unsigned short wchar_t; typedef unsigned short wchar_t;
#endif #endif
@ -65,25 +67,14 @@ extern "C" {
#endif #endif
#endif #endif
/* Now report that it has been defined to all known hosts/operating systems */ /* Set _WCHAR_T_DEFINED for the case that this is checked later */
#ifndef _WCHAR_T_DEFINED #ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED #define _WCHAR_T_DEFINED
#endif #endif
#ifndef _WCHAR_T_DECLARED
#define _WCHAR_T_DECLARED
#endif
#ifndef _WCHAR_T
#define _WCHAR_T
#endif
#ifndef _WCHAR_T_
#define _WCHAR_T_
#endif
#include <ctype.h> #include <ctype.h>
#undef __need_wchar_t
#include <winerror.h> #include <winerror.h>
#include <stddef.h> #include <stddef.h>
#include <sdkddkver.h> #include <sdkddkver.h>