Commit 2315456130d62d62044abe3f93c59ffb467888f0

  • avatar
  • Petr Ovtchenkov (Committer)
  • Wed Sep 02 11:26:01 CEST 2009
  • avatar
  • David Deakins <DavidDeakins @gm…l.com> (Author)
  • Fri Aug 28 04:48:25 CEST 2009
string.h circular dependency for CRT extensions for Windows CE

stl/config/features.h invokes a circular dependency
where windows.h pulls in STLport's version of string.h
before features.h has completed configuration.
To fix this, we delay including the windows.h header
until the very end of features.h to avoid this problem.
  
1/*
2 * Copyright (c) 1997-1999
3 * Silicon Graphics Computer Systems, Inc.
4 *
5 * Copyright (c) 1999
6 * Boris Fomitchev
7 *
8 * Copyright (c) 2003
9 * Francois Dumont
10 *
11 * This material is provided "as is", with absolutely no warranty expressed
12 * or implied. Any use is at your own risk.
13 *
14 * Permission to use or copy this software for any purpose is hereby granted
15 * without fee, provided the above notices are retained on all copies.
16 * Permission to modify the code and to distribute modified code is granted,
17 * provided the above notices are retained, and a notice that the code was
18 * modified is included with the above copyright notice.
19 *
20 */
21#ifndef _STLP_WINCE_WINDOWS_SUFFIX_H
22#define _STLP_WINCE_WINDOWS_SUFFIX_H
23
24
25#if !defined (_STLP_WINDOWS_H_INCLUDED) && defined(_STLP_WCE)
26# define _STLP_WINDOWS_H_INCLUDED
27# if defined (__BUILDING_STLPORT)
28# include <stl/config/_native_headers.h>
29/* Here we define _STLP_OUTERMOST_HEADER_ID to avoid indirect inclusion
30 * of STLport stuffs from C/C++ Standard headers exposed by STLport
31 * as configuration is not yet completed. */
32# if !defined (_STLP_OUTERMOST_HEADER_ID)
33# define _STLP_OUTERMOST_HEADER_ID 0x100
34# endif
35# if !defined (WIN32_LEAN_AND_MEAN)
36# define WIN32_LEAN_AND_MEAN
37# endif
38# if !defined (VC_EXTRALEAN)
39# define VC_EXTRALEAN
40# endif
41/* Don't let windows.h define its min and max macros. */
42# if !defined (NOMINMAX)
43# define NOMINMAX
44# endif
45# if !defined (STRICT)
46# define STRICT
47# endif
48# if defined (_STLP_USE_MFC)
49# include <afx.h>
50# else
51# include <windows.h>
52# endif
53# if (_STLP_OUTERMOST_HEADER_ID == 0x100)
54# undef _STLP_OUTERMOST_HEADER_ID
55# endif
56# else
57/* This section serves as a replacement for windows.h header. */
58# if defined (__cplusplus)
59extern "C" {
60# endif
61# if (defined (_M_AMD64) || defined (_M_IA64) || (!defined (_STLP_WCE) && defined (_M_MRX000)) || defined (_M_ALPHA) || \
62 (defined (_M_PPC) && (_STLP_MSVC_LIB >= 1000))) && !defined (RC_INVOKED)
63# define InterlockedIncrement _InterlockedIncrement
64# define InterlockedDecrement _InterlockedDecrement
65# define InterlockedExchange _InterlockedExchange
66# define _STLP_STDCALL
67# else
68# if defined (_MAC)
69# define _STLP_STDCALL _cdecl
70# else
71# define _STLP_STDCALL __stdcall
72# endif
73# endif
74
75# if defined (_STLP_NEW_PLATFORM_SDK)
76_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long volatile *);
77_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long volatile *);
78_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long volatile *, long);
79# if defined (_WIN64)
80_STLP_IMPORT_DECLSPEC void* _STLP_STDCALL _InterlockedExchangePointer(void* volatile *, void*);
81# endif
82# else
83/* start of eMbedded Visual C++ specific section */
84# include <stl/config/_native_headers.h>
85
86/* Don't let windef.h define its min and max macros. */
87# if !defined (NOMINMAX)
88# define NOMINMAX
89# endif
90# include <windef.h> /* needed for basic windows types */
91
92 /** in SDKs generated with PB5, windef.h somehow includes headers which then
93 define setjmp. */
94# if (_WIN32_WCE >= 0x500)
95# define _STLP_NATIVE_SETJMP_H_INCLUDED
96# endif
97
98# ifndef _WINBASE_ /* winbase.h already included? */
99long WINAPI InterlockedIncrement(long*);
100long WINAPI InterlockedDecrement(long*);
101long WINAPI InterlockedExchange(long*, long);
102# endif
103
104# ifndef __WINDOWS__ /* windows.h already included? */
105
106# if defined (x86)
107# include <winbase.h> /* needed for inline versions of Interlocked* functions */
108# endif
109
110# ifndef _MFC_VER
111
112# define MessageBox MessageBoxW
113int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
114
115# define wvsprintf wvsprintfW
116int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList);
117
118void WINAPI ExitThread(DWORD dwExitCode);
119
120# if !defined (COREDLL)
121# define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT
122# else
123# define _STLP_WCE_WINBASEAPI
124# endif
125
126_STLP_WCE_WINBASEAPI int WINAPI
127MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
128 int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
129
130_STLP_WCE_WINBASEAPI UINT WINAPI GetACP();
131
132_STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode);
133
134# define OutputDebugString OutputDebugStringW
135void WINAPI OutputDebugStringW(LPCWSTR);
136
137_STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD);
138
139# undef _STLP_WCE_WINBASEAPI
140
141# endif /* !_MFC_VER */
142
143# endif /* !__WINDOWS__ */
144
145/* end of eMbedded Visual C++ specific section */
146# endif
147
148# if defined (InterlockedIncrement)
149# pragma intrinsic(_InterlockedIncrement)
150# pragma intrinsic(_InterlockedDecrement)
151# pragma intrinsic(_InterlockedExchange)
152# if defined (_WIN64)
153# pragma intrinsic(_InterlockedExchangePointer)
154# endif
155# endif
156# if defined (__cplusplus)
157} /* extern "C" */
158# endif
159
160# endif
161
162/* Here we use a macro different than the InterlockedExchangePointer SDK one
163 * to avoid macro definition conflict. */
164# if !defined (_WIN64)
165/* Under 32 bits platform we rely on a simple InterlockedExchange call. */
166# if defined (__cplusplus)
167/* We do not define this function if we are not in a C++ translation unit just
168 * because of the 'inline' keyword portability issue it would introduce. We will
169 * have to fix it the day we need this function for a C translation unit.
170 */
171inline
172void* _STLP_CALL STLPInterlockedExchangePointer(void* volatile* __a, void* __b) {
173# if defined (_STLP_MSVC)
174/* Here MSVC produces warning if 64 bits portability issue is activated.
175 * MSVC do not see that _STLP_ATOMIC_EXCHANGE_PTR is a macro which content
176 * is based on the platform, Win32 or Win64
177 */
178# pragma warning (push)
179# pragma warning (disable : 4311) // pointer truncation from void* to long
180# pragma warning (disable : 4312) // conversion from long to void* of greater size
181# endif
182# if !defined (_STLP_NO_NEW_STYLE_CASTS)
183 return reinterpret_cast<void*>(InterlockedExchange(reinterpret_cast<long*>(const_cast<void**>(__a)),
184 reinterpret_cast<long>(__b)));
185# else
186 return (void*)InterlockedExchange((long*)__a, (long)__b);
187# endif
188# if defined (_STLP_MSVC)
189# pragma warning (pop)
190# endif
191}
192# endif
193# else
194# define STLPInterlockedExchangePointer _InterlockedExchangePointer
195# endif
196
197#endif /* _STLP_WINDOWS_H_INCLUDED && _STLP_WCE */
198
199#endif /* _STLP_WINCE_WINDOWS_SUFFIX_H */
  
