stdafx.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. #if DBG
  7. #else // DBG
  8. #pragma warning(disable: 4189) // initialized but unused variable (e.g. variable that may only used by assert)
  9. #endif
  10. #define Unused(var) var;
  11. #define IfFailedReturn(EXPR) do { hr = (EXPR); if (FAILED(hr)) { return hr; }} while(FALSE)
  12. #define IfFailedGoLabel(expr, label) do { hr = (expr); if (FAILED(hr)) { goto label; } } while (FALSE)
  13. #define IfFailGo(expr) IfFailedGoLabel(hr = (expr), Error)
  14. #define IfJsrtErrorFail(expr, ret) do { if ((expr) != JsNoError) return ret; } while (0)
  15. #define IfJsrtErrorHR(expr) do { if((expr) != JsNoError) { hr = E_FAIL; goto Error; } } while(0)
  16. #define IfJsrtError(expr) do { if((expr) != JsNoError) { goto Error; } } while(0)
  17. #define IfJsrtErrorSetGo(expr) do { errorCode = (expr); if(errorCode != JsNoError) { hr = E_FAIL; goto Error; } } while(0)
  18. #define IfFalseGo(expr) do { if(!(expr)) { hr = E_FAIL; goto Error; } } while(0)
  19. #define WIN32_LEAN_AND_MEAN 1
  20. #define ENABLE_TEST_HOOKS 1
  21. #include "CommonDefines.h"
  22. #include <windows.h>
  23. #include <stdarg.h>
  24. #include <stdio.h>
  25. #include <io.h>
  26. #if defined(_DEBUG)
  27. #define _DEBUG_WAS_DEFINED
  28. #undef _DEBUG
  29. #endif
  30. #include <map>
  31. #include <atlbase.h>
  32. #ifdef _DEBUG_WAS_DEFINED
  33. #define _DEBUG
  34. #undef _DEBUG_WAS_DEFINED
  35. #endif
  36. #ifdef Assert
  37. #undef Assert
  38. #endif
  39. #ifdef AssertMsg
  40. #undef AssertMsg
  41. #endif
  42. #if defined(DBG)
  43. #define AssertMsg(exp, comment) \
  44. do { \
  45. if (!(exp)) \
  46. { \
  47. fprintf(stderr, "ASSERTION (%s, line %d) %s %s\n", __FILE__, __LINE__, _CRT_STRINGIZE(exp), comment); \
  48. fflush(stderr); \
  49. DebugBreak(); \
  50. } \
  51. } while (0)
  52. #else
  53. #define AssertMsg(exp, comment) ((void)0)
  54. #endif //defined(DBG)
  55. #define Assert(exp) AssertMsg(exp, #exp)
  56. #define _JSRT_
  57. #include "ChakraCommon.h"
  58. #include "TestHooksRt.h"
  59. typedef void * Var;
  60. #include "TestHooks.h"
  61. #include "ChakraRtInterface.h"
  62. #include "Helpers.h"
  63. #include "HostConfigFlags.h"
  64. #include "MessageQueue.h"
  65. #include "WScriptJsrt.h"