CatchNonPortable.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 #ifndef NDEBUG // These checks are only for a developer build
11 
12 #if !defined (BENTLEY_NON_PORTABLE)
13 
14 #if defined (NOT_IN_VANCOUVER_WIN32)
15 
16  // These strange-looking function definitions are designed to catch calls to functions that are defined only by MSVC. They only catch callers if the Bentley namespace is shifted in.
17  namespace Bentley
18  {
19  struct __this_function_is_not_portable__use_BeStringUtilities_instead;
20  int strlwr (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
21  int _strlwr (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
22  int strupr (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
23  int _strupr (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
24  int stricmp (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
25  int _stricmp (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
26  int strnicmp (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
27  int _strnicmp (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
28  int strdup (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
29  int _strdup (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
30  int strtok (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
31  int _strtok_s (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
32  int _snprintf_s (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
33  int wcslwr (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
34  int _wcslwr (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
35  int wcsupr (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
36  int _wcsupr (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
37  int wcsicmp (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
38  int _wcsicmp (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
39  int _wtoi (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
40  int wcsdup (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
41  int _wcsdup (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
42  int wcsncpy_s (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
43  int wcstok (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
44  int wcstok_s (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
45  int _snwprintf_s (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
46  int snwprintf (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
47  int _snwprintf (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
48  int swprintf (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
49  int _swprintf (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
50  int GetACP (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
51  int swscanf (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
52  int wcstoul (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
53  int wtoi (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
54  int wtod (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
55  int wtof (__this_function_is_not_portable__use_BeStringUtilities_instead&, ...);
56 
57  struct __this_function_is_not_portable__use_BeFile_instead;
58  int _wfsopen (__this_function_is_not_portable__use_BeFile_instead&, ...);
59  int _wfopen (__this_function_is_not_portable__use_BeFile_instead&, ...);
60  int GetLastError (__this_function_is_not_portable__use_BeFile_instead&, ...);
61  int GetFileTime (__this_function_is_not_portable__use_BeFile_instead&, ...);
62  int SetFileTime (__this_function_is_not_portable__use_BeFile_instead&, ...);
63  int SetFilePointer (__this_function_is_not_portable__use_BeFile_instead&, ...);
64  int SetFilePointerEx (__this_function_is_not_portable__use_BeFile_instead&, ...);
65  int GetFileSize (__this_function_is_not_portable__use_BeFile_instead&, ...);
66  int GetFileSizeEx (__this_function_is_not_portable__use_BeFile_instead&, ...);
67  int ReadFile (__this_function_is_not_portable__use_BeFile_instead&, ...);
68  int WriteFile (__this_function_is_not_portable__use_BeFile_instead&, ...);
69  int CloseHandle (__this_function_is_not_portable__use_BeFile_instead&, ...);
70  int CreateFileW (__this_function_is_not_portable__use_BeFile_instead&, ...);
71  int FormatMessageW (__this_function_is_not_portable__use_BeFile_instead&, ...);
72  int _chsize_s (__this_function_is_not_portable__use_BeFile_instead&, ...);
73 
74  struct __this_function_is_not_portable__use_BeFileName_instead;
75  int _wmakepath (__this_function_is_not_portable__use_BeFileName_instead&, ...);
76  int _wmakepath_s (__this_function_is_not_portable__use_BeFileName_instead&, ...);
77  int _wsplitpath (__this_function_is_not_portable__use_BeFileName_instead&, ...);
78  int _wsplitpath_s (__this_function_is_not_portable__use_BeFileName_instead&, ...);
79  int _stati64 (__this_function_is_not_portable__use_BeFileName_instead&, ...);
80  int _wstati64 (__this_function_is_not_portable__use_BeFileName_instead&, ...);
81  int _wutime64 (__this_function_is_not_portable__use_BeFileName_instead&, ...);
82  int _waccess (__this_function_is_not_portable__use_BeFileName_instead&, ...);
83  int PathFileExistsW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
84  int PathIsDirectoryW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
85  int PathSkipRootW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
86  int PathCanonicalizeW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
87  int PathCompactPathExW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
88  int GetFullPathNameW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
89  int FixPathNameW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
90  int GetTempFileNameW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
91  int GetTempPathW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
92  int SetFileAttributesW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
93  int GetFileAttributesW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
94  int DeleteFileW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
95  int CreateNewDirectoryW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
96  int CloneDirectoryW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
97  int CopyFileW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
98  int MoveFileW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
99  int GetFileInformationByHandle (__this_function_is_not_portable__use_BeFileName_instead&, ...);
100  int GetDiskFreeSpaceExW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
101  int GetDriveTypeW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
102  int PathAddBackslashW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
103  int PathStripToRootW (__this_function_is_not_portable__use_BeFileName_instead&, ...);
104 
105  struct __this_function_is_not_portable__see_BeFileName_h;
106  int GetModuleFileNameW (__this_function_is_not_portable__see_BeFileName_h&, ...);
107  int _wgetcwd (__this_function_is_not_portable__see_BeFileName_h&, ...);
108 
109  struct __this_function_is_not_portable__use_BeFileListIterator_instead;
110  int FindFirstFileW (__this_function_is_not_portable__use_BeFileListIterator_instead&, ...);
111  int FindFirstFileA (__this_function_is_not_portable__use_BeFileListIterator_instead&, ...);
112 
113  struct __this_function_is_not_portable__use_BeThreadLocalStorage_instead;
114  int TlsAlloc (__this_function_is_not_portable__use_BeThreadLocalStorage_instead&, ...);
115  int TlsSetValue (__this_function_is_not_portable__use_BeThreadLocalStorage_instead&, ...);
116  int TlsGetValue (__this_function_is_not_portable__use_BeThreadLocalStorage_instead&, ...);
117 
118  struct __this_function_is_not_portable__use_BeCriticalSection_instead;
119  int InitializeCriticalSection (__this_function_is_not_portable__use_BeCriticalSection_instead&, ...);
120  int DeleteCriticalSection (__this_function_is_not_portable__use_BeCriticalSection_instead&, ...);
121  int EnterCriticalSection (__this_function_is_not_portable__use_BeCriticalSection_instead&, ...);
122  int LeaveCriticalSection (__this_function_is_not_portable__use_BeCriticalSection_instead&, ...);
123  int GetCurrentThreadId (__this_function_is_not_portable__use_BeCriticalSection_instead&, ...);
124 
125  struct __this_function_is_not_portable__see_BeCriticalSection_h;
126  int InterlockedIncrement (__this_function_is_not_portable__see_BeCriticalSection_h&, ...);
127  int InterlockedDecrement (__this_function_is_not_portable__see_BeCriticalSection_h&, ...);
128  int Sleep (__this_function_is_not_portable__see_BeCriticalSection_h&, ...);
129 
130  struct __this_function_is_not_portable__use_BeVirtualMemory_instead;
131  int VirtualAlloc (__this_function_is_not_portable__use_BeVirtualMemory_instead&, ...);
132  int VirtualQuery (__this_function_is_not_portable__use_BeVirtualMemory_instead&, ...);
133  int VirtualProtect (__this_function_is_not_portable__use_BeVirtualMemory_instead&, ...);
134  int GetSystemInfo (__this_function_is_not_portable__use_BeVirtualMemory_instead&, ...);
135  int _get_heap_handle (__this_function_is_not_portable__use_BeVirtualMemory_instead&, ...);
136 
137  struct __this_function_is_not_portable__use_BeTimeUtilities_instead;
138  int GetTickCount (__this_function_is_not_portable__use_BeTimeUtilities_instead&, ...);
139  int QueryPerformanceCounter (__this_function_is_not_portable__use_BeTimeUtilities_instead&, ...);
140  int QueryPerformanceFrequency (__this_function_is_not_portable__use_BeTimeUtilities_instead&, ...);
141  int GetSystemTime (__this_function_is_not_portable__use_BeTimeUtilities_instead&, ...);
142  int SystemTimeToFileTime (__this_function_is_not_portable__use_BeTimeUtilities_instead&, ...);
143  int FileTimeToLocalFileTime (__this_function_is_not_portable__use_BeTimeUtilities_instead&, ...);
144  int GetTimeFormatW (__this_function_is_not_portable__use_BeTimeUtilities_instead&, ...);
145  int GetDateFormatW (__this_function_is_not_portable__use_BeTimeUtilities_instead&, ...);
146  int _mktime64 (__this_function_is_not_portable__use_BeTimeUtilities_instead&, ...);
147 
148  struct __this_function_cannot_be_used_in_portable_code;
149  int CoInitialize (__this_function_cannot_be_used_in_portable_code&, ...);
150  int CoCreateInstance (__this_function_cannot_be_used_in_portable_code&, ...);
151  int QueryInterface (__this_function_cannot_be_used_in_portable_code&, ...);
152  };
153 
154  using namespace Bentley;
155 
156  #define __super __super_is_not_portable_use_T_Super
157 
158 #elif defined (__GNUC__)
159 
160  // Catch attempts to use functions that are specific to GCC....
161 
162 #endif
163 
164 #endif
165 
166 #endif//ndef NDEBUG // These checks are only for a developer build

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.