4444# endif
4545#endif /* _STLP_BIG_ENDIAN */
4646
47#if !defined (_STLP_WINDOWS_H_INCLUDED)
47#if !defined (_STLP_WINDOWS_H_INCLUDED) && !defined(_STLP_WCE)
4848# define _STLP_WINDOWS_H_INCLUDED
4949# if defined (__BUILDING_STLPORT)
5050# include <stl/config/_native_headers.h>
228228# define STLPInterlockedExchangePointer _InterlockedExchangePointer
229229# endif
230230
231#endif /* _STLP_WINDOWS_H_INCLUDED */
231#endif /* _STLP_WINDOWS_H_INCLUDED && !_STLP_WCE */
232232
233233/* _STLP_WIN95_LIKE signal the Windows 95 OS or assimilated Windows OS version that
234234 * has Interlockeded[Increment, Decrement] Win32 API functions not returning modified
  
10511051#undef _STLP_NO_NEW_STYLE_CASTS
10521052#undef __AUTO_CONFIGURED
10531053
1054
1055/* This should always be at the end of features.h. In order to avoid circular dependencies on
1056 Windows CE with the CRT extensions, we delay including windows.h until here.
1057 */
1058#if defined(_STLP_WCE)
1059# include <stl/config/_wince_windows_suffix.h>
1060#endif
1061
1062
10541063#endif /* _STLP_FEATURES_H */