| Index: src/plugin/ATL_Deprecate.h |
| =================================================================== |
| new file mode 100644 |
| --- /dev/null |
| +++ b/src/plugin/ATL_Deprecate.h |
| @@ -0,0 +1,139 @@ |
| +/** |
| + * \file ATL_Deprecate.h Include package for all the ATL headers, with optional forwarding to detect ATL dependencies. |
| + * |
| + * This header is a nexus for refactoring work to remove ATL. |
| + * In forwarding-disabled mode, this is simply includes the ATL headers. |
| + * With forwarding turned on, the ATL headers are included within a namespace. |
| + * The particular ATL items used are then manually reintroduced into visibility. |
| + * This method allows explicitly enumerating each of the symbols required to get the code to compile. |
| + * |
| + * When ATL is forwarded, the code does not link. |
| + * The ATL DLL libraries expose symbols in the ATL namespace. |
| + * The forwarded libraries use a different namespace. |
| + * Thus the external symbols do not match, and the linker reports unresolved externals. |
| + * If desired, these externals could be linked through proxy classes, |
| + * although these are not written as yet. |
| + * The main purpose of this mechanism is to determine the exact scope of the refactoring effort. |
| + */ |
| + |
| +/* |
| + * NDEBUG is defined for release but not for debug, so release versions never forward. |
| + * Because the plugin doesn't link correctly with forwarding turned off, forwarding is disabled by default even for debug. |
| + */ |
| +#define DISABLE_FORWARDING_FOR_DEBUG 1 |
| +#define DISABLE_ATL_FORWARDING defined(NDEBUG) || DISABLE_FORWARDING_FOR_DEBUG |
| + |
| +#if DISABLE_ATL_FORWARDING |
| + |
| +#include <atlbase.h> |
| +#include <atlstr.h> |
| +#include <atltypes.h> |
| +#include <atlcom.h> |
| +#include <atlhost.h> |
| + |
| + |
| +#else |
| + |
| +/* |
| + * ATL requires the following includes in the global namespace. |
| + */ |
| +#include <apiset.h> |
| +#include <apisetcconv.h> |
| +#include <rpc.h> |
| +#include <rpcndr.h> |
| +#include <pshpack8.h> |
| +#include <stddef.h> |
| +#include <string.h> |
| +#include <malloc.h> |
| +#include <mbstring.h> |
| +#include <wchar.h> |
| +#include <tchar.h> |
| +#include <stdlib.h> |
| +#include <comutil.h> |
| +#include <OaIdl.h> |
| +#include <ObjIdl.h> |
| +#include <new> |
| +#include <propsys.h> |
| +#include <ShObjIdl.h> |
| +#include <ShlObj.h> |
| +#include <Shlwapi.h> |
| +#include <MsHTML.h> |
| +#include <crtdbg.h> |
| +#include <ole2.h> |
| +#include <MsHtmHst.h> |
| + |
| +/* |
| + * ATL is used as an explicit global namespace within ATL itself. |
| + * These declarations forward the wrapped ATL namespace back into the global one. |
| + * Fortuitously, none of the plugin code uses explicitly global ATL |
| + */ |
| +namespace OLD_ATL { |
| + namespace ATL { |
| + } |
| +} |
| +namespace ATL = OLD_ATL::ATL ; |
| + |
| +namespace OLD_ATL { |
| + /* |
| + * We need to bring some globals back into this namespace. |
| + */ |
| + using ::tagVARIANT ; |
| + using ::IStream ; |
| + |
| + /* |
| + * The original five ATL include files. |
| + */ |
| + #include <atlbase.h> |
| + #include <atlstr.h> |
| + #include <atltypes.h> |
| + #include <atlcom.h> |
| + #include <atlhost.h> |
| +} |
| + |
| +using OLD_ATL::_AtlBaseModule; |
| +using OLD_ATL::CAtlBaseModule; |
| +using OLD_ATL::CComAggObject; |
| +using OLD_ATL::CComAutoCriticalSection; |
| +using OLD_ATL::CComClassFactory; |
| +using OLD_ATL::CComCoClass; |
| +using OLD_ATL::CComCreator; |
| +using OLD_ATL::CComCreator2; |
| +using OLD_ATL::CComModule; |
| +using OLD_ATL::CComMultiThreadModel; |
| +using OLD_ATL::CComObject; |
| +using OLD_ATL::CComObjectNoLock; |
| +using OLD_ATL::CComObjectRootEx; |
| +using OLD_ATL::CComPtr; |
| +using OLD_ATL::CComQIPtr; |
| +using OLD_ATL::CComSingleThreadModel; |
| +using OLD_ATL::CRect; |
| +using OLD_ATL::CSimpleArray; |
| +using OLD_ATL::IDispatchImpl; |
| +using OLD_ATL::IObjectWithSiteImpl; |
| +using OLD_ATL::OLE2T; |
| + |
| +#endif |
| + |
| +/* |
| + * Deprecation pragmas use the compiler to identify refactoring targets. |
| + */ |
| +#if DISABLE_ATL_FORWARDING |
| +namespace ATL { |
| +#else |
| +namespace OLD_ATL { |
| +#endif |
| +#pragma deprecated( CString ) |
| +#pragma deprecated( CComBSTR ) |
| +#pragma deprecated( CComVariant ) |
| +#pragma deprecated( CW2A ) |
| +} |
| + |
| +/* |
| + * Note: |
| + * The preprocessor symbols ATLASSERT and ATLTRACE appear in the source. |
| + * These resolve to nothing in Release configurations. |
| + * In Debug configurations, these are non-trivial. |
| + * ATLASSERT resolves to an expression with _CrtDbgReportW and _CrtDbgBreak. |
| + * ATLTRACE resolves to a ATL::CTraceFileAndLineInfo. |
| + * These will need to be replaced or removed. |
| + */ |