Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / tests / Compiler_Features_39_Test.cpp
blob64c7dbc21cb10aa512e199d98d2654a00c4c65e8
1 /**
2 * This program checks if the compiler/RTL does have correct support
3 * for structured exception handling
4 */
6 #include "test_config.h"
8 #if defined (ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS)
9 int ExFilter(EXCEPTION_POINTERS *ep, DWORD code_arg)
11 ACE_DEBUG ((LM_INFO,("In SEH Filter\n")));
12 ACE_DEBUG ((LM_INFO,("Code param=%d\n"), code_arg));
13 ACE_DEBUG ((LM_INFO,("\tep->ExceptionRecord->ExceptionCode =%d\n"), ep->ExceptionRecord->ExceptionCode));
14 ACE_DEBUG ((LM_INFO,("\tep->ExceptionRecord->ExceptionAddress =%@\n"), ep->ExceptionRecord->ExceptionAddress));
15 if (ep->ExceptionRecord->NumberParameters >= 1)
16 ACE_DEBUG ((LM_INFO,("\tep->ExceptionRecord->ExceptionInformation[0]=%@\n"), ep->ExceptionRecord->ExceptionInformation[0]));
17 if (ep->ExceptionRecord->NumberParameters == 2)
18 ACE_DEBUG ((LM_INFO,("\tep->ExceptionRecord->ExceptionInformation[1]=%@\n"), ep->ExceptionRecord->ExceptionInformation[1]));
19 return 1;
22 void test()
24 volatile int* pInt = 0x0000000;
25 *pInt = 20;
28 #endif /* ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS */
30 int
31 run_main (int, ACE_TCHAR *[])
33 ACE_START_TEST (ACE_TEXT("Compiler_Features_39_Test"));
35 #if defined (ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS)
36 ACE_DEBUG ((LM_DEBUG,("Testing call SEH\n")));
38 ACE_SEH_TRY
40 test();
42 ACE_SEH_EXCEPT (ExFilter(GetExceptionInformation(), GetExceptionCode()))
44 ACE_DEBUG ((LM_DEBUG,("In SEH call\n")));
47 ACE_DEBUG ((LM_DEBUG,("SEH call worked\n")));
49 ACE_DEBUG ((LM_DEBUG,("Testing non-call SEH\n")));
51 ACE_SEH_TRY
53 volatile int* pInt = 0x0000000;
54 *pInt = 20;
56 ACE_SEH_EXCEPT (ExFilter(GetExceptionInformation(), GetExceptionCode()))
58 ACE_DEBUG ((LM_DEBUG,("In SEH non-call\n")));
61 ACE_DEBUG ((LM_DEBUG,("SEH non-call worked\n")));
62 #else
63 ACE_DEBUG ((LM_INFO,
64 ACE_TEXT ("Platform lacks ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS\n")));
65 #endif /* ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS */
67 ACE_END_TEST;
69 return 0;