mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
[COMPILER_APITEST] Add SEH tests from MS (#2435)
* [COMPILER_APITEST] Import MS EH/SEH tests Taken from https://github.com/microsoft/compiler-tests * [CRT] Add missing declaration of _longjmpex * [COMPILER_APITEST] Add cmake build files for MS SEH test It is built as a static library * [COMPILER_APITEST] Fix GCC build of MS SEH tests There are a number of hacks in there now. Also the volatile hacks should be separated and sent upstream. * [COMPILER_APITEST] Fix x64 build of MS SEH tests * [COMPILER_APITEST] Fix clang build of MS SEH tests * [COMPILER_APITEST] Include MS SEH tests
This commit is contained in:
parent
698a8e6554
commit
fe36f081c7
102 changed files with 85690 additions and 1 deletions
|
@ -1,12 +1,15 @@
|
|||
|
||||
add_subdirectory(ms)
|
||||
|
||||
list(APPEND SOURCE
|
||||
ms_seh.c
|
||||
pseh.c
|
||||
pseh_cpp.cpp
|
||||
psehtest2.c
|
||||
testlist.c)
|
||||
|
||||
add_executable(compiler_apitest ${SOURCE})
|
||||
target_link_libraries(compiler_apitest wine ${PSEH_LIB})
|
||||
target_link_libraries(compiler_apitest ms_seh_test wine ${PSEH_LIB})
|
||||
set_module_type(compiler_apitest win32cui)
|
||||
add_importlibs(compiler_apitest msvcrt kernel32 ntdll)
|
||||
add_rostests_file(TARGET compiler_apitest)
|
||||
|
|
2
modules/rostests/apitests/compiler/ms/CMakeLists.txt
Normal file
2
modules/rostests/apitests/compiler/ms/CMakeLists.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
add_subdirectory(seh)
|
21
modules/rostests/apitests/compiler/ms/LICENSE.TXT
Normal file
21
modules/rostests/apitests/compiler/ms/LICENSE.TXT
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
28
modules/rostests/apitests/compiler/ms/README.md
Normal file
28
modules/rostests/apitests/compiler/ms/README.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
Microsoft compiler-tests
|
||||
========================
|
||||
|
||||
Introduction
|
||||
------------
|
||||
This repo includes selected tests from the Microsoft compiler-tests directory.
|
||||
The initial focus is on exception handling tests, both for C++EH and SEH, to make it easier to test WinEH implementations for compatibility with the platform. The expectation is that this set of tests will grow and ultimately be added to the LLVM test-suite. Opening this as a separate repo is intended as a stop gap as the work to get the LLVM test-suite to run clean on Windows progresses.
|
||||
|
||||
Supported Platforms
|
||||
-------------------
|
||||
The first round of tests being opened are EH, the bulk of which are SEH tests. This is naturally Windows specific. Additionally only the most rudimentary harness is included (runtests.cmd) due to our objective to move these tests into the LLVM harness.
|
||||
|
||||
Quick Start
|
||||
-----------
|
||||
There are two main sub directories in the compiler-tests directory. The descriptions of what they contain are listed below. Overtime we expect to open more tests in these directories as well as add new areas of testing.
|
||||
|
||||
####EH (C++EH)
|
||||
Only one test is included here now, ihateeh.cxx. This tests object destructor semantics on Windows. Compile the file with usual flag combinations (MSVC) and compare with the output file ihateeh.out.correct.
|
||||
|
||||
####SEH
|
||||
The main tests in this directory are sehframes.cpp which tests various funclet frames, and xcpt4u.c which is a large collection of SEH torture tests. This last test is one of the main litmus tests used to verify that a compiler supports SEH suffiently to be used in the Windows kernel. Remaining sehxxxx.c tests are particular break outs from xcpt4u.c for ease of debugging.
|
||||
|
||||
- Run the runtest.cmd in the seh directory to build the tests with MSVC.
|
||||
- Run the clean.cmd to clean up obj/exes left after running the tests.
|
||||
|
||||
Next Steps
|
||||
----------
|
||||
More tests will follow. If there are particular areas where there are questions please open an issue and we'll see if there are tests that can meet the need.
|
11
modules/rostests/apitests/compiler/ms/changes.txt
Normal file
11
modules/rostests/apitests/compiler/ms/changes.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
Outline of changes from the old legacy tree to clean up for the open.
|
||||
|
||||
all
|
||||
- Removed commented out legacy code hooking to the old test.h system.
|
||||
- Formated to LLVM style.
|
||||
|
||||
xcpt4u.c
|
||||
- Cleaned up old comments refering to old products/bug numbers.
|
||||
|
||||
ihateeh.cxx
|
||||
- Switched main to return int.
|
552
modules/rostests/apitests/compiler/ms/eh/ehframes.cpp
Normal file
552
modules/rostests/apitests/compiler/ms/eh/ehframes.cpp
Normal file
|
@ -0,0 +1,552 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
/*
|
||||
* Exercise lots of different kinds of C++ EH frames. Compile this with
|
||||
* every combination of opts you can to stress the C++ EH frame code in the
|
||||
* backend.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#ifndef ALIGN
|
||||
#define ALIGN 64
|
||||
#endif
|
||||
|
||||
extern int TestFunc(int, ...);
|
||||
|
||||
int failures;
|
||||
|
||||
int global;
|
||||
bool TestFuncThrows;
|
||||
|
||||
struct SmallObj
|
||||
{
|
||||
virtual ~SmallObj()
|
||||
{
|
||||
TestFunc(1, this);
|
||||
};
|
||||
|
||||
int x;
|
||||
};
|
||||
|
||||
struct BigObj
|
||||
{
|
||||
virtual ~BigObj()
|
||||
{
|
||||
TestFunc(1, this);
|
||||
};
|
||||
|
||||
char x[4096];
|
||||
};
|
||||
|
||||
int Simple(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
SmallObj f;
|
||||
return TestFunc(1, &f, &res, &arg);
|
||||
}
|
||||
|
||||
int Try(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
SmallObj f;
|
||||
try {
|
||||
res = TestFunc(1, &f, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, &f, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookie(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
SmallObj f;
|
||||
return TestFunc(1, buf, &f, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndGSCookie(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
SmallObj f;
|
||||
try {
|
||||
res = TestFunc(1, &buf, &f, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, &buf, &f, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int Align(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
return TestFunc(1, d, &f, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndAlign(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
try {
|
||||
res = TestFunc(1, d, &f, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, d, &f, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlign(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
return TestFunc(1, buf, d, &f, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlign(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
try {
|
||||
res = TestFunc(1, buf, d, &f, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, buf, d, &f, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int Alloca(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
SmallObj f;
|
||||
return TestFunc(1, _alloca(global), &f, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndAlloca(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
SmallObj f;
|
||||
try {
|
||||
res = TestFunc(1, _alloca(global), &f, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, &f, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlloca(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
SmallObj f;
|
||||
return TestFunc(1, buf, _alloca(global), &f, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlloca(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
SmallObj f;
|
||||
try {
|
||||
res = TestFunc(1, &buf, _alloca(global), &f, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, &buf, &f, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AlignAndAlloca(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
return TestFunc(1, d, _alloca(global), &f, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndAlignAndAlloca(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
try {
|
||||
res = TestFunc(1, d, _alloca(global), &f, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, d, &f, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlignAndAlloca(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
return TestFunc(1, buf, d, _alloca(global), &f, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlignAndAlloca(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
try {
|
||||
res = TestFunc(1, buf, d, _alloca(global), &f, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, buf, d, &f, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/* The *AndBigLocals set of functions try to trigger EBP adjustment */
|
||||
|
||||
int BigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
BigObj f1;
|
||||
return TestFunc(1, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
BigObj f1;
|
||||
try {
|
||||
res = TestFunc(1, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
return TestFunc(1, buf, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
try {
|
||||
res = TestFunc(1, &buf, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, &buf, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AlignAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
return TestFunc(1, d, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndAlignAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
try {
|
||||
res = TestFunc(1, d, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, d, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlignAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
return TestFunc(1, buf, d, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlignAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
try {
|
||||
res = TestFunc(1, buf, d, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, buf, d, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AllocaAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
BigObj f1;
|
||||
return TestFunc(1, _alloca(global), &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndAllocaAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
BigObj f1;
|
||||
try {
|
||||
res = TestFunc(1, _alloca(global), &f1, &res, &res, &res, &res, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAllocaAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
return TestFunc(1, buf, _alloca(global), &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAllocaAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
try {
|
||||
res = TestFunc(1, &buf, _alloca(global), &f1, &res, &res, &res, &res, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, &buf, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AlignAndAllocaAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
return TestFunc(1, d, _alloca(global), &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndAlignAndAllocaAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
try {
|
||||
res = TestFunc(1, d, _alloca(global), &f1, &res, &res, &res, &res, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, d, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlignAndAllocaAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
return TestFunc(1, buf, d, _alloca(global), &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlignAndAllocaAndBigLocals(int arg)
|
||||
{
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
try {
|
||||
res = TestFunc(1, buf, d, _alloca(global), &f1, &res, &res, &res, &res, &res, &arg);
|
||||
} catch (double) {
|
||||
res = TestFunc(2, buf, d, &f1, &res, &res, &res, &res, &res, &arg);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
__declspec(noinline)
|
||||
int TestFunc(int, ...)
|
||||
{
|
||||
if (TestFuncThrows)
|
||||
{
|
||||
TestFuncThrows = false;
|
||||
throw 123;
|
||||
}
|
||||
|
||||
return global;
|
||||
}
|
||||
|
||||
void RunTests()
|
||||
{
|
||||
puts("Test pass 1 - no throws");
|
||||
|
||||
try
|
||||
{
|
||||
Simple(1);
|
||||
Try(1);
|
||||
GSCookie(1);
|
||||
TryAndGSCookie(1);
|
||||
Align(1);
|
||||
TryAndAlign(1);
|
||||
GSCookieAndAlign(1);
|
||||
TryAndGSCookieAndAlign(1);
|
||||
Alloca(1);
|
||||
TryAndAlloca(1);
|
||||
GSCookieAndAlloca(1);
|
||||
TryAndGSCookieAndAlloca(1);
|
||||
AlignAndAlloca(1);
|
||||
TryAndAlignAndAlloca(1);
|
||||
GSCookieAndAlignAndAlloca(1);
|
||||
TryAndGSCookieAndAlignAndAlloca(1);
|
||||
BigLocals(1);
|
||||
TryAndBigLocals(1);
|
||||
GSCookieAndBigLocals(1);
|
||||
TryAndGSCookieAndBigLocals(1);
|
||||
AlignAndBigLocals(1);
|
||||
TryAndAlignAndBigLocals(1);
|
||||
GSCookieAndAlignAndBigLocals(1);
|
||||
TryAndGSCookieAndAlignAndBigLocals(1);
|
||||
AllocaAndBigLocals(1);
|
||||
TryAndAllocaAndBigLocals(1);
|
||||
GSCookieAndAllocaAndBigLocals(1);
|
||||
TryAndGSCookieAndAllocaAndBigLocals(1);
|
||||
AlignAndAllocaAndBigLocals(1);
|
||||
TryAndAlignAndAllocaAndBigLocals(1);
|
||||
GSCookieAndAlignAndAllocaAndBigLocals(1);
|
||||
TryAndGSCookieAndAlignAndAllocaAndBigLocals(1);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
puts("ERROR - throw not expected");
|
||||
++failures;
|
||||
}
|
||||
|
||||
puts("Test pass 2 - throws");
|
||||
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
TestFuncThrows = true;
|
||||
bool caught = false;
|
||||
try
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: Simple(1); break;
|
||||
case 1: Try(1); break;
|
||||
case 2: GSCookie(1); break;
|
||||
case 3: TryAndGSCookie(1); break;
|
||||
case 4: Align(1); break;
|
||||
case 5: TryAndAlign(1); break;
|
||||
case 6: GSCookieAndAlign(1); break;
|
||||
case 7: TryAndGSCookieAndAlign(1); break;
|
||||
case 8: Alloca(1); break;
|
||||
case 9: TryAndAlloca(1); break;
|
||||
case 10: GSCookieAndAlloca(1); break;
|
||||
case 11: TryAndGSCookieAndAlloca(1); break;
|
||||
case 12: AlignAndAlloca(1); break;
|
||||
case 13: TryAndAlignAndAlloca(1); break;
|
||||
case 14: GSCookieAndAlignAndAlloca(1); break;
|
||||
case 15: TryAndGSCookieAndAlignAndAlloca(1); break;
|
||||
case 16: BigLocals(1); break;
|
||||
case 17: TryAndBigLocals(1); break;
|
||||
case 18: GSCookieAndBigLocals(1); break;
|
||||
case 19: TryAndGSCookieAndBigLocals(1); break;
|
||||
case 20: AlignAndBigLocals(1); break;
|
||||
case 21: TryAndAlignAndBigLocals(1); break;
|
||||
case 22: GSCookieAndAlignAndBigLocals(1); break;
|
||||
case 23: TryAndGSCookieAndAlignAndBigLocals(1); break;
|
||||
case 24: AllocaAndBigLocals(1); break;
|
||||
case 25: TryAndAllocaAndBigLocals(1); break;
|
||||
case 26: GSCookieAndAllocaAndBigLocals(1); break;
|
||||
case 27: TryAndGSCookieAndAllocaAndBigLocals(1); break;
|
||||
case 28: AlignAndAllocaAndBigLocals(1); break;
|
||||
case 29: TryAndAlignAndAllocaAndBigLocals(1); break;
|
||||
case 30: GSCookieAndAlignAndAllocaAndBigLocals(1); break;
|
||||
case 31: TryAndGSCookieAndAlignAndAllocaAndBigLocals(1); break;
|
||||
}
|
||||
}
|
||||
catch (int)
|
||||
{
|
||||
caught = true;
|
||||
}
|
||||
|
||||
if (!caught)
|
||||
{
|
||||
puts("ERROR - did not catch expected thrown object");
|
||||
++failures;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
__try
|
||||
{
|
||||
RunTests();
|
||||
}
|
||||
__except (1)
|
||||
{
|
||||
puts("ERROR - Unexpectedly caught an exception");
|
||||
++failures;
|
||||
}
|
||||
|
||||
if (failures)
|
||||
{
|
||||
printf("Test failed with %d failure%s\n",
|
||||
failures, failures == 1 ? "" : "s");
|
||||
}
|
||||
else
|
||||
{
|
||||
puts("Test passed");
|
||||
}
|
||||
|
||||
return failures;
|
||||
}
|
67
modules/rostests/apitests/compiler/ms/eh/ehframes.out
Normal file
67
modules/rostests/apitests/compiler/ms/eh/ehframes.out
Normal file
|
@ -0,0 +1,67 @@
|
|||
Test pass 1 - no throws
|
||||
Simple
|
||||
Try
|
||||
GSCookie
|
||||
TryAndGSCookie
|
||||
Align
|
||||
TryAndAlign
|
||||
GSCookieAndAlign
|
||||
TryAndGSCookieAndAlign
|
||||
Alloca
|
||||
TryAndAlloca
|
||||
GSCookieAndAlloca
|
||||
TryAndGSCookieAndAlloca
|
||||
AlignAndAlloca
|
||||
TryAndAlignAndAlloca
|
||||
GSCookieAndAlignAndAlloca
|
||||
TryAndGSCookieAndAlignAndAlloca
|
||||
BigLocals
|
||||
TryAndBigLocals
|
||||
GSCookieAndBigLocals
|
||||
TryAndGSCookieAndBigLocals
|
||||
AlignAndBigLocals
|
||||
TryAndAlignAndBigLocals
|
||||
GSCookieAndAlignAndBigLocals
|
||||
TryAndGSCookieAndAlignAndBigLocals
|
||||
AllocaAndBigLocals
|
||||
TryAndAllocaAndBigLocals
|
||||
GSCookieAndAllocaAndBigLocals
|
||||
TryAndGSCookieAndAllocaAndBigLocals
|
||||
AlignAndAllocaAndBigLocals
|
||||
TryAndAlignAndAllocaAndBigLocals
|
||||
GSCookieAndAlignAndAllocaAndBigLocals
|
||||
TryAndGSCookieAndAlignAndAllocaAndBigLocals
|
||||
Test pass 2 - throws
|
||||
Simple
|
||||
Try
|
||||
GSCookie
|
||||
TryAndGSCookie
|
||||
Align
|
||||
TryAndAlign
|
||||
GSCookieAndAlign
|
||||
TryAndGSCookieAndAlign
|
||||
Alloca
|
||||
TryAndAlloca
|
||||
GSCookieAndAlloca
|
||||
TryAndGSCookieAndAlloca
|
||||
AlignAndAlloca
|
||||
TryAndAlignAndAlloca
|
||||
GSCookieAndAlignAndAlloca
|
||||
TryAndGSCookieAndAlignAndAlloca
|
||||
BigLocals
|
||||
TryAndBigLocals
|
||||
GSCookieAndBigLocals
|
||||
TryAndGSCookieAndBigLocals
|
||||
AlignAndBigLocals
|
||||
TryAndAlignAndBigLocals
|
||||
GSCookieAndAlignAndBigLocals
|
||||
TryAndGSCookieAndAlignAndBigLocals
|
||||
AllocaAndBigLocals
|
||||
TryAndAllocaAndBigLocals
|
||||
GSCookieAndAllocaAndBigLocals
|
||||
TryAndGSCookieAndAllocaAndBigLocals
|
||||
AlignAndAllocaAndBigLocals
|
||||
TryAndAlignAndAllocaAndBigLocals
|
||||
GSCookieAndAlignAndAllocaAndBigLocals
|
||||
TryAndGSCookieAndAlignAndAllocaAndBigLocals
|
||||
Test passed
|
676
modules/rostests/apitests/compiler/ms/eh/ehthrow.amd64
Normal file
676
modules/rostests/apitests/compiler/ms/eh/ehthrow.amd64
Normal file
|
@ -0,0 +1,676 @@
|
|||
|
||||
Test #1
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
A ctor. i = 2
|
||||
B ctor. i = 3
|
||||
B ctor. i = 4
|
||||
A copy ctor. i = 5
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
Throwing
|
||||
B ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A copy ctor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B ctor. i = 9
|
||||
B ctor. i = 10
|
||||
A copy ctor. i = 11
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A dtor. i = 5
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B ctor. i = 14
|
||||
B ctor. i = 15
|
||||
A dtor. i = 2
|
||||
B dtor. i = 15
|
||||
B dtor. i = 14
|
||||
B dtor. i = 1
|
||||
B ctor. i = 16
|
||||
B ctor. i = 17
|
||||
A dtor. i = 0
|
||||
B dtor. i = 17
|
||||
B dtor. i = 16
|
||||
In main's catch
|
||||
B ctor. i = 18
|
||||
B ctor. i = 19
|
||||
A dtor. i = 11
|
||||
B dtor. i = 19
|
||||
B dtor. i = 18
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A dtor. i = 8
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
|
||||
|
||||
Test #2
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
A ctor. i = 2
|
||||
A ctor. i = 3
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
A copy ctor. i = 6
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
Throwing
|
||||
B ctor. i = 7
|
||||
B ctor. i = 8
|
||||
A copy ctor. i = 9
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B ctor. i = 10
|
||||
B ctor. i = 11
|
||||
A copy ctor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 10
|
||||
B ctor. i = 13
|
||||
B ctor. i = 14
|
||||
A dtor. i = 6
|
||||
B dtor. i = 14
|
||||
B dtor. i = 13
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 3
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 2
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
In catch;
|
||||
A ctor. i = 19
|
||||
Rethrowing
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A dtor. i = 19
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B ctor. i = 22
|
||||
B ctor. i = 23
|
||||
A dtor. i = 12
|
||||
B dtor. i = 23
|
||||
B dtor. i = 22
|
||||
B ctor. i = 24
|
||||
B ctor. i = 25
|
||||
A copy ctor. i = 26
|
||||
B dtor. i = 25
|
||||
B dtor. i = 24
|
||||
B dtor. i = 1
|
||||
B ctor. i = 27
|
||||
B ctor. i = 28
|
||||
A dtor. i = 0
|
||||
B dtor. i = 28
|
||||
B dtor. i = 27
|
||||
In main's catch
|
||||
B ctor. i = 29
|
||||
B ctor. i = 30
|
||||
A dtor. i = 26
|
||||
B dtor. i = 30
|
||||
B dtor. i = 29
|
||||
B ctor. i = 31
|
||||
B ctor. i = 32
|
||||
A dtor. i = 9
|
||||
B dtor. i = 32
|
||||
B dtor. i = 31
|
||||
|
||||
|
||||
Test #3
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
A ctor. i = 2
|
||||
A ctor. i = 3
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
A copy ctor. i = 6
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
Throwing
|
||||
B ctor. i = 7
|
||||
B ctor. i = 8
|
||||
A copy ctor. i = 9
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B ctor. i = 10
|
||||
B ctor. i = 11
|
||||
A copy ctor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 10
|
||||
B ctor. i = 13
|
||||
B ctor. i = 14
|
||||
A dtor. i = 6
|
||||
B dtor. i = 14
|
||||
B dtor. i = 13
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 3
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 2
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
In catch
|
||||
A ctor. i = 19
|
||||
Throwing new a
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A copy ctor. i = 22
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A copy ctor. i = 25
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
B ctor. i = 26
|
||||
B ctor. i = 27
|
||||
A dtor. i = 19
|
||||
B dtor. i = 27
|
||||
B dtor. i = 26
|
||||
B ctor. i = 28
|
||||
B ctor. i = 29
|
||||
A dtor. i = 12
|
||||
B dtor. i = 29
|
||||
B dtor. i = 28
|
||||
B ctor. i = 30
|
||||
B ctor. i = 31
|
||||
A dtor. i = 9
|
||||
B dtor. i = 31
|
||||
B dtor. i = 30
|
||||
B dtor. i = 1
|
||||
B ctor. i = 32
|
||||
B ctor. i = 33
|
||||
A dtor. i = 0
|
||||
B dtor. i = 33
|
||||
B dtor. i = 32
|
||||
In main's catch
|
||||
B ctor. i = 34
|
||||
B ctor. i = 35
|
||||
A dtor. i = 25
|
||||
B dtor. i = 35
|
||||
B dtor. i = 34
|
||||
B ctor. i = 36
|
||||
B ctor. i = 37
|
||||
A dtor. i = 22
|
||||
B dtor. i = 37
|
||||
B dtor. i = 36
|
||||
|
||||
|
||||
Test #4
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
A ctor. i = 3
|
||||
A ctor. i = 4
|
||||
A ctor. i = 5
|
||||
A ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A ctor. i = 8
|
||||
A ctor. i = 9
|
||||
B ctor. i = 10
|
||||
B ctor. i = 11
|
||||
A copy ctor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 10
|
||||
Throwing
|
||||
B ctor. i = 13
|
||||
B ctor. i = 14
|
||||
A copy ctor. i = 15
|
||||
B dtor. i = 14
|
||||
B dtor. i = 13
|
||||
B ctor. i = 16
|
||||
B ctor. i = 17
|
||||
A copy ctor. i = 18
|
||||
B dtor. i = 17
|
||||
B dtor. i = 16
|
||||
B ctor. i = 19
|
||||
B ctor. i = 20
|
||||
A dtor. i = 12
|
||||
B dtor. i = 20
|
||||
B dtor. i = 19
|
||||
B ctor. i = 21
|
||||
B ctor. i = 22
|
||||
A dtor. i = 9
|
||||
B dtor. i = 22
|
||||
B dtor. i = 21
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A dtor. i = 8
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
In catch;
|
||||
A ctor. i = 25
|
||||
Rethrowing
|
||||
B ctor. i = 26
|
||||
B ctor. i = 27
|
||||
A dtor. i = 25
|
||||
B dtor. i = 27
|
||||
B dtor. i = 26
|
||||
B ctor. i = 28
|
||||
B ctor. i = 29
|
||||
A dtor. i = 18
|
||||
B dtor. i = 29
|
||||
B dtor. i = 28
|
||||
B ctor. i = 30
|
||||
B ctor. i = 31
|
||||
A copy ctor. i = 32
|
||||
B dtor. i = 31
|
||||
B dtor. i = 30
|
||||
B dtor. i = 7
|
||||
B ctor. i = 33
|
||||
B ctor. i = 34
|
||||
A dtor. i = 6
|
||||
B dtor. i = 34
|
||||
B dtor. i = 33
|
||||
B ctor. i = 35
|
||||
B ctor. i = 36
|
||||
A dtor. i = 5
|
||||
B dtor. i = 36
|
||||
B dtor. i = 35
|
||||
In catch #1
|
||||
B ctor. i = 37
|
||||
Rethrowing
|
||||
B dtor. i = 37
|
||||
B ctor. i = 38
|
||||
B ctor. i = 39
|
||||
A dtor. i = 32
|
||||
B dtor. i = 39
|
||||
B dtor. i = 38
|
||||
B ctor. i = 40
|
||||
B ctor. i = 41
|
||||
A dtor. i = 4
|
||||
B dtor. i = 41
|
||||
B dtor. i = 40
|
||||
B ctor. i = 42
|
||||
B ctor. i = 43
|
||||
A dtor. i = 3
|
||||
B dtor. i = 43
|
||||
B dtor. i = 42
|
||||
In catch #2
|
||||
A ctor. i = 44
|
||||
Throwing new a
|
||||
B ctor. i = 45
|
||||
B ctor. i = 46
|
||||
A copy ctor. i = 47
|
||||
B dtor. i = 46
|
||||
B dtor. i = 45
|
||||
B ctor. i = 48
|
||||
B ctor. i = 49
|
||||
A copy ctor. i = 50
|
||||
B dtor. i = 49
|
||||
B dtor. i = 48
|
||||
B ctor. i = 51
|
||||
B ctor. i = 52
|
||||
A dtor. i = 44
|
||||
B dtor. i = 52
|
||||
B dtor. i = 51
|
||||
B ctor. i = 53
|
||||
B ctor. i = 54
|
||||
A dtor. i = 15
|
||||
B dtor. i = 54
|
||||
B dtor. i = 53
|
||||
B dtor. i = 2
|
||||
In catch #3
|
||||
B ctor. i = 55
|
||||
Rethrowing
|
||||
B dtor. i = 55
|
||||
B ctor. i = 56
|
||||
B ctor. i = 57
|
||||
A dtor. i = 50
|
||||
B dtor. i = 57
|
||||
B dtor. i = 56
|
||||
B ctor. i = 58
|
||||
B ctor. i = 59
|
||||
A copy ctor. i = 60
|
||||
B dtor. i = 59
|
||||
B dtor. i = 58
|
||||
B dtor. i = 1
|
||||
B ctor. i = 61
|
||||
B ctor. i = 62
|
||||
A dtor. i = 0
|
||||
B dtor. i = 62
|
||||
B dtor. i = 61
|
||||
In main's catch
|
||||
B ctor. i = 63
|
||||
B ctor. i = 64
|
||||
A dtor. i = 60
|
||||
B dtor. i = 64
|
||||
B dtor. i = 63
|
||||
B ctor. i = 65
|
||||
B ctor. i = 66
|
||||
A dtor. i = 47
|
||||
B dtor. i = 66
|
||||
B dtor. i = 65
|
||||
|
||||
|
||||
Test #5
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
B ctor. i = 3
|
||||
B ctor. i = 4
|
||||
A ctor. i = 5
|
||||
B ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A copy ctor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
Throwing
|
||||
B ctor. i = 9
|
||||
B ctor. i = 10
|
||||
A copy ctor. i = 11
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A copy ctor. i = 14
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 8
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 5
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
B dtor. i = 2
|
||||
A ctor. i = 19
|
||||
In catch #2
|
||||
B ctor. i = 20
|
||||
Throwing a new b
|
||||
B copy ctor. i = 21
|
||||
B copy ctor. i = 22
|
||||
B dtor. i = 20
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A dtor. i = 19
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
B ctor. i = 25
|
||||
B ctor. i = 26
|
||||
A dtor. i = 14
|
||||
B dtor. i = 26
|
||||
B dtor. i = 25
|
||||
B ctor. i = 27
|
||||
B ctor. i = 28
|
||||
A dtor. i = 11
|
||||
B dtor. i = 28
|
||||
B dtor. i = 27
|
||||
B dtor. i = 1
|
||||
In catch #3
|
||||
Throwing a new a
|
||||
A ctor. i = 29
|
||||
B ctor. i = 30
|
||||
B ctor. i = 31
|
||||
A copy ctor. i = 32
|
||||
B dtor. i = 31
|
||||
B dtor. i = 30
|
||||
B dtor. i = 22
|
||||
B dtor. i = 21
|
||||
B ctor. i = 33
|
||||
B ctor. i = 34
|
||||
A dtor. i = 0
|
||||
B dtor. i = 34
|
||||
B dtor. i = 33
|
||||
In main's catch
|
||||
B ctor. i = 35
|
||||
B ctor. i = 36
|
||||
A dtor. i = 32
|
||||
B dtor. i = 36
|
||||
B dtor. i = 35
|
||||
B ctor. i = 37
|
||||
B ctor. i = 38
|
||||
A dtor. i = 29
|
||||
B dtor. i = 38
|
||||
B dtor. i = 37
|
||||
|
||||
|
||||
Test #6
|
||||
B ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
Throwing a b
|
||||
B copy ctor. i = 3
|
||||
B copy ctor. i = 4
|
||||
B dtor. i = 2
|
||||
B ctor. i = 5
|
||||
In catch #1
|
||||
Throwing a new b
|
||||
B copy ctor. i = 6
|
||||
B copy ctor. i = 7
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
B dtor. i = 1
|
||||
B ctor. i = 8
|
||||
In catch #2
|
||||
Throwing a new b
|
||||
B copy ctor. i = 9
|
||||
B copy ctor. i = 10
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B dtor. i = 0
|
||||
A ctor. i = 11
|
||||
In catch #3
|
||||
Throwing a new a
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A copy ctor. i = 14
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A copy ctor. i = 17
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 18
|
||||
B ctor. i = 19
|
||||
A dtor. i = 11
|
||||
B dtor. i = 19
|
||||
B dtor. i = 18
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
In main's catch
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A dtor. i = 17
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B ctor. i = 22
|
||||
B ctor. i = 23
|
||||
A dtor. i = 14
|
||||
B dtor. i = 23
|
||||
B dtor. i = 22
|
||||
|
||||
|
||||
Test #7
|
||||
B ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
Throwing a b
|
||||
B ctor. i = 3
|
||||
B copy ctor. i = 4
|
||||
B dtor. i = 2
|
||||
B ctor. i = 5
|
||||
In catch #1
|
||||
B ctor. i = 6
|
||||
Rethrowing b
|
||||
B copy ctor. i = 7
|
||||
B dtor. i = 6
|
||||
B ctor. i = 8
|
||||
In catch #1 of catch#1
|
||||
Rethrowing b
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B copy ctor. i = 9
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
B dtor. i = 1
|
||||
B ctor. i = 10
|
||||
In catch #2
|
||||
Throwing a new A
|
||||
A ctor. i = 11
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A copy ctor. i = 14
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
B dtor. i = 3
|
||||
B dtor. i = 0
|
||||
In main's catch
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 14
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 11
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
|
||||
|
||||
Test #8
|
||||
B ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
B ctor. i = 3
|
||||
Throwing a b
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
B copy ctor. i = 6
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
B ctor. i = 7
|
||||
In catch #1
|
||||
B ctor. i = 8
|
||||
Rethrowing b
|
||||
A ctor. i = 9
|
||||
Rethrowing
|
||||
B copy ctor. i = 10
|
||||
B ctor. i = 11
|
||||
B ctor. i = 12
|
||||
A dtor. i = 9
|
||||
B dtor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 8
|
||||
B ctor. i = 13
|
||||
In catch #1 of catch#1
|
||||
Rethrowing b
|
||||
A ctor. i = 14
|
||||
Rethrowing
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 14
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B dtor. i = 13
|
||||
B dtor. i = 10
|
||||
B copy ctor. i = 17
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B dtor. i = 2
|
||||
B dtor. i = 1
|
||||
B ctor. i = 18
|
||||
In catch #2
|
||||
Throwing a new A
|
||||
A ctor. i = 19
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A copy ctor. i = 22
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
B dtor. i = 5
|
||||
B dtor. i = 0
|
||||
In main's catch
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A dtor. i = 22
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
B ctor. i = 25
|
||||
B ctor. i = 26
|
||||
A dtor. i = 19
|
||||
B dtor. i = 26
|
||||
B dtor. i = 25
|
||||
|
||||
|
||||
Test #9
|
||||
B ctor. i = 0
|
||||
Throwing B
|
||||
B copy ctor. i = 1
|
||||
B dtor. i = 0
|
||||
In catch #1
|
||||
Rethrow
|
||||
In catch #2
|
||||
B dtor. i = 1
|
||||
End of test9, throwing a A
|
||||
A ctor. i = 2
|
||||
B ctor. i = 3
|
||||
B ctor. i = 4
|
||||
A copy ctor. i = 5
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
In main's catch
|
||||
B ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A dtor. i = 5
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B ctor. i = 8
|
||||
B ctor. i = 9
|
||||
A dtor. i = 2
|
||||
B dtor. i = 9
|
||||
B dtor. i = 8
|
||||
|
||||
|
||||
Test #10
|
||||
B ctor. i = 0
|
||||
Throwing B
|
||||
B copy ctor. i = 1
|
||||
B dtor. i = 0
|
||||
In catch #1
|
||||
Throwing a new B()
|
||||
B ctor. i = 2
|
||||
In catch #2
|
||||
B dtor. i = 2
|
||||
B dtor. i = 1
|
||||
End of test10, throwing a A
|
||||
A ctor. i = 3
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
A copy ctor. i = 6
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
In main's catch
|
||||
B ctor. i = 7
|
||||
B ctor. i = 8
|
||||
A dtor. i = 6
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B ctor. i = 9
|
||||
B ctor. i = 10
|
||||
A dtor. i = 3
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
|
||||
|
||||
Passed
|
676
modules/rostests/apitests/compiler/ms/eh/ehthrow.arm
Normal file
676
modules/rostests/apitests/compiler/ms/eh/ehthrow.arm
Normal file
|
@ -0,0 +1,676 @@
|
|||
|
||||
Test #1
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
A ctor. i = 2
|
||||
B ctor. i = 3
|
||||
B ctor. i = 4
|
||||
A copy ctor. i = 5
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
Throwing
|
||||
B ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A copy ctor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B ctor. i = 9
|
||||
B ctor. i = 10
|
||||
A copy ctor. i = 11
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A dtor. i = 5
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B ctor. i = 14
|
||||
B ctor. i = 15
|
||||
A dtor. i = 2
|
||||
B dtor. i = 15
|
||||
B dtor. i = 14
|
||||
B dtor. i = 1
|
||||
B ctor. i = 16
|
||||
B ctor. i = 17
|
||||
A dtor. i = 0
|
||||
B dtor. i = 17
|
||||
B dtor. i = 16
|
||||
In main's catch
|
||||
B ctor. i = 18
|
||||
B ctor. i = 19
|
||||
A dtor. i = 11
|
||||
B dtor. i = 19
|
||||
B dtor. i = 18
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A dtor. i = 8
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
|
||||
|
||||
Test #2
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
A ctor. i = 2
|
||||
A ctor. i = 3
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
A copy ctor. i = 6
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
Throwing
|
||||
B ctor. i = 7
|
||||
B ctor. i = 8
|
||||
A copy ctor. i = 9
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B ctor. i = 10
|
||||
B ctor. i = 11
|
||||
A copy ctor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 10
|
||||
B ctor. i = 13
|
||||
B ctor. i = 14
|
||||
A dtor. i = 6
|
||||
B dtor. i = 14
|
||||
B dtor. i = 13
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 3
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 2
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
In catch;
|
||||
A ctor. i = 19
|
||||
Rethrowing
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A dtor. i = 19
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B ctor. i = 22
|
||||
B ctor. i = 23
|
||||
A dtor. i = 12
|
||||
B dtor. i = 23
|
||||
B dtor. i = 22
|
||||
B ctor. i = 24
|
||||
B ctor. i = 25
|
||||
A copy ctor. i = 26
|
||||
B dtor. i = 25
|
||||
B dtor. i = 24
|
||||
B dtor. i = 1
|
||||
B ctor. i = 27
|
||||
B ctor. i = 28
|
||||
A dtor. i = 0
|
||||
B dtor. i = 28
|
||||
B dtor. i = 27
|
||||
In main's catch
|
||||
B ctor. i = 29
|
||||
B ctor. i = 30
|
||||
A dtor. i = 26
|
||||
B dtor. i = 30
|
||||
B dtor. i = 29
|
||||
B ctor. i = 31
|
||||
B ctor. i = 32
|
||||
A dtor. i = 9
|
||||
B dtor. i = 32
|
||||
B dtor. i = 31
|
||||
|
||||
|
||||
Test #3
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
A ctor. i = 2
|
||||
A ctor. i = 3
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
A copy ctor. i = 6
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
Throwing
|
||||
B ctor. i = 7
|
||||
B ctor. i = 8
|
||||
A copy ctor. i = 9
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B ctor. i = 10
|
||||
B ctor. i = 11
|
||||
A copy ctor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 10
|
||||
B ctor. i = 13
|
||||
B ctor. i = 14
|
||||
A dtor. i = 6
|
||||
B dtor. i = 14
|
||||
B dtor. i = 13
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 3
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 2
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
In catch
|
||||
A ctor. i = 19
|
||||
Throwing new a
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A copy ctor. i = 22
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A copy ctor. i = 25
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
B ctor. i = 26
|
||||
B ctor. i = 27
|
||||
A dtor. i = 19
|
||||
B dtor. i = 27
|
||||
B dtor. i = 26
|
||||
B ctor. i = 28
|
||||
B ctor. i = 29
|
||||
A dtor. i = 12
|
||||
B dtor. i = 29
|
||||
B dtor. i = 28
|
||||
B ctor. i = 30
|
||||
B ctor. i = 31
|
||||
A dtor. i = 9
|
||||
B dtor. i = 31
|
||||
B dtor. i = 30
|
||||
B dtor. i = 1
|
||||
B ctor. i = 32
|
||||
B ctor. i = 33
|
||||
A dtor. i = 0
|
||||
B dtor. i = 33
|
||||
B dtor. i = 32
|
||||
In main's catch
|
||||
B ctor. i = 34
|
||||
B ctor. i = 35
|
||||
A dtor. i = 25
|
||||
B dtor. i = 35
|
||||
B dtor. i = 34
|
||||
B ctor. i = 36
|
||||
B ctor. i = 37
|
||||
A dtor. i = 22
|
||||
B dtor. i = 37
|
||||
B dtor. i = 36
|
||||
|
||||
|
||||
Test #4
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
A ctor. i = 3
|
||||
A ctor. i = 4
|
||||
A ctor. i = 5
|
||||
A ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A ctor. i = 8
|
||||
A ctor. i = 9
|
||||
B ctor. i = 10
|
||||
B ctor. i = 11
|
||||
A copy ctor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 10
|
||||
Throwing
|
||||
B ctor. i = 13
|
||||
B ctor. i = 14
|
||||
A copy ctor. i = 15
|
||||
B dtor. i = 14
|
||||
B dtor. i = 13
|
||||
B ctor. i = 16
|
||||
B ctor. i = 17
|
||||
A copy ctor. i = 18
|
||||
B dtor. i = 17
|
||||
B dtor. i = 16
|
||||
B ctor. i = 19
|
||||
B ctor. i = 20
|
||||
A dtor. i = 12
|
||||
B dtor. i = 20
|
||||
B dtor. i = 19
|
||||
B ctor. i = 21
|
||||
B ctor. i = 22
|
||||
A dtor. i = 9
|
||||
B dtor. i = 22
|
||||
B dtor. i = 21
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A dtor. i = 8
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
In catch;
|
||||
A ctor. i = 25
|
||||
Rethrowing
|
||||
B ctor. i = 26
|
||||
B ctor. i = 27
|
||||
A dtor. i = 25
|
||||
B dtor. i = 27
|
||||
B dtor. i = 26
|
||||
B ctor. i = 28
|
||||
B ctor. i = 29
|
||||
A dtor. i = 18
|
||||
B dtor. i = 29
|
||||
B dtor. i = 28
|
||||
B ctor. i = 30
|
||||
B ctor. i = 31
|
||||
A copy ctor. i = 32
|
||||
B dtor. i = 31
|
||||
B dtor. i = 30
|
||||
B dtor. i = 7
|
||||
B ctor. i = 33
|
||||
B ctor. i = 34
|
||||
A dtor. i = 6
|
||||
B dtor. i = 34
|
||||
B dtor. i = 33
|
||||
B ctor. i = 35
|
||||
B ctor. i = 36
|
||||
A dtor. i = 5
|
||||
B dtor. i = 36
|
||||
B dtor. i = 35
|
||||
In catch #1
|
||||
B ctor. i = 37
|
||||
Rethrowing
|
||||
B dtor. i = 37
|
||||
B ctor. i = 38
|
||||
B ctor. i = 39
|
||||
A dtor. i = 32
|
||||
B dtor. i = 39
|
||||
B dtor. i = 38
|
||||
B ctor. i = 40
|
||||
B ctor. i = 41
|
||||
A dtor. i = 4
|
||||
B dtor. i = 41
|
||||
B dtor. i = 40
|
||||
B ctor. i = 42
|
||||
B ctor. i = 43
|
||||
A dtor. i = 3
|
||||
B dtor. i = 43
|
||||
B dtor. i = 42
|
||||
In catch #2
|
||||
A ctor. i = 44
|
||||
Throwing new a
|
||||
B ctor. i = 45
|
||||
B ctor. i = 46
|
||||
A copy ctor. i = 47
|
||||
B dtor. i = 46
|
||||
B dtor. i = 45
|
||||
B ctor. i = 48
|
||||
B ctor. i = 49
|
||||
A copy ctor. i = 50
|
||||
B dtor. i = 49
|
||||
B dtor. i = 48
|
||||
B ctor. i = 51
|
||||
B ctor. i = 52
|
||||
A dtor. i = 44
|
||||
B dtor. i = 52
|
||||
B dtor. i = 51
|
||||
B ctor. i = 53
|
||||
B ctor. i = 54
|
||||
A dtor. i = 15
|
||||
B dtor. i = 54
|
||||
B dtor. i = 53
|
||||
B dtor. i = 2
|
||||
In catch #3
|
||||
B ctor. i = 55
|
||||
Rethrowing
|
||||
B dtor. i = 55
|
||||
B ctor. i = 56
|
||||
B ctor. i = 57
|
||||
A dtor. i = 50
|
||||
B dtor. i = 57
|
||||
B dtor. i = 56
|
||||
B ctor. i = 58
|
||||
B ctor. i = 59
|
||||
A copy ctor. i = 60
|
||||
B dtor. i = 59
|
||||
B dtor. i = 58
|
||||
B dtor. i = 1
|
||||
B ctor. i = 61
|
||||
B ctor. i = 62
|
||||
A dtor. i = 0
|
||||
B dtor. i = 62
|
||||
B dtor. i = 61
|
||||
In main's catch
|
||||
B ctor. i = 63
|
||||
B ctor. i = 64
|
||||
A dtor. i = 60
|
||||
B dtor. i = 64
|
||||
B dtor. i = 63
|
||||
B ctor. i = 65
|
||||
B ctor. i = 66
|
||||
A dtor. i = 47
|
||||
B dtor. i = 66
|
||||
B dtor. i = 65
|
||||
|
||||
|
||||
Test #5
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
B ctor. i = 3
|
||||
B ctor. i = 4
|
||||
A ctor. i = 5
|
||||
B ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A copy ctor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
Throwing
|
||||
B ctor. i = 9
|
||||
B ctor. i = 10
|
||||
A copy ctor. i = 11
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A copy ctor. i = 14
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 8
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 5
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
B dtor. i = 2
|
||||
A ctor. i = 19
|
||||
In catch #2
|
||||
B ctor. i = 20
|
||||
Throwing a new b
|
||||
B copy ctor. i = 21
|
||||
B copy ctor. i = 22
|
||||
B dtor. i = 20
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A dtor. i = 19
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
B ctor. i = 25
|
||||
B ctor. i = 26
|
||||
A dtor. i = 14
|
||||
B dtor. i = 26
|
||||
B dtor. i = 25
|
||||
B ctor. i = 27
|
||||
B ctor. i = 28
|
||||
A dtor. i = 11
|
||||
B dtor. i = 28
|
||||
B dtor. i = 27
|
||||
B dtor. i = 1
|
||||
In catch #3
|
||||
Throwing a new a
|
||||
A ctor. i = 29
|
||||
B ctor. i = 30
|
||||
B ctor. i = 31
|
||||
A copy ctor. i = 32
|
||||
B dtor. i = 31
|
||||
B dtor. i = 30
|
||||
B dtor. i = 22
|
||||
B dtor. i = 21
|
||||
B ctor. i = 33
|
||||
B ctor. i = 34
|
||||
A dtor. i = 0
|
||||
B dtor. i = 34
|
||||
B dtor. i = 33
|
||||
In main's catch
|
||||
B ctor. i = 35
|
||||
B ctor. i = 36
|
||||
A dtor. i = 32
|
||||
B dtor. i = 36
|
||||
B dtor. i = 35
|
||||
B ctor. i = 37
|
||||
B ctor. i = 38
|
||||
A dtor. i = 29
|
||||
B dtor. i = 38
|
||||
B dtor. i = 37
|
||||
|
||||
|
||||
Test #6
|
||||
B ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
Throwing a b
|
||||
B copy ctor. i = 3
|
||||
B copy ctor. i = 4
|
||||
B dtor. i = 2
|
||||
B ctor. i = 5
|
||||
In catch #1
|
||||
Throwing a new b
|
||||
B copy ctor. i = 6
|
||||
B copy ctor. i = 7
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
B dtor. i = 1
|
||||
B ctor. i = 8
|
||||
In catch #2
|
||||
Throwing a new b
|
||||
B copy ctor. i = 9
|
||||
B copy ctor. i = 10
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B dtor. i = 0
|
||||
A ctor. i = 11
|
||||
In catch #3
|
||||
Throwing a new a
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A copy ctor. i = 14
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A copy ctor. i = 17
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 18
|
||||
B ctor. i = 19
|
||||
A dtor. i = 11
|
||||
B dtor. i = 19
|
||||
B dtor. i = 18
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
In main's catch
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A dtor. i = 17
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B ctor. i = 22
|
||||
B ctor. i = 23
|
||||
A dtor. i = 14
|
||||
B dtor. i = 23
|
||||
B dtor. i = 22
|
||||
|
||||
|
||||
Test #7
|
||||
B ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
Throwing a b
|
||||
B ctor. i = 3
|
||||
B copy ctor. i = 4
|
||||
B dtor. i = 2
|
||||
B ctor. i = 5
|
||||
In catch #1
|
||||
B ctor. i = 6
|
||||
Rethrowing b
|
||||
B copy ctor. i = 7
|
||||
B dtor. i = 6
|
||||
B ctor. i = 8
|
||||
In catch #1 of catch#1
|
||||
Rethrowing b
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
B copy ctor. i = 9
|
||||
B dtor. i = 1
|
||||
B ctor. i = 10
|
||||
In catch #2
|
||||
Throwing a new A
|
||||
A ctor. i = 11
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A copy ctor. i = 14
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
B dtor. i = 3
|
||||
B dtor. i = 0
|
||||
In main's catch
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 14
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 11
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
|
||||
|
||||
Test #8
|
||||
B ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
B ctor. i = 3
|
||||
Throwing a b
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
B copy ctor. i = 6
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
B ctor. i = 7
|
||||
In catch #1
|
||||
B ctor. i = 8
|
||||
Rethrowing b
|
||||
A ctor. i = 9
|
||||
Rethrowing
|
||||
B copy ctor. i = 10
|
||||
B ctor. i = 11
|
||||
B ctor. i = 12
|
||||
A dtor. i = 9
|
||||
B dtor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 8
|
||||
B ctor. i = 13
|
||||
In catch #1 of catch#1
|
||||
Rethrowing b
|
||||
A ctor. i = 14
|
||||
Rethrowing
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 14
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B dtor. i = 13
|
||||
B dtor. i = 10
|
||||
B copy ctor. i = 17
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B dtor. i = 2
|
||||
B dtor. i = 1
|
||||
B ctor. i = 18
|
||||
In catch #2
|
||||
Throwing a new A
|
||||
A ctor. i = 19
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A copy ctor. i = 22
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
B dtor. i = 5
|
||||
B dtor. i = 0
|
||||
In main's catch
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A dtor. i = 22
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
B ctor. i = 25
|
||||
B ctor. i = 26
|
||||
A dtor. i = 19
|
||||
B dtor. i = 26
|
||||
B dtor. i = 25
|
||||
|
||||
|
||||
Test #9
|
||||
B ctor. i = 0
|
||||
Throwing B
|
||||
B copy ctor. i = 1
|
||||
B dtor. i = 0
|
||||
In catch #1
|
||||
Rethrow
|
||||
In catch #2
|
||||
B dtor. i = 1
|
||||
End of test9, throwing a A
|
||||
A ctor. i = 2
|
||||
B ctor. i = 3
|
||||
B ctor. i = 4
|
||||
A copy ctor. i = 5
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
In main's catch
|
||||
B ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A dtor. i = 5
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B ctor. i = 8
|
||||
B ctor. i = 9
|
||||
A dtor. i = 2
|
||||
B dtor. i = 9
|
||||
B dtor. i = 8
|
||||
|
||||
|
||||
Test #10
|
||||
B ctor. i = 0
|
||||
Throwing B
|
||||
B copy ctor. i = 1
|
||||
B dtor. i = 0
|
||||
In catch #1
|
||||
Throwing a new B()
|
||||
B ctor. i = 2
|
||||
In catch #2
|
||||
B dtor. i = 2
|
||||
B dtor. i = 1
|
||||
End of test10, throwing a A
|
||||
A ctor. i = 3
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
A copy ctor. i = 6
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
In main's catch
|
||||
B ctor. i = 7
|
||||
B ctor. i = 8
|
||||
A dtor. i = 6
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B ctor. i = 9
|
||||
B ctor. i = 10
|
||||
A dtor. i = 3
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
|
||||
|
||||
Passed
|
547
modules/rostests/apitests/compiler/ms/eh/ehthrow.cxx
Normal file
547
modules/rostests/apitests/compiler/ms/eh/ehthrow.cxx
Normal file
|
@ -0,0 +1,547 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
/*
|
||||
Tests some throw and rethrow situations (mostly CRT a test)
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#define NO_CTOR_THROW 1
|
||||
#define NO_DTOR_THROW 2
|
||||
|
||||
|
||||
int Object[100];
|
||||
int CurrentObjectNumber, Test;
|
||||
int MaxTest = 10;
|
||||
int MaxObjectCount = 1;
|
||||
int Fail;
|
||||
|
||||
|
||||
void FAIL(int i)
|
||||
{
|
||||
printf("FAILED on %d\n", i);
|
||||
Fail++;
|
||||
}
|
||||
|
||||
void dealloc(int i, int no_throw)
|
||||
{
|
||||
/* Make sure i is valid, and object exists */
|
||||
if(i<0 || i>=MaxObjectCount || !Object[i])
|
||||
FAIL(i);
|
||||
|
||||
Object[i] = 0;
|
||||
}
|
||||
|
||||
void alloc(int i, int no_throw)
|
||||
{
|
||||
if(CurrentObjectNumber > MaxObjectCount)
|
||||
MaxObjectCount = CurrentObjectNumber;
|
||||
|
||||
/* Object already exists? */
|
||||
if(Object[i]) FAIL(i);
|
||||
|
||||
Object[i] = 1;
|
||||
}
|
||||
|
||||
class B
|
||||
{
|
||||
public:
|
||||
int i;
|
||||
int flag;
|
||||
B();
|
||||
B(int);
|
||||
B(const B &b);
|
||||
~B();
|
||||
};
|
||||
|
||||
B::B()
|
||||
{
|
||||
i = CurrentObjectNumber++;
|
||||
printf("B ctor. i = %d\n", i);
|
||||
alloc(i, FALSE);
|
||||
}
|
||||
|
||||
B::B(int f)
|
||||
{
|
||||
i = CurrentObjectNumber++;
|
||||
flag = f;
|
||||
printf("B ctor. i = %d\n", i);
|
||||
alloc(i, flag==NO_CTOR_THROW);
|
||||
}
|
||||
|
||||
B::B(const B &b)
|
||||
{
|
||||
i = CurrentObjectNumber++;
|
||||
printf("B copy ctor. i = %d\n", i);
|
||||
alloc(i, FALSE);
|
||||
}
|
||||
|
||||
B::~B()
|
||||
{
|
||||
printf("B dtor. i = %d\n", i);
|
||||
dealloc(i, flag==NO_DTOR_THROW);
|
||||
}
|
||||
|
||||
class A
|
||||
{
|
||||
public:
|
||||
int i;
|
||||
A();
|
||||
A(int)
|
||||
{
|
||||
i = CurrentObjectNumber++;
|
||||
printf("A(int) ctor. i = %d\n", i);
|
||||
alloc(i, FALSE);
|
||||
}
|
||||
A operator+(A a);
|
||||
A(const A &a)
|
||||
{
|
||||
/* Try objects in ctor */
|
||||
B b1 = NO_DTOR_THROW, b2 = NO_DTOR_THROW;
|
||||
|
||||
i = CurrentObjectNumber++;
|
||||
printf("A copy ctor. i = %d\n", i);
|
||||
alloc(i, FALSE);
|
||||
}
|
||||
|
||||
~A(){
|
||||
/* Try objects in dtor */
|
||||
B b1 = NO_CTOR_THROW, b2 = NO_CTOR_THROW;
|
||||
|
||||
printf("A dtor. i = %d\n", i);
|
||||
dealloc(i, FALSE);
|
||||
};
|
||||
};
|
||||
|
||||
A::A()
|
||||
{
|
||||
i=CurrentObjectNumber++;
|
||||
printf("A ctor. i = %d\n", i);
|
||||
alloc(i, FALSE);
|
||||
}
|
||||
|
||||
A A::operator+(A a)
|
||||
{
|
||||
printf("A%d + A%d\n", i, a.i);
|
||||
return A();
|
||||
}
|
||||
|
||||
void Throwa(A a)
|
||||
{
|
||||
printf("Throwing\n");
|
||||
throw a;
|
||||
}
|
||||
|
||||
void bar()
|
||||
{
|
||||
A a;
|
||||
|
||||
Throwa(a);
|
||||
}
|
||||
|
||||
void foobar()
|
||||
{
|
||||
B b;
|
||||
bar();
|
||||
}
|
||||
|
||||
// Somehow, inlining this causes different unwinding order..
|
||||
|
||||
__declspec(noinline) void Rethrow2()
|
||||
{
|
||||
A a;
|
||||
printf("Rethrowing\n");
|
||||
throw;
|
||||
}
|
||||
|
||||
#pragma inline_depth(0)
|
||||
void Rethrow()
|
||||
{
|
||||
Rethrow2();
|
||||
}
|
||||
#pragma inline_depth()
|
||||
|
||||
void foobar2()
|
||||
{
|
||||
B b;
|
||||
|
||||
try{
|
||||
A a;
|
||||
bar();
|
||||
}catch(A a){
|
||||
printf("In catch;\n");
|
||||
Rethrow();
|
||||
}
|
||||
}
|
||||
|
||||
void foobar3()
|
||||
{
|
||||
B b;
|
||||
|
||||
try{
|
||||
A a;
|
||||
bar();
|
||||
}catch(A a){
|
||||
printf("In catch\n");
|
||||
A a2;
|
||||
|
||||
printf("Throwing new a\n");
|
||||
throw a2;
|
||||
}
|
||||
}
|
||||
|
||||
void foobar4()
|
||||
{
|
||||
B b;
|
||||
|
||||
try{
|
||||
B b;
|
||||
try{
|
||||
A a1, a2;
|
||||
try {
|
||||
A a1, a2;
|
||||
foobar2();
|
||||
}catch(A a){
|
||||
printf("In catch #1\n");
|
||||
B b;
|
||||
printf("Rethrowing\n");
|
||||
throw;
|
||||
}
|
||||
}catch(A &a){
|
||||
printf("In catch #2\n");
|
||||
A a2;
|
||||
|
||||
printf("Throwing new a\n");
|
||||
throw a;
|
||||
}
|
||||
}catch(A a){
|
||||
printf("In catch #3\n");
|
||||
B b;
|
||||
printf("Rethrowing\n");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(noinline) void throw_B_2()
|
||||
{
|
||||
B b;
|
||||
printf("Throwing a new b\n");
|
||||
throw b;
|
||||
}
|
||||
|
||||
#pragma inline_depth(0)
|
||||
void throw_B()
|
||||
{
|
||||
throw_B_2();
|
||||
}
|
||||
#pragma inline_depth()
|
||||
|
||||
|
||||
void foobar5()
|
||||
{
|
||||
try {
|
||||
B b1;
|
||||
try {
|
||||
B b2;
|
||||
try {
|
||||
B b3;
|
||||
foobar();
|
||||
}catch(B b){
|
||||
printf("In catch #1\n");
|
||||
FAIL(-1);
|
||||
}
|
||||
FAIL(-1);
|
||||
}catch(A a){
|
||||
A a2;
|
||||
printf("In catch #2\n");
|
||||
throw_B();
|
||||
}
|
||||
FAIL(-1);
|
||||
}catch(B b){
|
||||
printf("In catch #3\n");
|
||||
printf("Throwing a new a\n");
|
||||
throw A();
|
||||
}
|
||||
FAIL(-1);
|
||||
}
|
||||
|
||||
|
||||
/* Simple throw with unwinds */
|
||||
void test1()
|
||||
{
|
||||
A a;
|
||||
foobar();
|
||||
}
|
||||
|
||||
/* Throw followed by a rethrow */
|
||||
void test2()
|
||||
{
|
||||
A a;
|
||||
foobar2();
|
||||
}
|
||||
|
||||
/* Throw followed by a new throw */
|
||||
void test3()
|
||||
{
|
||||
A a;
|
||||
foobar3();
|
||||
}
|
||||
|
||||
/* Nested trys with rethrow/throw/rethrow */
|
||||
void test4()
|
||||
{
|
||||
A a;
|
||||
foobar4();
|
||||
}
|
||||
|
||||
/* Makes sure a new throw skips appropriate unwound frames. */
|
||||
void test5()
|
||||
{
|
||||
A a;
|
||||
foobar5();
|
||||
}
|
||||
|
||||
// Tests 3 level of new throw
|
||||
void test6()
|
||||
{
|
||||
try{
|
||||
B b1;
|
||||
try{
|
||||
B b2;
|
||||
try{
|
||||
B b3;
|
||||
printf("Throwing a b\n");
|
||||
throw(b3);
|
||||
}catch(B b){
|
||||
B b4;
|
||||
printf("In catch #1\n");
|
||||
printf("Throwing a new b\n");
|
||||
throw(b4);
|
||||
}
|
||||
FAIL(-1);
|
||||
}catch(B b){
|
||||
B b5;
|
||||
printf("In catch #2\n");
|
||||
printf("Throwing a new b\n");
|
||||
throw(b5);
|
||||
}
|
||||
FAIL(-1);
|
||||
}catch(B b){
|
||||
A a1;
|
||||
printf("In catch #3\n");
|
||||
printf("Throwing a new a\n");
|
||||
throw(a1);
|
||||
}
|
||||
FAIL(-1);
|
||||
}
|
||||
|
||||
// Testing try/catch inside a catch
|
||||
void test7()
|
||||
{
|
||||
B b1;
|
||||
try{
|
||||
B b2;
|
||||
try{
|
||||
B b3;
|
||||
|
||||
printf("Throwing a b\n");
|
||||
throw(B());
|
||||
}catch(B b){
|
||||
B b4;
|
||||
printf("In catch #1\n");
|
||||
try{
|
||||
B b5;
|
||||
printf("Rethrowing b\n");
|
||||
throw;
|
||||
}catch(B b){
|
||||
B b5;
|
||||
printf("In catch #1 of catch#1\n");
|
||||
printf("Rethrowing b\n");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}catch(B b){
|
||||
B b6;
|
||||
printf("In catch #2\n");
|
||||
printf("Throwing a new A\n");
|
||||
throw(A());
|
||||
}
|
||||
}
|
||||
|
||||
void ThrowB()
|
||||
{
|
||||
B b;
|
||||
|
||||
throw(B());
|
||||
}
|
||||
|
||||
void bar8()
|
||||
{
|
||||
try{
|
||||
B b5;
|
||||
printf("Rethrowing b\n");
|
||||
Rethrow();
|
||||
}catch(B b){
|
||||
B b5;
|
||||
printf("In catch #1 of catch#1\n");
|
||||
printf("Rethrowing b\n");
|
||||
Rethrow();
|
||||
}
|
||||
}
|
||||
|
||||
void foo8()
|
||||
{
|
||||
B b;
|
||||
try{
|
||||
B b3;
|
||||
|
||||
printf("Throwing a b\n");
|
||||
ThrowB();
|
||||
}catch(B b){
|
||||
B b4;
|
||||
printf("In catch #1\n");
|
||||
bar8();
|
||||
}
|
||||
}
|
||||
|
||||
// Testing call to try/catch function inside a catch
|
||||
void test8()
|
||||
{
|
||||
B b1;
|
||||
try{
|
||||
B b2;
|
||||
foo8();
|
||||
}catch(B b){
|
||||
B b6;
|
||||
printf("In catch #2\n");
|
||||
printf("Throwing a new A\n");
|
||||
throw(A());
|
||||
}
|
||||
}
|
||||
|
||||
void foo9()
|
||||
{
|
||||
try {
|
||||
puts("Rethrow");
|
||||
throw;
|
||||
}catch(...){
|
||||
puts("In catch #2");
|
||||
}
|
||||
}
|
||||
|
||||
void test9()
|
||||
{
|
||||
try{
|
||||
B b;
|
||||
puts("Throwing B");
|
||||
throw b;
|
||||
}catch(...){
|
||||
puts("In catch #1");
|
||||
foo9();
|
||||
}
|
||||
puts("End of test9, throwing a A");
|
||||
throw A();
|
||||
}
|
||||
|
||||
void foo10()
|
||||
{
|
||||
try {
|
||||
puts("Throwing a new B()");
|
||||
throw B();
|
||||
}catch(...){
|
||||
puts("In catch #2");
|
||||
}
|
||||
}
|
||||
|
||||
void test10()
|
||||
{
|
||||
try{
|
||||
B b;
|
||||
puts("Throwing B");
|
||||
throw b;
|
||||
}catch(...){
|
||||
puts("In catch #1");
|
||||
foo10();
|
||||
}
|
||||
puts("End of test10, throwing a A");
|
||||
throw A();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Call test(), with a different ctor/dtor throwing each time */
|
||||
for(Test = 1; Test <= MaxTest; Test++) {
|
||||
|
||||
CurrentObjectNumber = 0;
|
||||
|
||||
printf("\nTest #%d\n", Test);
|
||||
|
||||
try {
|
||||
switch(Test){
|
||||
case 1:
|
||||
test1();
|
||||
break;
|
||||
case 2:
|
||||
test2();
|
||||
break;
|
||||
case 3:
|
||||
test3();
|
||||
break;
|
||||
case 4:
|
||||
test4();
|
||||
break;
|
||||
case 5:
|
||||
test5();
|
||||
break;
|
||||
case 6:
|
||||
test6();
|
||||
break;
|
||||
case 7:
|
||||
test7();
|
||||
break;
|
||||
case 8:
|
||||
test8();
|
||||
break;
|
||||
case 9:
|
||||
test9();
|
||||
break;
|
||||
case 10:
|
||||
test10();
|
||||
break;
|
||||
}
|
||||
|
||||
FAIL(-1);
|
||||
|
||||
}catch(A a){
|
||||
printf("In main's catch\n");
|
||||
}catch(...){
|
||||
FAIL(-1);
|
||||
}
|
||||
|
||||
/* Any objects which didn't get dtor'd? */
|
||||
for(i = 0; i < MaxObjectCount; i++) {
|
||||
if(Object[i]) {
|
||||
FAIL(i);
|
||||
Object[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
if(Fail)
|
||||
printf("FAILED %d tests\n", Fail);
|
||||
else
|
||||
printf("Passed\n");
|
||||
|
||||
}
|
676
modules/rostests/apitests/compiler/ms/eh/ehthrow.out
Normal file
676
modules/rostests/apitests/compiler/ms/eh/ehthrow.out
Normal file
|
@ -0,0 +1,676 @@
|
|||
|
||||
Test #1
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
A ctor. i = 2
|
||||
B ctor. i = 3
|
||||
B ctor. i = 4
|
||||
A copy ctor. i = 5
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
Throwing
|
||||
B ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A copy ctor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B ctor. i = 9
|
||||
B ctor. i = 10
|
||||
A copy ctor. i = 11
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A dtor. i = 5
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B ctor. i = 14
|
||||
B ctor. i = 15
|
||||
A dtor. i = 2
|
||||
B dtor. i = 15
|
||||
B dtor. i = 14
|
||||
B dtor. i = 1
|
||||
B ctor. i = 16
|
||||
B ctor. i = 17
|
||||
A dtor. i = 0
|
||||
B dtor. i = 17
|
||||
B dtor. i = 16
|
||||
In main's catch
|
||||
B ctor. i = 18
|
||||
B ctor. i = 19
|
||||
A dtor. i = 11
|
||||
B dtor. i = 19
|
||||
B dtor. i = 18
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A dtor. i = 8
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
|
||||
|
||||
Test #2
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
A ctor. i = 2
|
||||
A ctor. i = 3
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
A copy ctor. i = 6
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
Throwing
|
||||
B ctor. i = 7
|
||||
B ctor. i = 8
|
||||
A copy ctor. i = 9
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B ctor. i = 10
|
||||
B ctor. i = 11
|
||||
A copy ctor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 10
|
||||
B ctor. i = 13
|
||||
B ctor. i = 14
|
||||
A dtor. i = 6
|
||||
B dtor. i = 14
|
||||
B dtor. i = 13
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 3
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 2
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
In catch;
|
||||
A ctor. i = 19
|
||||
Rethrowing
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A dtor. i = 19
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B ctor. i = 22
|
||||
B ctor. i = 23
|
||||
A dtor. i = 12
|
||||
B dtor. i = 23
|
||||
B dtor. i = 22
|
||||
B ctor. i = 24
|
||||
B ctor. i = 25
|
||||
A copy ctor. i = 26
|
||||
B dtor. i = 25
|
||||
B dtor. i = 24
|
||||
B dtor. i = 1
|
||||
B ctor. i = 27
|
||||
B ctor. i = 28
|
||||
A dtor. i = 0
|
||||
B dtor. i = 28
|
||||
B dtor. i = 27
|
||||
In main's catch
|
||||
B ctor. i = 29
|
||||
B ctor. i = 30
|
||||
A dtor. i = 26
|
||||
B dtor. i = 30
|
||||
B dtor. i = 29
|
||||
B ctor. i = 31
|
||||
B ctor. i = 32
|
||||
A dtor. i = 9
|
||||
B dtor. i = 32
|
||||
B dtor. i = 31
|
||||
|
||||
|
||||
Test #3
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
A ctor. i = 2
|
||||
A ctor. i = 3
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
A copy ctor. i = 6
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
Throwing
|
||||
B ctor. i = 7
|
||||
B ctor. i = 8
|
||||
A copy ctor. i = 9
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B ctor. i = 10
|
||||
B ctor. i = 11
|
||||
A copy ctor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 10
|
||||
B ctor. i = 13
|
||||
B ctor. i = 14
|
||||
A dtor. i = 6
|
||||
B dtor. i = 14
|
||||
B dtor. i = 13
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 3
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 2
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
In catch
|
||||
A ctor. i = 19
|
||||
Throwing new a
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A copy ctor. i = 22
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A copy ctor. i = 25
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
B ctor. i = 26
|
||||
B ctor. i = 27
|
||||
A dtor. i = 9
|
||||
B dtor. i = 27
|
||||
B dtor. i = 26
|
||||
B ctor. i = 28
|
||||
B ctor. i = 29
|
||||
A dtor. i = 19
|
||||
B dtor. i = 29
|
||||
B dtor. i = 28
|
||||
B ctor. i = 30
|
||||
B ctor. i = 31
|
||||
A dtor. i = 12
|
||||
B dtor. i = 31
|
||||
B dtor. i = 30
|
||||
B dtor. i = 1
|
||||
B ctor. i = 32
|
||||
B ctor. i = 33
|
||||
A dtor. i = 0
|
||||
B dtor. i = 33
|
||||
B dtor. i = 32
|
||||
In main's catch
|
||||
B ctor. i = 34
|
||||
B ctor. i = 35
|
||||
A dtor. i = 25
|
||||
B dtor. i = 35
|
||||
B dtor. i = 34
|
||||
B ctor. i = 36
|
||||
B ctor. i = 37
|
||||
A dtor. i = 22
|
||||
B dtor. i = 37
|
||||
B dtor. i = 36
|
||||
|
||||
|
||||
Test #4
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
A ctor. i = 3
|
||||
A ctor. i = 4
|
||||
A ctor. i = 5
|
||||
A ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A ctor. i = 8
|
||||
A ctor. i = 9
|
||||
B ctor. i = 10
|
||||
B ctor. i = 11
|
||||
A copy ctor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 10
|
||||
Throwing
|
||||
B ctor. i = 13
|
||||
B ctor. i = 14
|
||||
A copy ctor. i = 15
|
||||
B dtor. i = 14
|
||||
B dtor. i = 13
|
||||
B ctor. i = 16
|
||||
B ctor. i = 17
|
||||
A copy ctor. i = 18
|
||||
B dtor. i = 17
|
||||
B dtor. i = 16
|
||||
B ctor. i = 19
|
||||
B ctor. i = 20
|
||||
A dtor. i = 12
|
||||
B dtor. i = 20
|
||||
B dtor. i = 19
|
||||
B ctor. i = 21
|
||||
B ctor. i = 22
|
||||
A dtor. i = 9
|
||||
B dtor. i = 22
|
||||
B dtor. i = 21
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A dtor. i = 8
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
In catch;
|
||||
A ctor. i = 25
|
||||
Rethrowing
|
||||
B ctor. i = 26
|
||||
B ctor. i = 27
|
||||
A dtor. i = 25
|
||||
B dtor. i = 27
|
||||
B dtor. i = 26
|
||||
B ctor. i = 28
|
||||
B ctor. i = 29
|
||||
A dtor. i = 18
|
||||
B dtor. i = 29
|
||||
B dtor. i = 28
|
||||
B ctor. i = 30
|
||||
B ctor. i = 31
|
||||
A copy ctor. i = 32
|
||||
B dtor. i = 31
|
||||
B dtor. i = 30
|
||||
B dtor. i = 7
|
||||
B ctor. i = 33
|
||||
B ctor. i = 34
|
||||
A dtor. i = 6
|
||||
B dtor. i = 34
|
||||
B dtor. i = 33
|
||||
B ctor. i = 35
|
||||
B ctor. i = 36
|
||||
A dtor. i = 5
|
||||
B dtor. i = 36
|
||||
B dtor. i = 35
|
||||
In catch #1
|
||||
B ctor. i = 37
|
||||
Rethrowing
|
||||
B dtor. i = 37
|
||||
B ctor. i = 38
|
||||
B ctor. i = 39
|
||||
A dtor. i = 32
|
||||
B dtor. i = 39
|
||||
B dtor. i = 38
|
||||
B ctor. i = 40
|
||||
B ctor. i = 41
|
||||
A dtor. i = 4
|
||||
B dtor. i = 41
|
||||
B dtor. i = 40
|
||||
B ctor. i = 42
|
||||
B ctor. i = 43
|
||||
A dtor. i = 3
|
||||
B dtor. i = 43
|
||||
B dtor. i = 42
|
||||
In catch #2
|
||||
A ctor. i = 44
|
||||
Throwing new a
|
||||
B ctor. i = 45
|
||||
B ctor. i = 46
|
||||
A copy ctor. i = 47
|
||||
B dtor. i = 46
|
||||
B dtor. i = 45
|
||||
B ctor. i = 48
|
||||
B ctor. i = 49
|
||||
A copy ctor. i = 50
|
||||
B dtor. i = 49
|
||||
B dtor. i = 48
|
||||
B ctor. i = 51
|
||||
B ctor. i = 52
|
||||
A dtor. i = 15
|
||||
B dtor. i = 52
|
||||
B dtor. i = 51
|
||||
B ctor. i = 53
|
||||
B ctor. i = 54
|
||||
A dtor. i = 44
|
||||
B dtor. i = 54
|
||||
B dtor. i = 53
|
||||
B dtor. i = 2
|
||||
In catch #3
|
||||
B ctor. i = 55
|
||||
Rethrowing
|
||||
B dtor. i = 55
|
||||
B ctor. i = 56
|
||||
B ctor. i = 57
|
||||
A dtor. i = 50
|
||||
B dtor. i = 57
|
||||
B dtor. i = 56
|
||||
B ctor. i = 58
|
||||
B ctor. i = 59
|
||||
A copy ctor. i = 60
|
||||
B dtor. i = 59
|
||||
B dtor. i = 58
|
||||
B dtor. i = 1
|
||||
B ctor. i = 61
|
||||
B ctor. i = 62
|
||||
A dtor. i = 0
|
||||
B dtor. i = 62
|
||||
B dtor. i = 61
|
||||
In main's catch
|
||||
B ctor. i = 63
|
||||
B ctor. i = 64
|
||||
A dtor. i = 60
|
||||
B dtor. i = 64
|
||||
B dtor. i = 63
|
||||
B ctor. i = 65
|
||||
B ctor. i = 66
|
||||
A dtor. i = 47
|
||||
B dtor. i = 66
|
||||
B dtor. i = 65
|
||||
|
||||
|
||||
Test #5
|
||||
A ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
B ctor. i = 3
|
||||
B ctor. i = 4
|
||||
A ctor. i = 5
|
||||
B ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A copy ctor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
Throwing
|
||||
B ctor. i = 9
|
||||
B ctor. i = 10
|
||||
A copy ctor. i = 11
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A copy ctor. i = 14
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 8
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 5
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
B dtor. i = 2
|
||||
A ctor. i = 19
|
||||
In catch #2
|
||||
B ctor. i = 20
|
||||
Throwing a new b
|
||||
B copy ctor. i = 21
|
||||
B copy ctor. i = 22
|
||||
B dtor. i = 20
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A dtor. i = 11
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
B ctor. i = 25
|
||||
B ctor. i = 26
|
||||
A dtor. i = 19
|
||||
B dtor. i = 26
|
||||
B dtor. i = 25
|
||||
B ctor. i = 27
|
||||
B ctor. i = 28
|
||||
A dtor. i = 14
|
||||
B dtor. i = 28
|
||||
B dtor. i = 27
|
||||
B dtor. i = 1
|
||||
In catch #3
|
||||
Throwing a new a
|
||||
A ctor. i = 29
|
||||
B ctor. i = 30
|
||||
B ctor. i = 31
|
||||
A copy ctor. i = 32
|
||||
B dtor. i = 31
|
||||
B dtor. i = 30
|
||||
B dtor. i = 21
|
||||
B dtor. i = 22
|
||||
B ctor. i = 33
|
||||
B ctor. i = 34
|
||||
A dtor. i = 0
|
||||
B dtor. i = 34
|
||||
B dtor. i = 33
|
||||
In main's catch
|
||||
B ctor. i = 35
|
||||
B ctor. i = 36
|
||||
A dtor. i = 32
|
||||
B dtor. i = 36
|
||||
B dtor. i = 35
|
||||
B ctor. i = 37
|
||||
B ctor. i = 38
|
||||
A dtor. i = 29
|
||||
B dtor. i = 38
|
||||
B dtor. i = 37
|
||||
|
||||
|
||||
Test #6
|
||||
B ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
Throwing a b
|
||||
B copy ctor. i = 3
|
||||
B copy ctor. i = 4
|
||||
B dtor. i = 2
|
||||
B ctor. i = 5
|
||||
In catch #1
|
||||
Throwing a new b
|
||||
B copy ctor. i = 6
|
||||
B copy ctor. i = 7
|
||||
B dtor. i = 3
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
B dtor. i = 1
|
||||
B ctor. i = 8
|
||||
In catch #2
|
||||
Throwing a new b
|
||||
B copy ctor. i = 9
|
||||
B copy ctor. i = 10
|
||||
B dtor. i = 6
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 0
|
||||
A ctor. i = 11
|
||||
In catch #3
|
||||
Throwing a new a
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A copy ctor. i = 14
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A copy ctor. i = 17
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B dtor. i = 9
|
||||
B ctor. i = 18
|
||||
B ctor. i = 19
|
||||
A dtor. i = 11
|
||||
B dtor. i = 19
|
||||
B dtor. i = 18
|
||||
B dtor. i = 10
|
||||
In main's catch
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A dtor. i = 17
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B ctor. i = 22
|
||||
B ctor. i = 23
|
||||
A dtor. i = 14
|
||||
B dtor. i = 23
|
||||
B dtor. i = 22
|
||||
|
||||
|
||||
Test #7
|
||||
B ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
Throwing a b
|
||||
B ctor. i = 3
|
||||
B copy ctor. i = 4
|
||||
B dtor. i = 2
|
||||
B ctor. i = 5
|
||||
In catch #1
|
||||
B ctor. i = 6
|
||||
Rethrowing b
|
||||
B copy ctor. i = 7
|
||||
B dtor. i = 6
|
||||
B ctor. i = 8
|
||||
In catch #1 of catch#1
|
||||
Rethrowing b
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
B copy ctor. i = 9
|
||||
B dtor. i = 1
|
||||
B ctor. i = 10
|
||||
In catch #2
|
||||
Throwing a new A
|
||||
A ctor. i = 11
|
||||
B ctor. i = 12
|
||||
B ctor. i = 13
|
||||
A copy ctor. i = 14
|
||||
B dtor. i = 13
|
||||
B dtor. i = 12
|
||||
B dtor. i = 3
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
B dtor. i = 0
|
||||
In main's catch
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 14
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B ctor. i = 17
|
||||
B ctor. i = 18
|
||||
A dtor. i = 11
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
|
||||
|
||||
Test #8
|
||||
B ctor. i = 0
|
||||
B ctor. i = 1
|
||||
B ctor. i = 2
|
||||
B ctor. i = 3
|
||||
Throwing a b
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
B copy ctor. i = 6
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
B ctor. i = 7
|
||||
In catch #1
|
||||
B ctor. i = 8
|
||||
Rethrowing b
|
||||
A ctor. i = 9
|
||||
Rethrowing
|
||||
B copy ctor. i = 10
|
||||
B ctor. i = 11
|
||||
B ctor. i = 12
|
||||
A dtor. i = 9
|
||||
B dtor. i = 12
|
||||
B dtor. i = 11
|
||||
B dtor. i = 8
|
||||
B ctor. i = 13
|
||||
In catch #1 of catch#1
|
||||
Rethrowing b
|
||||
A ctor. i = 14
|
||||
Rethrowing
|
||||
B ctor. i = 15
|
||||
B ctor. i = 16
|
||||
A dtor. i = 14
|
||||
B dtor. i = 16
|
||||
B dtor. i = 15
|
||||
B dtor. i = 13
|
||||
B dtor. i = 10
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B copy ctor. i = 17
|
||||
B dtor. i = 2
|
||||
B dtor. i = 1
|
||||
B ctor. i = 18
|
||||
In catch #2
|
||||
Throwing a new A
|
||||
A ctor. i = 19
|
||||
B ctor. i = 20
|
||||
B ctor. i = 21
|
||||
A copy ctor. i = 22
|
||||
B dtor. i = 21
|
||||
B dtor. i = 20
|
||||
B dtor. i = 5
|
||||
B dtor. i = 18
|
||||
B dtor. i = 17
|
||||
B dtor. i = 0
|
||||
In main's catch
|
||||
B ctor. i = 23
|
||||
B ctor. i = 24
|
||||
A dtor. i = 22
|
||||
B dtor. i = 24
|
||||
B dtor. i = 23
|
||||
B ctor. i = 25
|
||||
B ctor. i = 26
|
||||
A dtor. i = 19
|
||||
B dtor. i = 26
|
||||
B dtor. i = 25
|
||||
|
||||
|
||||
Test #9
|
||||
B ctor. i = 0
|
||||
Throwing B
|
||||
B copy ctor. i = 1
|
||||
B dtor. i = 0
|
||||
In catch #1
|
||||
Rethrow
|
||||
In catch #2
|
||||
B dtor. i = 1
|
||||
End of test9, throwing a A
|
||||
A ctor. i = 2
|
||||
B ctor. i = 3
|
||||
B ctor. i = 4
|
||||
A copy ctor. i = 5
|
||||
B dtor. i = 4
|
||||
B dtor. i = 3
|
||||
In main's catch
|
||||
B ctor. i = 6
|
||||
B ctor. i = 7
|
||||
A dtor. i = 5
|
||||
B dtor. i = 7
|
||||
B dtor. i = 6
|
||||
B ctor. i = 8
|
||||
B ctor. i = 9
|
||||
A dtor. i = 2
|
||||
B dtor. i = 9
|
||||
B dtor. i = 8
|
||||
|
||||
|
||||
Test #10
|
||||
B ctor. i = 0
|
||||
Throwing B
|
||||
B copy ctor. i = 1
|
||||
B dtor. i = 0
|
||||
In catch #1
|
||||
Throwing a new B()
|
||||
B ctor. i = 2
|
||||
In catch #2
|
||||
B dtor. i = 2
|
||||
B dtor. i = 1
|
||||
End of test10, throwing a A
|
||||
A ctor. i = 3
|
||||
B ctor. i = 4
|
||||
B ctor. i = 5
|
||||
A copy ctor. i = 6
|
||||
B dtor. i = 5
|
||||
B dtor. i = 4
|
||||
In main's catch
|
||||
B ctor. i = 7
|
||||
B ctor. i = 8
|
||||
A dtor. i = 6
|
||||
B dtor. i = 8
|
||||
B dtor. i = 7
|
||||
B ctor. i = 9
|
||||
B ctor. i = 10
|
||||
A dtor. i = 3
|
||||
B dtor. i = 10
|
||||
B dtor. i = 9
|
||||
|
||||
|
||||
Passed
|
199
modules/rostests/apitests/compiler/ms/eh/ihateeh.cxx
Normal file
199
modules/rostests/apitests/compiler/ms/eh/ihateeh.cxx
Normal file
|
@ -0,0 +1,199 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#define NO_CTOR_THROW 1
|
||||
#define NO_DTOR_THROW 2
|
||||
|
||||
#define TEST_DTOR
|
||||
|
||||
#define MAX_OBJECTS 500
|
||||
|
||||
#define NOEXCEPT(_x)
|
||||
|
||||
int Object[MAX_OBJECTS];
|
||||
int CurrentObjectNumber, ThrowCount, MaxObjectCount = 1;
|
||||
int Fail;
|
||||
|
||||
void FAIL(int i) {
|
||||
printf("FAILED on %d\n", i);
|
||||
Fail++;
|
||||
}
|
||||
|
||||
void dealloc(int i, int no_throw) {
|
||||
/* Make sure i is valid, and object exists */
|
||||
if (i < 0 || i >= MaxObjectCount || !Object[i])
|
||||
FAIL(i);
|
||||
|
||||
Object[i] = 0;
|
||||
|
||||
/* Try throw in this dtor.. */
|
||||
#ifdef TEST_DTOR
|
||||
if (i + MaxObjectCount == ThrowCount && !no_throw) {
|
||||
printf("Throwing\n");
|
||||
throw(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void alloc(int i, int no_throw) {
|
||||
if (CurrentObjectNumber > MaxObjectCount)
|
||||
MaxObjectCount = CurrentObjectNumber;
|
||||
|
||||
/* Object already exists? */
|
||||
if (Object[i])
|
||||
FAIL(i);
|
||||
|
||||
/* Try throw in this ctor.. */
|
||||
if (i == ThrowCount && !no_throw) {
|
||||
printf("Throwing\n");
|
||||
throw(1);
|
||||
}
|
||||
|
||||
if (i >= MAX_OBJECTS) {
|
||||
printf("\n*** Number of objects exceeded. Increase MAX_OBJECTS ***\n\n");
|
||||
FAIL(i);
|
||||
i = 0;
|
||||
}
|
||||
|
||||
Object[i] = 1;
|
||||
}
|
||||
|
||||
class B {
|
||||
public:
|
||||
int i;
|
||||
int flag;
|
||||
B();
|
||||
B(int);
|
||||
~B() NOEXCEPT(false);
|
||||
};
|
||||
|
||||
B::B() {
|
||||
i = CurrentObjectNumber++;
|
||||
printf("B ctor. i = %d\n", i);
|
||||
alloc(i, FALSE);
|
||||
}
|
||||
|
||||
B::B(int f) {
|
||||
i = CurrentObjectNumber++;
|
||||
flag = f;
|
||||
printf("B ctor. i = %d\n", i);
|
||||
alloc(i, flag == NO_CTOR_THROW);
|
||||
}
|
||||
|
||||
B::~B() NOEXCEPT(false) {
|
||||
printf("B dtor. i = %d\n", i);
|
||||
dealloc(i, flag == NO_DTOR_THROW);
|
||||
}
|
||||
|
||||
class A {
|
||||
public:
|
||||
int i;
|
||||
A();
|
||||
A(int) {
|
||||
i = CurrentObjectNumber++;
|
||||
printf("A(int) ctor. i = %d\n", i);
|
||||
alloc(i, FALSE);
|
||||
}
|
||||
A operator+(A a);
|
||||
A(const A &a) {
|
||||
/* Try objects in ctor */
|
||||
B b1 = NO_DTOR_THROW, b2 = NO_DTOR_THROW;
|
||||
|
||||
i = CurrentObjectNumber++;
|
||||
printf("A copy ctor. i = %d\n", i);
|
||||
alloc(i, FALSE);
|
||||
}
|
||||
|
||||
~A() NOEXCEPT(false) {
|
||||
/* Try objects in dtor */
|
||||
B b1 = NO_CTOR_THROW, b2 = NO_CTOR_THROW;
|
||||
|
||||
printf("A dtor. i = %d\n", i);
|
||||
dealloc(i, FALSE);
|
||||
};
|
||||
};
|
||||
|
||||
A::A() {
|
||||
i = CurrentObjectNumber++;
|
||||
printf("A ctor. i = %d\n", i);
|
||||
alloc(i, FALSE);
|
||||
}
|
||||
|
||||
A A::operator+(A a) {
|
||||
printf("A%d + A%d\n", i, a.i);
|
||||
return A();
|
||||
}
|
||||
|
||||
A foo(A a1, A a2) { return a1 + a2; };
|
||||
|
||||
int bar() {
|
||||
A a;
|
||||
|
||||
return 666;
|
||||
}
|
||||
|
||||
void foo2(int i, A a1, A a2, A a3) {
|
||||
if (i != 666)
|
||||
FAIL(666);
|
||||
foo(a1, a3);
|
||||
}
|
||||
|
||||
A test() {
|
||||
puts("Try simple ctor");
|
||||
A a1;
|
||||
|
||||
puts("Try question op ctor");
|
||||
A a2 = (ThrowCount & 1) ? A() : ThrowCount;
|
||||
|
||||
puts("Try a more complex question op ctor");
|
||||
A a3 = (ThrowCount & 1) ? A() + a1 + A() + a2 : a2 + A() + A() + ThrowCount;
|
||||
|
||||
puts("Try mbarg copy ctors, and return UDT");
|
||||
A a4 = foo(a1, a2);
|
||||
|
||||
puts("Try a more complex mbarg copy ctors, and a function call");
|
||||
foo2(bar(), a1 + a2, a2 + A() + a3 + a4, a3);
|
||||
|
||||
puts("Try temporary expressions, and return UDT");
|
||||
return a1 + A() + a2 + A() + a3 + a4;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int i;
|
||||
|
||||
/* Call test(), with a different ctor/dtor throwing each time */
|
||||
for (ThrowCount = 0; ThrowCount < MaxObjectCount * 2; ThrowCount++) {
|
||||
printf("ThrowCount = %d MaxObjectCount = %d\n", ThrowCount,
|
||||
MaxObjectCount);
|
||||
|
||||
CurrentObjectNumber = 0;
|
||||
|
||||
try {
|
||||
test();
|
||||
} catch (int) {
|
||||
printf("In catch\n");
|
||||
}
|
||||
|
||||
/* Any objects which didn't get dtor'd? */
|
||||
for (i = 0; i < MaxObjectCount; i++) {
|
||||
if (Object[i]) {
|
||||
FAIL(i);
|
||||
Object[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
if (Fail)
|
||||
printf("FAILED %d tests\n", Fail);
|
||||
else
|
||||
printf("Passed\n");
|
||||
}
|
73231
modules/rostests/apitests/compiler/ms/eh/ihateeh.out.correct
Normal file
73231
modules/rostests/apitests/compiler/ms/eh/ihateeh.out.correct
Normal file
File diff suppressed because it is too large
Load diff
38
modules/rostests/apitests/compiler/ms/eh/nesttry.cxx
Normal file
38
modules/rostests/apitests/compiler/ms/eh/nesttry.cxx
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
class A
|
||||
{
|
||||
public:
|
||||
A(){printf("In A()\n");}
|
||||
~A(){printf("In ~A()\n");}
|
||||
};
|
||||
|
||||
void foo()
|
||||
{
|
||||
printf("Throwing\n");
|
||||
throw 1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
try{
|
||||
try{
|
||||
A a;
|
||||
foo();
|
||||
goto Label;
|
||||
}catch(...){
|
||||
printf("In first catch\nDoing new throw\n");
|
||||
throw 2;
|
||||
goto Label;
|
||||
}
|
||||
}catch(...){
|
||||
printf("In outer catch\n");
|
||||
}
|
||||
printf("End\n");
|
||||
Label:;
|
||||
}
|
||||
|
7
modules/rostests/apitests/compiler/ms/eh/nesttry.out
Normal file
7
modules/rostests/apitests/compiler/ms/eh/nesttry.out
Normal file
|
@ -0,0 +1,7 @@
|
|||
In A()
|
||||
Throwing
|
||||
In ~A()
|
||||
In first catch
|
||||
Doing new throw
|
||||
In outer catch
|
||||
End
|
54
modules/rostests/apitests/compiler/ms/eh/noreturn.cpp
Normal file
54
modules/rostests/apitests/compiler/ms/eh/noreturn.cpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int Count = 0;
|
||||
|
||||
class A
|
||||
{
|
||||
public:
|
||||
A() { Count++; }
|
||||
~A() { Count--; }
|
||||
|
||||
__declspec(noreturn)
|
||||
A(const A &a) { throw 1; }
|
||||
};
|
||||
|
||||
__declspec(noreturn)
|
||||
int bar(A)
|
||||
{
|
||||
throw 1;
|
||||
}
|
||||
|
||||
__declspec(noreturn)
|
||||
A foobar()
|
||||
{
|
||||
throw 1;
|
||||
}
|
||||
|
||||
void foo(const A& a, int i)
|
||||
{
|
||||
A a1 = a;
|
||||
bar(a1);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
try {
|
||||
A a;
|
||||
foo(A(a), bar(a));
|
||||
} catch (int i) {}
|
||||
|
||||
try {
|
||||
A a;
|
||||
foo(foobar(), bar(a));
|
||||
} catch (int i) {}
|
||||
|
||||
if (Count == 0)
|
||||
printf("Passed");
|
||||
else
|
||||
printf("FAILED\n");
|
||||
|
||||
}
|
77
modules/rostests/apitests/compiler/ms/eh/recursive_throw.cpp
Normal file
77
modules/rostests/apitests/compiler/ms/eh/recursive_throw.cpp
Normal file
|
@ -0,0 +1,77 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#ifdef _M_CEE
|
||||
#define MAX_REC 200
|
||||
#else
|
||||
#define MAX_REC 200
|
||||
#endif
|
||||
|
||||
#define NLOOPS 10
|
||||
|
||||
#if defined(_M_SH) || defined(TRISC)
|
||||
#undef MAX_REC
|
||||
#define MAX_REC 3
|
||||
#endif
|
||||
|
||||
#if defined(_M_AMD64)
|
||||
#undef MAX_REC
|
||||
#define MAX_REC 50
|
||||
#endif
|
||||
|
||||
void foo(int level)
|
||||
{
|
||||
if(level < MAX_REC)
|
||||
{
|
||||
try
|
||||
{
|
||||
foo(level+1);
|
||||
}
|
||||
catch(int& throw_level)
|
||||
{
|
||||
//printf("Level %d catched level %d\n",level,throw_level);
|
||||
throw_level = level;
|
||||
//printf("Level %d throwing\n",level);
|
||||
throw level;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Level MAX_REC throwing.\n");
|
||||
throw level;
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int n;
|
||||
LARGE_INTEGER freq,start,end;
|
||||
|
||||
#if !defined(_M_AMD64) && !defined(_M_ARM) && !defined(_M_ARM64)
|
||||
QueryPerformanceFrequency(&freq);
|
||||
QueryPerformanceCounter(&start);
|
||||
#endif
|
||||
|
||||
//printf("Max Recursion level: %d\n", MAX_REC);
|
||||
printf("N loops: %d\n", NLOOPS);
|
||||
|
||||
for(n=0;n<NLOOPS;n++)
|
||||
{
|
||||
try
|
||||
{
|
||||
foo(0);
|
||||
}
|
||||
catch(int& throw_level)
|
||||
{
|
||||
printf("main catched level %d\n",throw_level);
|
||||
}
|
||||
}
|
||||
#if !defined(_M_AMD64) && !defined(_M_ARM) && !defined(_M_ARM64)
|
||||
QueryPerformanceCounter(&end);
|
||||
#endif
|
||||
|
||||
//printf("Exceptions per sec %lf\n",(double)(NLOOPS*MAX_REC)/((double)(end.QuadPart-start.QuadPart)/(double)freq.QuadPart));
|
||||
}
|
21
modules/rostests/apitests/compiler/ms/eh/recursive_throw.out
Normal file
21
modules/rostests/apitests/compiler/ms/eh/recursive_throw.out
Normal file
|
@ -0,0 +1,21 @@
|
|||
N loops: 10
|
||||
Level MAX_REC throwing.
|
||||
main catched level 0
|
||||
Level MAX_REC throwing.
|
||||
main catched level 0
|
||||
Level MAX_REC throwing.
|
||||
main catched level 0
|
||||
Level MAX_REC throwing.
|
||||
main catched level 0
|
||||
Level MAX_REC throwing.
|
||||
main catched level 0
|
||||
Level MAX_REC throwing.
|
||||
main catched level 0
|
||||
Level MAX_REC throwing.
|
||||
main catched level 0
|
||||
Level MAX_REC throwing.
|
||||
main catched level 0
|
||||
Level MAX_REC throwing.
|
||||
main catched level 0
|
||||
Level MAX_REC throwing.
|
||||
main catched level 0
|
44
modules/rostests/apitests/compiler/ms/eh/rethrow1.cpp
Normal file
44
modules/rostests/apitests/compiler/ms/eh/rethrow1.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <stdio.h>
|
||||
int c, d;
|
||||
struct A
|
||||
{
|
||||
int i;
|
||||
A () { i = ++c; printf ("A() %d\n", i); }
|
||||
A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
|
||||
~A() { printf ("~A() %d\n", i); ++d; }
|
||||
};
|
||||
int
|
||||
main ()
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
printf ("Throwing 1...\n");
|
||||
throw A();
|
||||
}
|
||||
catch (A)
|
||||
{
|
||||
try
|
||||
{
|
||||
printf ("Throwing 2...\n");
|
||||
throw A();
|
||||
}
|
||||
catch (A)
|
||||
{
|
||||
printf ("Throwing 3...\n");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (A)
|
||||
{
|
||||
printf ("Caught.\n");
|
||||
}
|
||||
printf ("c == %d, d == %d\n", c, d);
|
||||
return c != d;
|
||||
}
|
9
modules/rostests/apitests/compiler/ms/eh/rethrow1.out
Normal file
9
modules/rostests/apitests/compiler/ms/eh/rethrow1.out
Normal file
|
@ -0,0 +1,9 @@
|
|||
Throwing 1...
|
||||
A() 1
|
||||
Throwing 2...
|
||||
A() 2
|
||||
Throwing 3...
|
||||
~A() 1
|
||||
Caught.
|
||||
~A() 2
|
||||
c == 2, d == 2
|
44
modules/rostests/apitests/compiler/ms/eh/rethrow4.cpp
Normal file
44
modules/rostests/apitests/compiler/ms/eh/rethrow4.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <stdio.h>
|
||||
int c, d;
|
||||
struct A
|
||||
{
|
||||
int i;
|
||||
A () { i = ++c; printf ("A() %d\n", i); }
|
||||
A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
|
||||
~A() { printf ("~A() %d\n", i); ++d; }
|
||||
};
|
||||
int
|
||||
main ()
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
printf ("Throwing 1...\n");
|
||||
throw A();
|
||||
}
|
||||
catch (A)
|
||||
{
|
||||
try
|
||||
{
|
||||
printf ("Throwing 2...\n");
|
||||
throw;
|
||||
}
|
||||
catch (A)
|
||||
{
|
||||
printf ("Throwing 3...\n");
|
||||
throw A();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (A)
|
||||
{
|
||||
printf ("Caught.\n");
|
||||
}
|
||||
printf ("c == %d, d == %d\n", c, d);
|
||||
return c != d;
|
||||
}
|
9
modules/rostests/apitests/compiler/ms/eh/rethrow4.out
Normal file
9
modules/rostests/apitests/compiler/ms/eh/rethrow4.out
Normal file
|
@ -0,0 +1,9 @@
|
|||
Throwing 1...
|
||||
A() 1
|
||||
Throwing 2...
|
||||
Throwing 3...
|
||||
A() 2
|
||||
~A() 1
|
||||
Caught.
|
||||
~A() 2
|
||||
c == 2, d == 2
|
43
modules/rostests/apitests/compiler/ms/eh/rethrow5.cpp
Normal file
43
modules/rostests/apitests/compiler/ms/eh/rethrow5.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <stdio.h>
|
||||
int c, d;
|
||||
struct A
|
||||
{
|
||||
int i;
|
||||
A () { i = ++c; printf ("A() %d\n", i); }
|
||||
A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
|
||||
~A() { printf ("~A() %d\n", i); ++d; }
|
||||
};
|
||||
int
|
||||
main ()
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
printf ("Throwing 1...\n");
|
||||
throw A();
|
||||
}
|
||||
catch (A)
|
||||
{
|
||||
try
|
||||
{
|
||||
printf ("Throwing 2...\n");
|
||||
throw;
|
||||
}
|
||||
catch (A)
|
||||
{
|
||||
printf ("Falling out...\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (A)
|
||||
{
|
||||
printf ("Caught.\n");
|
||||
}
|
||||
printf ("c == %d, d == %d\n", c, d);
|
||||
return c != d;
|
||||
}
|
6
modules/rostests/apitests/compiler/ms/eh/rethrow5.out
Normal file
6
modules/rostests/apitests/compiler/ms/eh/rethrow5.out
Normal file
|
@ -0,0 +1,6 @@
|
|||
Throwing 1...
|
||||
A() 1
|
||||
Throwing 2...
|
||||
Falling out...
|
||||
~A() 1
|
||||
c == 1, d == 1
|
58
modules/rostests/apitests/compiler/ms/eh/rethrow_unknown.cpp
Normal file
58
modules/rostests/apitests/compiler/ms/eh/rethrow_unknown.cpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef void (*OperationF)();
|
||||
void TestFunction() { throw 1; }
|
||||
void RethrowIt() { throw; }
|
||||
|
||||
int HandleRethrown1(OperationF perform) {
|
||||
int ret = 0;
|
||||
try {
|
||||
perform();
|
||||
return 0;
|
||||
} catch (...) {
|
||||
// ellipsis catch
|
||||
try {
|
||||
RethrowIt();
|
||||
} catch (...) {
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int HandleRethrown2(OperationF perform) {
|
||||
int ret = 0;
|
||||
try {
|
||||
perform();
|
||||
return 0;
|
||||
} catch (int j) {
|
||||
// non-ellipsis catch
|
||||
try {
|
||||
RethrowIt();
|
||||
} catch (int i) {
|
||||
ret = i;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int exit_code1;
|
||||
int exit_code2;
|
||||
exit_code1 = HandleRethrown1(TestFunction);
|
||||
exit_code2 = HandleRethrown2(TestFunction);
|
||||
|
||||
if (exit_code1 == 1 && exit_code2 == 1) {
|
||||
printf("passed");
|
||||
} else {
|
||||
printf("failed");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
71
modules/rostests/apitests/compiler/ms/eh/runtest.cmd
Normal file
71
modules/rostests/apitests/compiler/ms/eh/runtest.cmd
Normal file
|
@ -0,0 +1,71 @@
|
|||
REM This is a simple example script to verify that the tests are working on
|
||||
REM windows. This script will be superceded by the lit/lnt as they are
|
||||
REM migrated to the LLVM test-suite.
|
||||
|
||||
REM set FLAGS to the desired optimization level
|
||||
set FLAGS=-EHsc -O2
|
||||
|
||||
cl %FLAGS% ehframes.cpp
|
||||
ehframes.exe > ehframes.tmp 2>&1
|
||||
@if NOT ERRORLEVEL 0 echo FAIL ehframes.exe
|
||||
diff ehframes.tmp ehframes.out
|
||||
@if ERRORLEVEL 1 echo FAIL ehframes.exe with diffs!
|
||||
|
||||
cl %FLAGS% ehthrow.cxx
|
||||
ehthrow.exe > ehthrow.tmp 2>&1
|
||||
@if NOT ERRORLEVEL 0 echo FAIL ehthrow.exe
|
||||
diff ehthrow.tmp ehthrow.amd64
|
||||
@if ERRORLEVEL 1 echo FAIL ehthrow.exe with diffs!
|
||||
|
||||
cl %FLAGS% nesttry.cxx
|
||||
nesttry.exe > nesttry.tmp 2>&1
|
||||
@if NOT ERRORLEVEL 0 echo FAIL nesttry.exe
|
||||
diff nesttry.tmp nesttry.out
|
||||
@if ERRORLEVEL 1 echo FAIL nesttry.exe with diffs!
|
||||
|
||||
cl %FLAGS% noreturn.cpp
|
||||
noreturn.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL noreturn.exe
|
||||
|
||||
cl %FLAGS% recursive_throw.cpp
|
||||
recursive_throw.exe > recursive_throw.tmp 2>&1
|
||||
@if NOT ERRORLEVEL 0 echo FAIL recursive_throw.exe
|
||||
diff recursive_throw.tmp recursive_throw.out
|
||||
@if ERRORLEVEL 1 echo FAIL recursive_throw.exe with diffs!
|
||||
|
||||
cl %FLAGS% rethrow1.cpp
|
||||
rethrow1.exe > rethrow1.tmp 2>&1
|
||||
@if NOT ERRORLEVEL 0 echo FAIL rethrow1.exe
|
||||
diff rethrow1.tmp rethrow1.out
|
||||
@if ERRORLEVEL 1 echo FAIL rethrow1.exe with diffs!
|
||||
|
||||
cl %FLAGS% rethrow4.cpp
|
||||
rethrow4.exe > rethrow4.tmp 2>&1
|
||||
@if NOT ERRORLEVEL 0 echo FAIL rethrow4.exe
|
||||
diff rethrow4.tmp rethrow4.out
|
||||
@if ERRORLEVEL 1 echo FAIL rethrow4.exe with diffs!
|
||||
|
||||
cl %FLAGS% rethrow5.cpp
|
||||
rethrow5.exe > rethrow5.tmp 2>&1
|
||||
@if NOT ERRORLEVEL 0 echo FAIL rethrow5.exe
|
||||
diff rethrow5.tmp rethrow5.out
|
||||
@if ERRORLEVEL 1 echo FAIL rethrow5.exe with diffs!
|
||||
|
||||
cl %FLAGS% rethrow_unknown.cpp
|
||||
rethrow_unknown.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL rethrow_unknown.exe
|
||||
|
||||
cl %FLAGS% terminate.cpp
|
||||
terminate.exe > terminate.tmp 2>&1
|
||||
@if NOT ERRORLEVEL 0 echo FAIL terminate.exe
|
||||
diff terminate.tmp terminate.out
|
||||
@if ERRORLEVEL 1 echo FAIL terminate.exe with diffs!
|
||||
|
||||
cl %FLAGS% unreachedeh.cpp
|
||||
unreachedeh.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL unreachedeh.exe
|
||||
|
||||
cl %FLAGS% vcatch.cpp
|
||||
vcatch.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL vcatch.exe
|
||||
|
123
modules/rostests/apitests/compiler/ms/eh/terminate.cpp
Normal file
123
modules/rostests/apitests/compiler/ms/eh/terminate.cpp
Normal file
|
@ -0,0 +1,123 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
/*
|
||||
** The first call to Test checks to make sure that we don't call terminate
|
||||
** when an SEH fault is triggered. After catching the SEH fault, we then
|
||||
** cause a C++ EH fault (where the destructed object is in the try-block
|
||||
** that threw the exception). The C++ EH fault in the dtor should cause
|
||||
** a call to terminate(); in this case, we register our own handler to
|
||||
** trap the call to terminate(). We then run a second C++ EH fault (where
|
||||
** the destructed object is higher in the call tree than where the
|
||||
** exception was thrown). We trap this call to terminate() as well (with
|
||||
** a different handler) and then exit.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <eh.h>
|
||||
|
||||
int FGenSEHException;
|
||||
|
||||
class C
|
||||
{
|
||||
public:
|
||||
C() {}
|
||||
~C()
|
||||
{
|
||||
printf( "in C::~C()\n");
|
||||
if (FGenSEHException)
|
||||
{
|
||||
printf("generating access violation (SEH)\n");
|
||||
*(volatile char*)(0) = 0; // Uh, EHa, don't you think?
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("throwing C++ exception\n");
|
||||
throw 'a';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int Test()
|
||||
{
|
||||
try
|
||||
{
|
||||
C c;
|
||||
throw 1;
|
||||
}
|
||||
catch (int)
|
||||
{
|
||||
printf("Destructor was not invoked \n");
|
||||
}
|
||||
catch (char)
|
||||
{
|
||||
printf("Destructor exited using an exception\n");
|
||||
}
|
||||
#if 0
|
||||
catch (...)
|
||||
{
|
||||
printf("Throw caught by wrong handler\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("terminate() was not called\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Bar(void)
|
||||
{
|
||||
printf("in %s\n", __FUNCTION__);
|
||||
throw 1;
|
||||
}
|
||||
|
||||
void Test2(void)
|
||||
{
|
||||
printf("in %s\n", __FUNCTION__);
|
||||
C c;
|
||||
Bar();
|
||||
return;
|
||||
}
|
||||
|
||||
void __cdecl Terminate2(void)
|
||||
{
|
||||
printf("termination handler (%s) called\n", __FUNCTION__);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void __cdecl Terminate1(void)
|
||||
{
|
||||
printf("termination handler (%s) called\n", __FUNCTION__);
|
||||
|
||||
// Set a new handler and run a second C++ EH test case.
|
||||
set_terminate(Terminate2);
|
||||
Test2();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
// First check that we don't terminate on an SEH exception
|
||||
FGenSEHException = 1;
|
||||
__try
|
||||
{
|
||||
i = Test();
|
||||
}
|
||||
__except (1)
|
||||
{
|
||||
printf("caught SEH exception in %s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
// Now set our own terminate handler and throw a C++ EH exception
|
||||
set_terminate(Terminate1);
|
||||
FGenSEHException = 0;
|
||||
i = Test();
|
||||
|
||||
// Should never get here
|
||||
printf("termination handler not called\n");
|
||||
return i;
|
||||
}
|
11
modules/rostests/apitests/compiler/ms/eh/terminate.out
Normal file
11
modules/rostests/apitests/compiler/ms/eh/terminate.out
Normal file
|
@ -0,0 +1,11 @@
|
|||
in C::~C()
|
||||
generating access violation (SEH)
|
||||
caught SEH exception in main
|
||||
in C::~C()
|
||||
throwing C++ exception
|
||||
termination handler (Terminate1) called
|
||||
in Test2
|
||||
in Bar
|
||||
in C::~C()
|
||||
throwing C++ exception
|
||||
termination handler (Terminate2) called
|
17
modules/rostests/apitests/compiler/ms/eh/unreachedeh.cpp
Normal file
17
modules/rostests/apitests/compiler/ms/eh/unreachedeh.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
printf("pass");
|
||||
|
||||
return 0;
|
||||
|
||||
try {} catch (...) {}
|
||||
|
||||
}
|
||||
|
57
modules/rostests/apitests/compiler/ms/eh/vcatch.cpp
Normal file
57
modules/rostests/apitests/compiler/ms/eh/vcatch.cpp
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
// Write to volatiles in the catch to try and verify that we have
|
||||
// a correct catch frame prolog and epilog.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
__declspec(align(64)) struct X
|
||||
{
|
||||
X() : x(3) { }
|
||||
~X() { }
|
||||
volatile int x;
|
||||
};
|
||||
|
||||
void t(char * c)
|
||||
{
|
||||
c[4] = 'a';
|
||||
throw 123;
|
||||
}
|
||||
|
||||
bool f()
|
||||
{
|
||||
char * buf = (char *) _alloca(10);
|
||||
X x;
|
||||
volatile bool caught = false;
|
||||
|
||||
try
|
||||
{
|
||||
t(buf);
|
||||
}
|
||||
catch(int)
|
||||
{
|
||||
caught = true;
|
||||
x.x = 2;
|
||||
}
|
||||
|
||||
return caught;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
__try {
|
||||
result = f();
|
||||
}
|
||||
__except(1)
|
||||
{
|
||||
printf("ERROR - Unexpectedly caught an exception\n");
|
||||
}
|
||||
|
||||
printf(result ? "passed\n" : "failed\n");
|
||||
return result ? 0 : -1;
|
||||
}
|
26
modules/rostests/apitests/compiler/ms/seh/CMakeLists.txt
Normal file
26
modules/rostests/apitests/compiler/ms/seh/CMakeLists.txt
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
if(MSVC)
|
||||
add_compile_options("/wd4189") # error C4189: 'Index2': local variable is initialized but not referenced
|
||||
add_compile_options("/wd4197") # warning C4197: 'volatile LONG': top-level volatile in cast is ignored
|
||||
add_compile_options("/wd4532") # warning C4532: 'break': jump out of __finally block has undefined behavior during termination handling
|
||||
else()
|
||||
add_compile_options("-Wno-format")
|
||||
add_compile_options("-Wno-implicit-function-declaration")
|
||||
add_compile_options("-Wno-unused-label")
|
||||
add_compile_options("-Wno-unused-variable")
|
||||
endif()
|
||||
|
||||
foreach(num RANGE 1 9)
|
||||
list(APPEND SOURCE seh000${num}.c)
|
||||
set_source_files_properties(seh000${num}.c PROPERTIES COMPILE_DEFINITIONS
|
||||
"main=seh000${num};test=test_${num};Echo=Echo_${num};dojump=dojump_${num};AccessViolation=AccessViolation_${num};rtlRaiseExceptin=rtlRaiseExceptin_${num};rtlRaiseException=rtlRaiseException_${num};rtlRaiseStatus=rtlRaiseStatus_${num}")
|
||||
endforeach()
|
||||
|
||||
foreach(num RANGE 10 58)
|
||||
list(APPEND SOURCE seh00${num}.c)
|
||||
set_source_files_properties(seh00${num}.c PROPERTIES COMPILE_DEFINITIONS
|
||||
"main=seh00${num};test=test_${num};Echo=Echo_${num};dojump=dojump_${num};AccessViolation=AccessViolation_${num};rtlRaiseExceptin=rtlRaiseExceptin_${num};rtlRaiseException=rtlRaiseException_${num};rtlRaiseStatus=rtlRaiseStatus_${num}")
|
||||
endforeach()
|
||||
|
||||
add_library(ms_seh_test ${SOURCE})
|
||||
add_dependencies(ms_seh_test psdk)
|
122
modules/rostests/apitests/compiler/ms/seh/clean.cmd
Normal file
122
modules/rostests/apitests/compiler/ms/seh/clean.cmd
Normal file
|
@ -0,0 +1,122 @@
|
|||
del seh0001.exe
|
||||
del seh0001.obj
|
||||
del seh0002.exe
|
||||
del seh0002.obj
|
||||
del seh0003.exe
|
||||
del seh0003.obj
|
||||
del seh0004.exe
|
||||
del seh0004.obj
|
||||
del seh0005.exe
|
||||
del seh0005.obj
|
||||
del seh0006.exe
|
||||
del seh0006.obj
|
||||
del seh0007.exe
|
||||
del seh0007.obj
|
||||
del seh0008.exe
|
||||
del seh0008.obj
|
||||
del seh0009.exe
|
||||
del seh0009.obj
|
||||
del seh0010.exe
|
||||
del seh0010.obj
|
||||
del seh0011.exe
|
||||
del seh0011.obj
|
||||
del seh0012.exe
|
||||
del seh0012.obj
|
||||
del seh0013.exe
|
||||
del seh0013.obj
|
||||
del seh0014.exe
|
||||
del seh0014.obj
|
||||
del seh0015.exe
|
||||
del seh0015.obj
|
||||
del seh0016.exe
|
||||
del seh0016.obj
|
||||
del seh0017.exe
|
||||
del seh0017.obj
|
||||
del seh0018.exe
|
||||
del seh0018.obj
|
||||
del seh0019.exe
|
||||
del seh0019.obj
|
||||
del seh0020.exe
|
||||
del seh0020.obj
|
||||
del seh0021.exe
|
||||
del seh0021.obj
|
||||
del seh0022.exe
|
||||
del seh0022.obj
|
||||
del seh0023.exe
|
||||
del seh0023.obj
|
||||
del seh0024.exe
|
||||
del seh0024.obj
|
||||
del seh0025.exe
|
||||
del seh0025.obj
|
||||
del seh0026.exe
|
||||
del seh0026.obj
|
||||
del seh0027.exe
|
||||
del seh0027.obj
|
||||
del seh0028.exe
|
||||
del seh0028.obj
|
||||
del seh0029.exe
|
||||
del seh0029.obj
|
||||
del seh0030.exe
|
||||
del seh0030.obj
|
||||
del seh0031.exe
|
||||
del seh0031.obj
|
||||
del seh0032.exe
|
||||
del seh0032.obj
|
||||
del seh0033.exe
|
||||
del seh0033.obj
|
||||
del seh0034.exe
|
||||
del seh0034.obj
|
||||
del seh0035.exe
|
||||
del seh0035.obj
|
||||
del seh0036.exe
|
||||
del seh0036.obj
|
||||
del seh0037.exe
|
||||
del seh0037.obj
|
||||
del seh0038.exe
|
||||
del seh0038.obj
|
||||
del seh0039.exe
|
||||
del seh0039.obj
|
||||
del seh0040.exe
|
||||
del seh0040.obj
|
||||
del seh0041.exe
|
||||
del seh0041.obj
|
||||
del seh0042.exe
|
||||
del seh0042.obj
|
||||
del seh0043.exe
|
||||
del seh0043.obj
|
||||
del seh0044.exe
|
||||
del seh0044.obj
|
||||
del seh0045.exe
|
||||
del seh0045.obj
|
||||
del seh0046.exe
|
||||
del seh0046.obj
|
||||
del seh0047.exe
|
||||
del seh0047.obj
|
||||
del seh0048.exe
|
||||
del seh0048.obj
|
||||
del seh0049.exe
|
||||
del seh0049.obj
|
||||
del seh0050.exe
|
||||
del seh0050.obj
|
||||
del seh0051.exe
|
||||
del seh0051.obj
|
||||
del seh0052.exe
|
||||
del seh0052.obj
|
||||
del seh0053.exe
|
||||
del seh0053.obj
|
||||
del seh0054.exe
|
||||
del seh0054.obj
|
||||
del seh0055.exe
|
||||
del seh0055.obj
|
||||
del seh0056.exe
|
||||
del seh0056.obj
|
||||
del seh0057.exe
|
||||
del seh0057.obj
|
||||
del seh0058.exe
|
||||
del seh0058.obj
|
||||
del seh_noreturn.exe
|
||||
del seh_noreturn.obj
|
||||
del xcpt4u.exe
|
||||
del xcpt4u.obj
|
||||
del sehframes.exe
|
||||
del sehframes.obj
|
196
modules/rostests/apitests/compiler/ms/seh/runtests.cmd
Normal file
196
modules/rostests/apitests/compiler/ms/seh/runtests.cmd
Normal file
|
@ -0,0 +1,196 @@
|
|||
REM This is a simple example script to verify that the tests are working on
|
||||
REM windows. This script will be superceded by the lit/lnt as they are
|
||||
REM migrated to the LLVM test-suite.
|
||||
|
||||
REM set FLAGS to the desired optimization level
|
||||
set FLAGS=/Od
|
||||
|
||||
cl %FLAGS% seh0001.c
|
||||
seh0001.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0001.exe
|
||||
cl %FLAGS% seh0002.c
|
||||
seh0002.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0002.exe
|
||||
cl %FLAGS% seh0003.c
|
||||
seh0003.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0003.exe
|
||||
cl %FLAGS% seh0004.c
|
||||
seh0004.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0004.exe
|
||||
cl %FLAGS% seh0005.c
|
||||
seh0005.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0005.exe
|
||||
cl %FLAGS% seh0006.c
|
||||
seh0006.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0006.exe
|
||||
cl %FLAGS% seh0007.c
|
||||
seh0007.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0007.exe
|
||||
cl %FLAGS% seh0008.c
|
||||
seh0008.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0008.exe
|
||||
cl %FLAGS% seh0009.c
|
||||
seh0009.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0009.exe
|
||||
cl %FLAGS% seh0010.c
|
||||
seh0010.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0010.exe
|
||||
cl %FLAGS% seh0011.c
|
||||
seh0011.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0011.exe
|
||||
cl %FLAGS% seh0012.c
|
||||
seh0012.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0012.exe
|
||||
cl %FLAGS% seh0013.c
|
||||
seh0013.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0013.exe
|
||||
cl %FLAGS% seh0014.c
|
||||
seh0014.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0014.exe
|
||||
cl %FLAGS% seh0015.c
|
||||
seh0015.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0015.exe
|
||||
cl %FLAGS% seh0016.c
|
||||
seh0016.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0016.exe
|
||||
cl %FLAGS% seh0017.c
|
||||
seh0017.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0017.exe
|
||||
cl %FLAGS% seh0018.c
|
||||
seh0018.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0018.exe
|
||||
cl %FLAGS% seh0019.c
|
||||
seh0019.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0019.exe
|
||||
cl %FLAGS% seh0020.c
|
||||
seh0020.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0020.exe
|
||||
cl %FLAGS% seh0021.c
|
||||
seh0021.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0021.exe
|
||||
cl %FLAGS% seh0022.c
|
||||
seh0022.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0022.exe
|
||||
cl %FLAGS% seh0023.c
|
||||
seh0023.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0023.exe
|
||||
cl %FLAGS% seh0024.c
|
||||
seh0024.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0024.exe
|
||||
cl %FLAGS% seh0025.c
|
||||
seh0025.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0025.exe
|
||||
cl %FLAGS% seh0026.c
|
||||
seh0026.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0026.exe
|
||||
cl %FLAGS% seh0027.c
|
||||
seh0027.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0027.exe
|
||||
cl %FLAGS% seh0028.c
|
||||
seh0028.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0028.exe
|
||||
cl %FLAGS% seh0029.c
|
||||
seh0029.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0029.exe
|
||||
cl %FLAGS% seh0030.c
|
||||
seh0030.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0030.exe
|
||||
cl %FLAGS% seh0031.c
|
||||
seh0031.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0031.exe
|
||||
cl %FLAGS% seh0032.c
|
||||
seh0032.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0032.exe
|
||||
cl %FLAGS% seh0033.c
|
||||
seh0033.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0033.exe
|
||||
cl %FLAGS% seh0034.c
|
||||
seh0034.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0034.exe
|
||||
cl %FLAGS% seh0035.c
|
||||
seh0035.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0035.exe
|
||||
cl %FLAGS% seh0036.c
|
||||
seh0036.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0036.exe
|
||||
cl %FLAGS% seh0037.c
|
||||
seh0037.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0037.exe
|
||||
cl %FLAGS% seh0038.c
|
||||
seh0038.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0038.exe
|
||||
cl %FLAGS% seh0039.c
|
||||
seh0039.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0039.exe
|
||||
cl %FLAGS% seh0040.c
|
||||
seh0040.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0040.exe
|
||||
cl %FLAGS% seh0041.c
|
||||
seh0041.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0041.exe
|
||||
cl %FLAGS% seh0042.c
|
||||
seh0042.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0042.exe
|
||||
cl %FLAGS% seh0043.c
|
||||
seh0043.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0043.exe
|
||||
cl %FLAGS% seh0044.c
|
||||
seh0044.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0044.exe
|
||||
cl %FLAGS% seh0045.c
|
||||
seh0045.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0045.exe
|
||||
cl %FLAGS% seh0046.c
|
||||
seh0046.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0046.exe
|
||||
cl %FLAGS% seh0047.c
|
||||
seh0047.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0047.exe
|
||||
cl %FLAGS% seh0048.c
|
||||
seh0048.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0048.exe
|
||||
cl %FLAGS% seh0049.c
|
||||
seh0049.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0049.exe
|
||||
cl %FLAGS% seh0050.c
|
||||
seh0050.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0050.exe
|
||||
cl %FLAGS% seh0051.c
|
||||
seh0051.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0051.exe
|
||||
cl %FLAGS% seh0052.c
|
||||
seh0052.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0052.exe
|
||||
cl %FLAGS% seh0053.c
|
||||
seh0053.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0053.exe
|
||||
cl %FLAGS% seh0054.c
|
||||
seh0054.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0054.exe
|
||||
cl %FLAGS% seh0055.c
|
||||
seh0055.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0055.exe
|
||||
cl %FLAGS% seh0056.c
|
||||
seh0056.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0056.exe
|
||||
cl %FLAGS% seh0057.c
|
||||
seh0057.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0057.exe
|
||||
cl %FLAGS% seh0058.c
|
||||
seh0058.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh0058.exe
|
||||
cl %FLAGS% -c seh_noreturn.c
|
||||
REM seh_noreturn.c is a compile only test.
|
||||
@if NOT ERRORLEVEL 0 echo FAIL seh_noreturn.exe
|
||||
|
||||
cl %FLAGS% xcpt4u.c
|
||||
xcpt4u.exe > xcpt4u.test.out
|
||||
@if NOT ERRORLEVEL 0 echo FAIL xcpt4u.exe
|
||||
diff xcpt4u.test.out xcpt4u.correct
|
||||
@if ERRORLEVEL 1 echo FAIL xcpt4u.exe with diffs!
|
||||
|
||||
cl %FLAGS% sehframes.cpp
|
||||
sehframes.exe
|
||||
@if NOT ERRORLEVEL 0 echo FAIL sehframes.exe
|
||||
diff sehframes.test.out sehframes.out
|
||||
@if ERRORLEVEL 1 echo FAIL sehframes.exe with diffs!
|
31
modules/rostests/apitests/compiler/ms/seh/seh.h
Normal file
31
modules/rostests/apitests/compiler/ms/seh/seh.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
#if ( _MSC_VER >= 800 )
|
||||
|
||||
#define try __try
|
||||
#define except __except
|
||||
#define finally __finally
|
||||
#define leave __leave
|
||||
#define endtry
|
||||
#define gcc_volatile
|
||||
|
||||
#else
|
||||
|
||||
#include <pseh/pseh2.h>
|
||||
|
||||
#define try _SEH2_TRY
|
||||
#define except _SEH2_EXCEPT
|
||||
#define finally _SEH2_FINALLY
|
||||
#define leave _SEH2_LEAVE
|
||||
#define endtry _SEH2_END
|
||||
#define abnormal_termination _abnormal_termination
|
||||
#define GetExceptionInformation() _SEH2_GetExceptionInformation()
|
||||
#define GetExceptionCode() _SEH2_GetExceptionCode()
|
||||
#define AbnormalTermination() _SEH2_AbnormalTermination()
|
||||
#define gcc_volatile volatile
|
||||
|
||||
#endif
|
31
modules/rostests/apitests/compiler/ms/seh/seh0001.c
Normal file
31
modules/rostests/apitests/compiler/ms/seh/seh0001.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0001.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
long Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
Counter += 1;
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() == 0) {
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 1 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
36
modules/rostests/apitests/compiler/ms/seh/seh0002.c
Normal file
36
modules/rostests/apitests/compiler/ms/seh/seh0002.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0002.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
Counter += 1;
|
||||
}
|
||||
except(Counter)
|
||||
/*
|
||||
* counter should be positive indicating "EXECUTE HANDLER"
|
||||
* but should never get here as no exception is raised
|
||||
*/
|
||||
{
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 1) {
|
||||
printf("TEST 2 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
34
modules/rostests/apitests/compiler/ms/seh/seh0003.c
Normal file
34
modules/rostests/apitests/compiler/ms/seh/seh0003.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0003.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
Counter -= 1;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /* no flags */
|
||||
0, NULL);
|
||||
}
|
||||
except(Counter)
|
||||
/* counter should be negative, indicating "CONTINUE EXECUTE" */
|
||||
{
|
||||
Counter -= 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != -1) {
|
||||
printf("TEST 3 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
33
modules/rostests/apitests/compiler/ms/seh/seh0004.c
Normal file
33
modules/rostests/apitests/compiler/ms/seh/seh0004.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0004.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
try {
|
||||
Counter += 1;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
|
||||
}
|
||||
except(Counter)
|
||||
/* counter should equal 1 (EXECUTE HANDLER) */
|
||||
{
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 4 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
38
modules/rostests/apitests/compiler/ms/seh/seh0005.c
Normal file
38
modules/rostests/apitests/compiler/ms/seh/seh0005.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0005.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
PLONG BadAddress;
|
||||
PLONG BlackHole;
|
||||
LONG Counter;
|
||||
|
||||
BadAddress = (PLONG)((PVOID)0);
|
||||
BlackHole = &Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
Counter += 1;
|
||||
*BlackHole += *BadAddress;
|
||||
}
|
||||
except(Counter)
|
||||
/* counter == 1 (EXECUTE HANDLER) */
|
||||
{
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 5 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
55
modules/rostests/apitests/compiler/ms/seh/seh0006.c
Normal file
55
modules/rostests/apitests/compiler/ms/seh/seh0006.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0006.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
try {
|
||||
Counter += 1;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /* no flags */
|
||||
0, NULL);
|
||||
// RtlRaiseException(&ExceptionRecord);
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() != 0)
|
||||
/*
|
||||
* an exception is not an abnormal termination
|
||||
* therefore thi should get executed
|
||||
*/
|
||||
{
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
}
|
||||
except(Counter)
|
||||
/* counter should equal "EXECUTE HANDLER" */
|
||||
{
|
||||
if (Counter == 2)
|
||||
/*
|
||||
* counter should equal two and therefore
|
||||
* execute this code
|
||||
*/
|
||||
{
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 3) {
|
||||
printf("TEST 6 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
56
modules/rostests/apitests/compiler/ms/seh/seh0007.c
Normal file
56
modules/rostests/apitests/compiler/ms/seh/seh0007.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0007.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
PLONG BadAddress;
|
||||
PLONG BlackHole;
|
||||
LONG Counter;
|
||||
|
||||
// startest();
|
||||
|
||||
BadAddress = (PLONG)((PVOID)0);
|
||||
BlackHole = &Counter;
|
||||
|
||||
Counter = 0;
|
||||
try {
|
||||
try {
|
||||
Counter += 1;
|
||||
*BlackHole += *BadAddress;
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() != 0)
|
||||
/*
|
||||
* should execute handler as not abnormal
|
||||
* termination
|
||||
*/
|
||||
{
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
}
|
||||
except(Counter)
|
||||
/* counter is positive == EXECUTE_HANDLER */
|
||||
{
|
||||
if (Counter == 2)
|
||||
/* counter should equal 2 and execute handler */
|
||||
{
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 3) {
|
||||
printf("TEST 7 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
42
modules/rostests/apitests/compiler/ms/seh/seh0008.c
Normal file
42
modules/rostests/apitests/compiler/ms/seh/seh0008.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0008.c";
|
||||
int perfect;
|
||||
|
||||
void rtlRaiseStatus(DWORD Status) {
|
||||
RaiseException(Status, 0, /*no flags*/ 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
Counter += 1;
|
||||
/* raise exception */
|
||||
RaiseException(EXCEPTION_ACCESS_VIOLATION, 0, /*no flags*/ 0, 0);
|
||||
}
|
||||
except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0)
|
||||
/*
|
||||
* if correct exeception (EXECIUTE HANDLER (1) else
|
||||
* CONTINUE SEARCH (0)). this test should execute handler
|
||||
*/
|
||||
{
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 8 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
46
modules/rostests/apitests/compiler/ms/seh/seh0009.c
Normal file
46
modules/rostests/apitests/compiler/ms/seh/seh0009.c
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0009.c";
|
||||
int perfect;
|
||||
|
||||
void AccessViolation(PLONG BlackHole, PLONG BadAddress) {
|
||||
*BlackHole += *BadAddress;
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
PLONG BadAddress;
|
||||
PLONG BlackHole;
|
||||
LONG Counter;
|
||||
|
||||
BadAddress = (PLONG)((PVOID)0);
|
||||
BlackHole = &Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
Counter += 1;
|
||||
AccessViolation(BlackHole, BadAddress);
|
||||
}
|
||||
except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0)
|
||||
/*
|
||||
* should be ACCESS VIOLATOIN 0xC0000005L) causing
|
||||
* execution of handler
|
||||
*/
|
||||
{
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 9 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
57
modules/rostests/apitests/compiler/ms/seh/seh0010.c
Normal file
57
modules/rostests/apitests/compiler/ms/seh/seh0010.c
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0010.c";
|
||||
int perfect;
|
||||
|
||||
void rtlRaiseExcpt(DWORD Status) {
|
||||
RaiseException(Status, 0, /*no flags*/ 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
void tfRaiseExcpt(DWORD Status, PLONG Counter) {
|
||||
try {
|
||||
rtlRaiseExcpt(Status);
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() != 0)
|
||||
/*
|
||||
* not abnormal termination
|
||||
* counter should eqaul 99
|
||||
*/
|
||||
{
|
||||
*Counter = 99;
|
||||
} else {
|
||||
*Counter = 100;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
tfRaiseExcpt(STATUS_ACCESS_VIOLATION, &Counter);
|
||||
}
|
||||
except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0)
|
||||
/* exception raised was 0xC0000005L, and execute handler */
|
||||
{
|
||||
Counter -= 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 98) {
|
||||
printf("TEST 10 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
64
modules/rostests/apitests/compiler/ms/seh/seh0011.c
Normal file
64
modules/rostests/apitests/compiler/ms/seh/seh0011.c
Normal file
|
@ -0,0 +1,64 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0011.c";
|
||||
int perfect;
|
||||
|
||||
void AccessViolation(PLONG BlackHole, PLONG BadAddress) {
|
||||
*BlackHole += *BadAddress;
|
||||
return;
|
||||
}
|
||||
|
||||
void tfAccessViolation(PLONG BlackHole, PLONG BadAddress, PLONG Counter) {
|
||||
try {
|
||||
AccessViolation(BlackHole, BadAddress);
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() != 0)
|
||||
/*
|
||||
* not abnormal termination
|
||||
* counter should equal 99
|
||||
*/
|
||||
{
|
||||
*Counter = 99;
|
||||
} else {
|
||||
*Counter = 100;
|
||||
}
|
||||
} endtry
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
PLONG BadAddress;
|
||||
PLONG BlackHole;
|
||||
LONG Counter;
|
||||
|
||||
BadAddress = (PLONG)((PVOID)0);
|
||||
BlackHole = &Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
tfAccessViolation(BlackHole, BadAddress, &Counter);
|
||||
}
|
||||
except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0)
|
||||
/*
|
||||
* acception raised was 0xC00000005L (ACCESS VIOLATION)
|
||||
* execute handler
|
||||
*/
|
||||
{
|
||||
Counter -= 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 98) {
|
||||
printf("TEST 11 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
50
modules/rostests/apitests/compiler/ms/seh/seh0012.c
Normal file
50
modules/rostests/apitests/compiler/ms/seh/seh0012.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0012.c";
|
||||
int perfect;
|
||||
|
||||
void rtlRaiseException(DWORD Status) {
|
||||
RaiseException(Status, 0, /*no flags*/ 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
rtlRaiseException(EXCEPTION_ACCESS_VIOLATION);
|
||||
}
|
||||
except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0)
|
||||
/* excpetion handler should get executed */
|
||||
{
|
||||
Counter += 1;
|
||||
try {
|
||||
rtlRaiseException(EXCEPTION_CONTINUE_SEARCH);
|
||||
}
|
||||
except((GetExceptionCode() == EXCEPTION_CONTINUE_SEARCH) ? 1 : 0)
|
||||
/* excpetion handler should get executed */
|
||||
{
|
||||
if (Counter != 1) {
|
||||
printf("TEST 12 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 12 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
69
modules/rostests/apitests/compiler/ms/seh/seh0013.c
Normal file
69
modules/rostests/apitests/compiler/ms/seh/seh0013.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0013.c";
|
||||
int perfect;
|
||||
|
||||
void rtlRaiseException(DWORD Status) {
|
||||
RaiseException(Status, 0, /*no flags*/ 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
void AccessViolation(PLONG BlackHole, PLONG BadAddress) {
|
||||
*BlackHole += *BadAddress;
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
PLONG BadAddress;
|
||||
PCHAR BadByte;
|
||||
PLONG BlackHole;
|
||||
ULONG Index2 = 1;
|
||||
LONG Counter;
|
||||
|
||||
BadAddress = (PLONG)((PVOID)0);
|
||||
BadByte = (PCHAR)((PVOID)0);
|
||||
BadByte += 1;
|
||||
BlackHole = &Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
AccessViolation(BlackHole, BadAddress);
|
||||
}
|
||||
except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0)
|
||||
/*
|
||||
* exception handler should gete executed
|
||||
* setting Counter to 1
|
||||
*/
|
||||
{
|
||||
Counter += 1;
|
||||
try {
|
||||
rtlRaiseException(EXCEPTION_CONTINUE_SEARCH);
|
||||
}
|
||||
except((GetExceptionCode() == EXCEPTION_CONTINUE_SEARCH) ? 1 : 0)
|
||||
/* exception handler should get executed */
|
||||
{
|
||||
if (Counter != 1) {
|
||||
printf("TEST 13 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
/* set's counter to 2 */
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 13 FAILED. Counter= %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
49
modules/rostests/apitests/compiler/ms/seh/seh0014.c
Normal file
49
modules/rostests/apitests/compiler/ms/seh/seh0014.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0014.c";
|
||||
int perfect;
|
||||
|
||||
void rtlRaiseExceptin(DWORD Status) {
|
||||
RaiseException(Status, 0, /*no flags*/ 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
try {
|
||||
rtlRaiseExceptin(EXCEPTION_ACCESS_VIOLATION);
|
||||
}
|
||||
except((GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? 1 : 0)
|
||||
/* handler should get executed setting counter to 1 */
|
||||
{
|
||||
Counter += 1;
|
||||
goto t9; /* executes finally before goto */
|
||||
}
|
||||
endtry
|
||||
}
|
||||
finally
|
||||
/* should set counter to 2 */
|
||||
{
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
t9:
|
||||
;
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 14 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
48
modules/rostests/apitests/compiler/ms/seh/seh0015.c
Normal file
48
modules/rostests/apitests/compiler/ms/seh/seh0015.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0015.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
Counter += 1;
|
||||
}
|
||||
finally {
|
||||
/* set counter = 2 */
|
||||
Counter += 1;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
goto t10;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
#ifndef _MSC_VER
|
||||
goto t10;
|
||||
#endif
|
||||
}
|
||||
finally {
|
||||
/* set counter = 3 */
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
t10:
|
||||
;
|
||||
|
||||
if (Counter != 3) {
|
||||
printf("TEST 15 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
56
modules/rostests/apitests/compiler/ms/seh/seh0016.c
Normal file
56
modules/rostests/apitests/compiler/ms/seh/seh0016.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0016.c";
|
||||
int perfect;
|
||||
|
||||
void rtlRaiseExceptin(DWORD Status) {
|
||||
RaiseException(Status, 0, /*no flags*/ 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
/* set counter = 1 and raise exception */
|
||||
Counter += 1;
|
||||
rtlRaiseExceptin(EXCEPTION_INT_OVERFLOW);
|
||||
}
|
||||
except(1) {
|
||||
/* set counter = 2 */
|
||||
Counter += 1;
|
||||
goto t11; /* can't jump into the body of a try/finally */
|
||||
}
|
||||
endtry
|
||||
}
|
||||
finally {
|
||||
/* set counter = 3 */
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
t11:
|
||||
;
|
||||
}
|
||||
finally {
|
||||
/* set counter = 4 */
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 4) {
|
||||
printf("TEST 16 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
46
modules/rostests/apitests/compiler/ms/seh/seh0017.c
Normal file
46
modules/rostests/apitests/compiler/ms/seh/seh0017.c
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0017.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
Counter += 1;
|
||||
}
|
||||
finally {
|
||||
/* set counter = 2 */
|
||||
Counter += 1;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
goto t12; /* can't jump into a try/finally */
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
|
||||
t12:
|
||||
;
|
||||
}
|
||||
finally {
|
||||
/* set counter = 3 */
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 3) {
|
||||
printf("TEST 17 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
62
modules/rostests/apitests/compiler/ms/seh/seh0018.c
Normal file
62
modules/rostests/apitests/compiler/ms/seh/seh0018.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0018.c";
|
||||
int perfect;
|
||||
|
||||
void rtlRaiseException(DWORD Status) {
|
||||
RaiseException(Status, 0, /*no flags*/ 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
void eret(DWORD Status, PLONG Counter) {
|
||||
try {
|
||||
try {
|
||||
rtlRaiseException(Status);
|
||||
}
|
||||
except((((DWORD)GetExceptionCode()) == Status) ? 1 : 0)
|
||||
/* exeption handler should get executed */
|
||||
{
|
||||
/* set counter = 2 */
|
||||
*Counter += 1;
|
||||
return;
|
||||
}
|
||||
endtry
|
||||
}
|
||||
finally {
|
||||
/* set counter = 3 */
|
||||
*Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
Counter += 1;
|
||||
eret(EXCEPTION_ACCESS_VIOLATION, &Counter);
|
||||
}
|
||||
finally {
|
||||
/* set counter = 4 */
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 4) {
|
||||
printf("TEST 18 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
59
modules/rostests/apitests/compiler/ms/seh/seh0019.c
Normal file
59
modules/rostests/apitests/compiler/ms/seh/seh0019.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0019.c";
|
||||
int perfect;
|
||||
|
||||
void fret(PLONG Counter) {
|
||||
try {
|
||||
try {
|
||||
/* set counter = 2 */
|
||||
*Counter += 1;
|
||||
}
|
||||
finally {
|
||||
/* set counter = 3 */
|
||||
*Counter += 1;
|
||||
#ifdef _MSC_VER
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
#ifndef _MSC_VER
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
finally {
|
||||
/* set counter = 4 */
|
||||
*Counter += 1;
|
||||
}
|
||||
endtry
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
Counter += 1;
|
||||
fret(&Counter);
|
||||
}
|
||||
finally {
|
||||
/* set counter = 5 */
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 5) {
|
||||
printf("TEST 19 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
35
modules/rostests/apitests/compiler/ms/seh/seh0020.c
Normal file
35
modules/rostests/apitests/compiler/ms/seh/seh0020.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include <setjmp.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0020.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
jmp_buf JumpBuffer;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
if (_setjmp(JumpBuffer) == 0) {
|
||||
/* set counter = 1 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
longjmp(JumpBuffer, 1);
|
||||
} else {
|
||||
/* set counter = 2 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 20 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
43
modules/rostests/apitests/compiler/ms/seh/seh0021.c
Normal file
43
modules/rostests/apitests/compiler/ms/seh/seh0021.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include <setjmp.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0021.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
jmp_buf JumpBuffer;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
if (_setjmp(JumpBuffer) == 0) {
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
finally {
|
||||
/* set counter = 2 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
longjmp(JumpBuffer, 1);
|
||||
}
|
||||
endtry
|
||||
} else {
|
||||
/* set counter = 3 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
|
||||
if (Counter != 3) {
|
||||
printf("TEST 21 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
47
modules/rostests/apitests/compiler/ms/seh/seh0022.c
Normal file
47
modules/rostests/apitests/compiler/ms/seh/seh0022.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include <setjmp.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0022.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
jmp_buf JumpBuffer;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
if (_setjmp(JumpBuffer) == 0) {
|
||||
/* set counter = 1 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
} else {
|
||||
/* set counter = 4 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* set counter = 2 and 5 */
|
||||
Counter += 1;
|
||||
if (Counter == 2) {
|
||||
/* set counter = 3 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
longjmp(JumpBuffer, 1);
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 5) {
|
||||
printf("TEST 22 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
49
modules/rostests/apitests/compiler/ms/seh/seh0023.c
Normal file
49
modules/rostests/apitests/compiler/ms/seh/seh0023.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include <setjmp.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0023.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
jmp_buf JumpBuffer;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
if (_setjmp(JumpBuffer) == 0) {
|
||||
try {
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
|
||||
}
|
||||
finally {
|
||||
/* set counter = 2 */
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
longjmp(JumpBuffer, 1);
|
||||
}
|
||||
endtry
|
||||
}
|
||||
except(1)
|
||||
/* should never get here */
|
||||
{
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
endtry
|
||||
} else {
|
||||
/* set counter = 3 */
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
|
||||
if (Counter != 3) {
|
||||
printf("TEST 23 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
87
modules/rostests/apitests/compiler/ms/seh/seh0024.c
Normal file
87
modules/rostests/apitests/compiler/ms/seh/seh0024.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#if defined(_M_MRX000) || defined(_M_PPC) || defined(_ALPHA)
|
||||
#include <setjmpex.h>
|
||||
#else
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
||||
#define faill()
|
||||
#define startest()
|
||||
#define finish()
|
||||
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0024.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
jmp_buf JumpBuffer;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
#if defined(_M_MRX000) || defined(_M_PPC) || defined(_ALPHA)
|
||||
if (setjmp(JumpBuffer) == 0)
|
||||
#else
|
||||
if (_setjmp(JumpBuffer) == 0)
|
||||
#endif
|
||||
|
||||
{
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
|
||||
}
|
||||
finally {
|
||||
/* set counter = 2 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
endtry
|
||||
}
|
||||
finally {
|
||||
/* set counter = 3 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
/* end unwinding wiht long jump */
|
||||
longjmp(JumpBuffer, 1);
|
||||
}
|
||||
endtry
|
||||
}
|
||||
finally {
|
||||
/* never gets here due to longjump ending unwinding */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
endtry
|
||||
}
|
||||
except(1)
|
||||
/* handle exception after unwinding */
|
||||
{
|
||||
/* sets counter = 4 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
endtry
|
||||
} else {
|
||||
/* sets counter = 5 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
|
||||
if (Counter != 5) {
|
||||
printf("TEST 24 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
85
modules/rostests/apitests/compiler/ms/seh/seh0025.c
Normal file
85
modules/rostests/apitests/compiler/ms/seh/seh0025.c
Normal file
|
@ -0,0 +1,85 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include <setjmp.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0025.c";
|
||||
int perfect;
|
||||
|
||||
void dojump(jmp_buf JumpBuffer, PLONG Counter) {
|
||||
try {
|
||||
try {
|
||||
/* set counter = 2 */
|
||||
(*Counter) += 1;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
|
||||
}
|
||||
finally {
|
||||
/* set counter = 3 */
|
||||
(*Counter) += 1;
|
||||
}
|
||||
endtry
|
||||
}
|
||||
finally {
|
||||
/* set counter = 4 */
|
||||
(*Counter) += 1;
|
||||
/* end unwinding with longjump */
|
||||
longjmp(JumpBuffer, 1);
|
||||
}
|
||||
endtry
|
||||
}
|
||||
|
||||
int main() {
|
||||
jmp_buf JumpBuffer;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
if (_setjmp(JumpBuffer) == 0) {
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
dojump(JumpBuffer, &Counter);
|
||||
}
|
||||
finally {
|
||||
/* set counter = 5 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
endtry
|
||||
}
|
||||
finally {
|
||||
/* set counter = 6 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
endtry
|
||||
}
|
||||
except(1)
|
||||
/*
|
||||
* handle exception raised in function
|
||||
* after unwinding
|
||||
*/
|
||||
{
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
endtry
|
||||
} else {
|
||||
/* set counter = 7 */
|
||||
//(volatile LONG) Counter += 1;
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
|
||||
if (Counter != 7) {
|
||||
printf("TEST 25 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
77
modules/rostests/apitests/compiler/ms/seh/seh0026.c
Normal file
77
modules/rostests/apitests/compiler/ms/seh/seh0026.c
Normal file
|
@ -0,0 +1,77 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0026.c";
|
||||
int perfect;
|
||||
|
||||
void dojump(jmp_buf JumpBuffer, PLONG Counter) {
|
||||
try {
|
||||
try {
|
||||
/* set Counter = 1 */
|
||||
*Counter += 1;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
|
||||
}
|
||||
finally {
|
||||
/* set counter = 2 */
|
||||
*Counter += 1;
|
||||
}
|
||||
endtry
|
||||
}
|
||||
finally {
|
||||
/* set counter = 3 */
|
||||
*Counter += 1;
|
||||
longjmp(JumpBuffer, 1);
|
||||
}
|
||||
endtry
|
||||
}
|
||||
|
||||
int main() {
|
||||
jmp_buf JumpBuffer;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
if (_setjmp(JumpBuffer) == 0) {
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
dojump(JumpBuffer, &Counter);
|
||||
}
|
||||
finally { *(volatile LONG*)&Counter += 1; }
|
||||
endtry
|
||||
}
|
||||
finally {
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
longjmp(JumpBuffer, 1);
|
||||
}
|
||||
endtry
|
||||
}
|
||||
finally { *(volatile LONG*)&Counter += 1; }
|
||||
endtry
|
||||
}
|
||||
except(1)
|
||||
/* EXECUTE HANDLER after unwinding */
|
||||
{
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
endtry
|
||||
} else {
|
||||
/* set Counter = 4 */ //
|
||||
*(volatile LONG*)&Counter += 1;
|
||||
}
|
||||
|
||||
if (Counter != 8) {
|
||||
printf("TEST 26 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
91
modules/rostests/apitests/compiler/ms/seh/seh0027.c
Normal file
91
modules/rostests/apitests/compiler/ms/seh/seh0027.c
Normal file
|
@ -0,0 +1,91 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0027.c";
|
||||
int perfect;
|
||||
|
||||
void rtlRaiseStatus(DWORD Status) {
|
||||
RaiseException(Status, 0, /*no flags*/ 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
ULONG except3(PEXCEPTION_POINTERS ExceptionPointers, PLONG Counter) {
|
||||
PEXCEPTION_RECORD ExceptionRecord;
|
||||
|
||||
ExceptionRecord = ExceptionPointers->ExceptionRecord;
|
||||
if ((ExceptionRecord->ExceptionCode == (STATUS_INTEGER_OVERFLOW)) &&
|
||||
((ExceptionRecord->ExceptionFlags & 0x10) == 0)) {
|
||||
/* set counter = 23 */
|
||||
*Counter += 17;
|
||||
rtlRaiseStatus(EXCEPTION_EXECUTE_HANDLER);
|
||||
} else if ((ExceptionRecord->ExceptionCode == EXCEPTION_EXECUTE_HANDLER) &&
|
||||
((ExceptionRecord->ExceptionFlags & 0x10) != 0)) {
|
||||
/* set counter = 42 */
|
||||
*Counter += 19;
|
||||
/* return COTINUE SEARCH */
|
||||
return 0;
|
||||
}
|
||||
/* never gets here due to exception being rasied */
|
||||
*Counter += 23;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void except1(PLONG Counter) {
|
||||
try {
|
||||
/* set counter = 6 */
|
||||
*Counter += 5;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
|
||||
}
|
||||
except(except3(GetExceptionInformation(), Counter)) { *Counter += 7; }
|
||||
endtry
|
||||
/* set counter = 59 */
|
||||
*Counter += 9;
|
||||
return;
|
||||
}
|
||||
|
||||
ULONG except2(PEXCEPTION_POINTERS ExceptionPointers, PLONG Counter) {
|
||||
PEXCEPTION_RECORD ExceptionRecord;
|
||||
|
||||
ExceptionRecord = ExceptionPointers->ExceptionRecord;
|
||||
if ((ExceptionRecord->ExceptionCode == EXCEPTION_EXECUTE_HANDLER) &&
|
||||
((ExceptionRecord->ExceptionFlags & 0x10) == 0)) {
|
||||
/* set counter = 53 */
|
||||
*Counter += 11;
|
||||
return 1;
|
||||
} else {
|
||||
*Counter += 13;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
Counter += 1;
|
||||
except1(&Counter);
|
||||
}
|
||||
except(except2(GetExceptionInformation(), &Counter)) {
|
||||
/* set counter = 55 */
|
||||
Counter += 2;
|
||||
}
|
||||
endtry
|
||||
}
|
||||
except(1) { Counter += 3; }
|
||||
endtry
|
||||
|
||||
if (Counter != 55) {
|
||||
printf("TEST 27 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
42
modules/rostests/apitests/compiler/ms/seh/seh0028.c
Normal file
42
modules/rostests/apitests/compiler/ms/seh/seh0028.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0028.c";
|
||||
int perfect;
|
||||
|
||||
void addtwo(long First, long Second, long *Place) {
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
|
||||
/* not executed due to exception being raised */
|
||||
*Place = First + Second;
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
Counter += 1;
|
||||
addtwo(0x7fff0000, 0x10000, &Counter);
|
||||
}
|
||||
except((GetExceptionCode() == (STATUS_INTEGER_OVERFLOW)) ? 1 : 0)
|
||||
/* 1==EXECUTE HANDLER after unwinding */
|
||||
{
|
||||
/* set counter = 2 */
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 28 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
70
modules/rostests/apitests/compiler/ms/seh/seh0029.c
Normal file
70
modules/rostests/apitests/compiler/ms/seh/seh0029.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
#define faill()
|
||||
#define startest()
|
||||
#define finish()
|
||||
|
||||
char test[] = "SEH0029.c";
|
||||
int perfect;
|
||||
|
||||
void AccessViolation(PLONG BlackHole, PLONG BadAddress) {
|
||||
*BlackHole += *BadAddress;
|
||||
return;
|
||||
}
|
||||
|
||||
int main() {
|
||||
PCHAR BadByte;
|
||||
PLONG BlackHole;
|
||||
LONG Counter;
|
||||
DWORD ExceptionCode;
|
||||
|
||||
BadByte = (PCHAR)((PVOID)0);
|
||||
BadByte += 1;
|
||||
BlackHole = &Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
/* set counter = 1 */
|
||||
Counter += 1;
|
||||
/*
|
||||
* create a DATA MISALIGNMENT ERROR by passing
|
||||
* a Byte into a LONG. Passing (PLONG)1.
|
||||
*/
|
||||
AccessViolation(BlackHole, (PLONG)BadByte);
|
||||
}
|
||||
except((ExceptionCode = GetExceptionCode()),
|
||||
((ExceptionCode == STATUS_DATATYPE_MISALIGNMENT)
|
||||
? 1
|
||||
: ((ExceptionCode == STATUS_ACCESS_VIOLATION) ? 1 : 0))) {
|
||||
Counter += 1;
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 29 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
} else {
|
||||
/*
|
||||
ISSUE-REVIEW:a-sibyvi-2003/10/20
|
||||
This test was expecting STATUS_DATATYPE_MISALIGNMENT
|
||||
which is no longer true for UTC and Phoenix. So changing the test
|
||||
to expect Acces Violation instead.
|
||||
ISSUE-REVIEW:v-simwal-2011-01-25 Either MISALIGNMENT or ACCESS VIOLATION
|
||||
counts as a pass.
|
||||
*/
|
||||
if ((ExceptionCode != STATUS_ACCESS_VIOLATION) &&
|
||||
(ExceptionCode != STATUS_DATATYPE_MISALIGNMENT)) {
|
||||
printf(
|
||||
"TEST 29 FAILED. Expected ACCESS_VIOLATION, got exception = %d\n\r",
|
||||
ExceptionCode);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
39
modules/rostests/apitests/compiler/ms/seh/seh0030.c
Normal file
39
modules/rostests/apitests/compiler/ms/seh/seh0030.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0030.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 0) {
|
||||
/* do nothing if index1 is even */
|
||||
continue;
|
||||
} else {
|
||||
/* add 1 to counter when Index1 is odd */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
except(1) { Counter += 40; }
|
||||
endtry
|
||||
/* add 2 to counter when Index1 is odd */
|
||||
Counter += 2;
|
||||
}
|
||||
|
||||
if (Counter != 15) {
|
||||
printf("TEST 30 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
45
modules/rostests/apitests/compiler/ms/seh/seh0031.c
Normal file
45
modules/rostests/apitests/compiler/ms/seh/seh0031.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0031.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 0) {
|
||||
/* continue if index is odd */
|
||||
continue;
|
||||
} else {
|
||||
/* add 1 to counter if Index is odd */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/*
|
||||
* always hit the finally case, even if "continue"
|
||||
* and add 2 to counter
|
||||
*/
|
||||
Counter += 2;
|
||||
}
|
||||
endtry
|
||||
/* only add 3 if INdex1 is odd */
|
||||
Counter += 3;
|
||||
}
|
||||
|
||||
if (Counter != 40) {
|
||||
printf("TEST 31 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
44
modules/rostests/apitests/compiler/ms/seh/seh0032.c
Normal file
44
modules/rostests/apitests/compiler/ms/seh/seh0032.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0032.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 0) {
|
||||
continue;
|
||||
} else {
|
||||
/* add 1 to counter is Index1 is odd */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
except(1) { Counter += 10; }
|
||||
endtry
|
||||
/* add 2 to counter if index1 is odd */
|
||||
Counter += 2;
|
||||
}
|
||||
except(1) { Counter += 20; }
|
||||
endtry
|
||||
/* add 3 to counter if index1 is odd */
|
||||
Counter += 3;
|
||||
}
|
||||
|
||||
if (Counter != 30) {
|
||||
printf("TEST 32 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
56
modules/rostests/apitests/compiler/ms/seh/seh0033.c
Normal file
56
modules/rostests/apitests/compiler/ms/seh/seh0033.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
#define faill()
|
||||
#define startest()
|
||||
#define finish()
|
||||
|
||||
char test[] = "SEH0033.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
startest();
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 0) {
|
||||
continue;
|
||||
} else {
|
||||
/* add 1 to counter is Index1 is odd */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* add 2 to counter always */
|
||||
Counter += 2;
|
||||
}
|
||||
endtry
|
||||
/* addd 3 to connter if Index1 is odd */
|
||||
Counter += 3;
|
||||
}
|
||||
finally {
|
||||
/* add 4 to counter always */
|
||||
Counter += 4;
|
||||
}
|
||||
endtry
|
||||
/* add 5 to counter if index1 is odd */
|
||||
Counter += 5;
|
||||
}
|
||||
|
||||
if (Counter != 105) {
|
||||
printf("TEST 33 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
48
modules/rostests/apitests/compiler/ms/seh/seh0034.c
Normal file
48
modules/rostests/apitests/compiler/ms/seh/seh0034.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
#define faill()
|
||||
#define startest()
|
||||
#define finish()
|
||||
|
||||
char test[] = "SEH0034.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
startest();
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 0) {
|
||||
/* add 1 to counter if Index1 is odd */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* add 2 to counter always */
|
||||
Counter += 2;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
/* never gets executed due to continue in finally */
|
||||
Counter += 4;
|
||||
}
|
||||
|
||||
if (Counter != 25) {
|
||||
printf("TEST 34 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
55
modules/rostests/apitests/compiler/ms/seh/seh0035.c
Normal file
55
modules/rostests/apitests/compiler/ms/seh/seh0035.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
#define faill()
|
||||
#define startest()
|
||||
#define finish()
|
||||
|
||||
char test[] = "SEH0035.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 0) {
|
||||
/* add 1 to counter if INdex1 is odd */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* always add 2 to counter */
|
||||
Counter += 2;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
/* never get here due to continue */
|
||||
Counter += 4;
|
||||
}
|
||||
finally {
|
||||
/* always add 5 to counter */
|
||||
Counter += 5;
|
||||
}
|
||||
endtry
|
||||
/* never get here due to continue */
|
||||
Counter += 6;
|
||||
}
|
||||
|
||||
if (Counter != 75) {
|
||||
printf("TEST 35 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
51
modules/rostests/apitests/compiler/ms/seh/seh0036.c
Normal file
51
modules/rostests/apitests/compiler/ms/seh/seh0036.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0036.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 0) {
|
||||
/* add 1 if index1 is odd */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* always add 2 */
|
||||
Counter += 2;
|
||||
}
|
||||
endtry
|
||||
/* always add 4 */
|
||||
Counter += 4;
|
||||
}
|
||||
finally {
|
||||
/* always add 5 */
|
||||
Counter += 5;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
/* never get here due to continue */
|
||||
Counter += 6;
|
||||
}
|
||||
|
||||
if (Counter != 115) {
|
||||
printf("TEST 36 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
38
modules/rostests/apitests/compiler/ms/seh/seh0037.c
Normal file
38
modules/rostests/apitests/compiler/ms/seh/seh0037.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0037.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
break;
|
||||
} else {
|
||||
/* only add when Index is 0 */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
except(1) { Counter += 40; }
|
||||
endtry
|
||||
/* only add when Index is 0 */
|
||||
Counter += 2;
|
||||
}
|
||||
|
||||
if (Counter != 3) {
|
||||
printf("TEST 37 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
42
modules/rostests/apitests/compiler/ms/seh/seh0038.c
Normal file
42
modules/rostests/apitests/compiler/ms/seh/seh0038.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0038.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/* end the for loop when index is 1 */
|
||||
break;
|
||||
} else {
|
||||
/* add 1 to counter when Index1 is 0 */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* add 2 to counter when Index1 is 0 and 1 */
|
||||
Counter += 2;
|
||||
}
|
||||
endtry
|
||||
/* add 3 to counter when Index1 is 0 */
|
||||
Counter += 3;
|
||||
}
|
||||
|
||||
if (Counter != 8) {
|
||||
printf("TEST 38 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
43
modules/rostests/apitests/compiler/ms/seh/seh0039.c
Normal file
43
modules/rostests/apitests/compiler/ms/seh/seh0039.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0039.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/* end the for loop when index is 1 */
|
||||
break;
|
||||
} else {
|
||||
/* only add 1 if Index1 is 0 */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
except(1) { Counter += 10; } endtry
|
||||
/* only add 2 if index1 is 0 */
|
||||
Counter += 2;
|
||||
}
|
||||
except(1) { Counter += 20; } endtry
|
||||
/* only add 3 if index1 is 0 */
|
||||
Counter += 3;
|
||||
}
|
||||
|
||||
if (Counter != 6) {
|
||||
printf("TEST 39 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
57
modules/rostests/apitests/compiler/ms/seh/seh0040.c
Normal file
57
modules/rostests/apitests/compiler/ms/seh/seh0040.c
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0040.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/* end the loop when Index1 is 1 */
|
||||
break;
|
||||
} else {
|
||||
/* add 1 to Counter if Index is 0 */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/*
|
||||
* add 1 to Counter if Index is 0
|
||||
* and after "break" when Index1 is 1
|
||||
*/
|
||||
Counter += 2;
|
||||
}
|
||||
endtry
|
||||
/* add 1 to Counter if Index is 0 */
|
||||
Counter += 3;
|
||||
}
|
||||
finally {
|
||||
/*
|
||||
* add 1 to Counter if Index is 0
|
||||
* and after "break" when Index1 is 1
|
||||
*/
|
||||
Counter += 4;
|
||||
}
|
||||
endtry
|
||||
/* add 1 to Counter if Index is 0 */
|
||||
Counter += 5;
|
||||
}
|
||||
|
||||
if (Counter != 21) {
|
||||
printf("TEST 40 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
48
modules/rostests/apitests/compiler/ms/seh/seh0041.c
Normal file
48
modules/rostests/apitests/compiler/ms/seh/seh0041.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0041.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/*
|
||||
* never gets here. break in finally
|
||||
* case when Index1 is 0
|
||||
*/
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* set counter to 2 */
|
||||
Counter += 2;
|
||||
/* end loop */
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
#ifndef _MSC_VER
|
||||
break;
|
||||
#endif
|
||||
Counter += 4;
|
||||
}
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 41 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
56
modules/rostests/apitests/compiler/ms/seh/seh0042.c
Normal file
56
modules/rostests/apitests/compiler/ms/seh/seh0042.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0042.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/*
|
||||
* never gets here, break in finally
|
||||
* when Index1 is 0
|
||||
*/
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* set counter = 2 */
|
||||
Counter += 2;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
#ifndef _MSC_VER
|
||||
break;
|
||||
#endif
|
||||
/* never gets here */
|
||||
Counter += 4;
|
||||
}
|
||||
finally {
|
||||
/* adds 5 to counter while unwinding from "break" */
|
||||
Counter += 5;
|
||||
}
|
||||
endtry
|
||||
Counter += 6;
|
||||
}
|
||||
|
||||
if (Counter != 7) {
|
||||
printf("TEST 42 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
55
modules/rostests/apitests/compiler/ms/seh/seh0043.c
Normal file
55
modules/rostests/apitests/compiler/ms/seh/seh0043.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0043.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/* never gets here, "break"'s on Index1=0 */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* set counter to 2 */
|
||||
Counter += 2;
|
||||
}
|
||||
endtry
|
||||
/* set counter = 6 */
|
||||
Counter += 4;
|
||||
}
|
||||
finally {
|
||||
/* set counter = 11 */
|
||||
Counter += 5;
|
||||
/* end loop */
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
#ifndef _MSC_VER
|
||||
break;
|
||||
#endif
|
||||
/* never gets here due to "break" */
|
||||
Counter += 6;
|
||||
}
|
||||
|
||||
if (Counter != 11) {
|
||||
printf("TEST 43 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
52
modules/rostests/apitests/compiler/ms/seh/seh0044.c
Normal file
52
modules/rostests/apitests/compiler/ms/seh/seh0044.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0044.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
ULONG Index2 = 1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
Index1 = 1;
|
||||
|
||||
switch (Index2) {
|
||||
case 0:
|
||||
/* since Index2 starts as 1, should never get here */
|
||||
Counter += 100;
|
||||
break;
|
||||
case 1:
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/*
|
||||
* break out of switch stmt.
|
||||
* leaving COunter as 0
|
||||
*/
|
||||
break;
|
||||
} else {
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
except(1)
|
||||
/* never gets here. No exception occurs */
|
||||
{
|
||||
Counter += 40;
|
||||
}
|
||||
endtry
|
||||
Counter += 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Counter != 0) {
|
||||
printf("TEST 44 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
50
modules/rostests/apitests/compiler/ms/seh/seh0045.c
Normal file
50
modules/rostests/apitests/compiler/ms/seh/seh0045.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0045.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
ULONG Index2 = 1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
Index1 = 1;
|
||||
|
||||
switch (Index2) {
|
||||
case 0:
|
||||
/* never gets here, Index2 is 1 */
|
||||
Counter += 100;
|
||||
break;
|
||||
case 1:
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/* break out of switch stmt */
|
||||
break;
|
||||
} else {
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/*
|
||||
* set counter to 2 after "break"
|
||||
* in 'case 1'
|
||||
*/
|
||||
Counter += 2;
|
||||
}
|
||||
endtry
|
||||
Counter += 3;
|
||||
}
|
||||
|
||||
if (Counter != 2) {
|
||||
printf("TEST 45 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
56
modules/rostests/apitests/compiler/ms/seh/seh0046.c
Normal file
56
modules/rostests/apitests/compiler/ms/seh/seh0046.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0046.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
ULONG Index2 = 1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
Index1 = 1;
|
||||
|
||||
switch (Index2) {
|
||||
case 0:
|
||||
Counter += 100;
|
||||
break;
|
||||
case 1:
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/* break out of switchy stmt. */
|
||||
break;
|
||||
} else {
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
except(1) {
|
||||
/* no exception occurs, never gets here */
|
||||
Counter += 10;
|
||||
}
|
||||
endtry
|
||||
/* "break" keeps you from getting here */
|
||||
Counter += 2;
|
||||
}
|
||||
except(1) {
|
||||
/* no exception occurs, never gets here */
|
||||
Counter += 20;
|
||||
}
|
||||
endtry
|
||||
/* "break" keeps you from getting here */
|
||||
Counter += 3;
|
||||
}
|
||||
|
||||
if (Counter != 0) {
|
||||
printf("TEST 46 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
55
modules/rostests/apitests/compiler/ms/seh/seh0047.c
Normal file
55
modules/rostests/apitests/compiler/ms/seh/seh0047.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0047.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
ULONG Index2 = 1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
Index1 = 1;
|
||||
|
||||
switch (Index2) {
|
||||
case 0:
|
||||
/* never gets here */
|
||||
Counter += 100;
|
||||
break;
|
||||
case 1:
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/* break out of switch stmt. */
|
||||
break;
|
||||
} else {
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* set counter to 2 after "break" */
|
||||
Counter += 2;
|
||||
}
|
||||
endtry
|
||||
Counter += 3;
|
||||
}
|
||||
finally {
|
||||
/* set counter to 4 after break in nested try/finally */
|
||||
Counter += 4;
|
||||
}
|
||||
endtry
|
||||
Counter += 5;
|
||||
}
|
||||
|
||||
if (Counter != 6) {
|
||||
printf("TEST 47 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
52
modules/rostests/apitests/compiler/ms/seh/seh0048.c
Normal file
52
modules/rostests/apitests/compiler/ms/seh/seh0048.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0048.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
ULONG Index2 = 1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
Index1 = 1;
|
||||
|
||||
switch (Index2) {
|
||||
case 0:
|
||||
/* never gets here, Index2 is 2 */
|
||||
Counter += 100;
|
||||
break;
|
||||
case 1:
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/* set counter to 1 */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* ste counter to 3 and rbeak out of switch */
|
||||
Counter += 2;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
#ifndef _MSC_VER
|
||||
break;
|
||||
#endif
|
||||
/* never gets here due to break */
|
||||
Counter += 4;
|
||||
}
|
||||
|
||||
if (Counter != 3) {
|
||||
printf("TEST 48 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
60
modules/rostests/apitests/compiler/ms/seh/seh0049.c
Normal file
60
modules/rostests/apitests/compiler/ms/seh/seh0049.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0049.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
ULONG Index2 = 1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
Index1 = 1;
|
||||
|
||||
switch (Index2) {
|
||||
case 0:
|
||||
Counter += 100;
|
||||
break;
|
||||
case 1:
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
/* set counter to 1 */
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
/* set counter to 3 */
|
||||
Counter += 2;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
#ifndef _MSC_VER
|
||||
break;
|
||||
#endif
|
||||
/* never get here due to break */
|
||||
Counter += 4;
|
||||
}
|
||||
finally {
|
||||
/* set counter to 8 */
|
||||
Counter += 5;
|
||||
}
|
||||
endtry
|
||||
/* never get hre due to break */
|
||||
Counter += 6;
|
||||
}
|
||||
|
||||
if (Counter != 8) {
|
||||
printf("TEST 49 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
52
modules/rostests/apitests/compiler/ms/seh/seh0050.c
Normal file
52
modules/rostests/apitests/compiler/ms/seh/seh0050.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0050.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
ULONG Index1;
|
||||
ULONG Index2 = 1;
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
Index1 = 1;
|
||||
|
||||
switch (Index2) {
|
||||
case 0:
|
||||
Counter += 100;
|
||||
break;
|
||||
case 1:
|
||||
try {
|
||||
try {
|
||||
if ((Index1 & 0x1) == 1) {
|
||||
Counter += 1;
|
||||
}
|
||||
}
|
||||
finally { Counter += 2; } endtry
|
||||
Counter += 4;
|
||||
}
|
||||
finally {
|
||||
Counter += 5;
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
endtry
|
||||
#ifndef _MSC_VER
|
||||
break;
|
||||
#endif
|
||||
Counter += 6;
|
||||
}
|
||||
|
||||
if (Counter != 12) {
|
||||
printf("TEST 50 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
39
modules/rostests/apitests/compiler/ms/seh/seh0051.c
Normal file
39
modules/rostests/apitests/compiler/ms/seh/seh0051.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0051.c";
|
||||
int perfect;
|
||||
|
||||
LONG Echo(LONG Value) { return Value; }
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
if (Echo(Counter) == Counter) {
|
||||
Counter += 3;
|
||||
leave;
|
||||
} else {
|
||||
Counter += 100;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (AbnormalTermination() == 0) {
|
||||
Counter += 5;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 8) {
|
||||
printf("test 51 failed. Counter = %d\n", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
41
modules/rostests/apitests/compiler/ms/seh/seh0052.c
Normal file
41
modules/rostests/apitests/compiler/ms/seh/seh0052.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "seh0052.c";
|
||||
int perfect;
|
||||
|
||||
LONG Echo(LONG Value) { return Value; }
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
ULONG Index1;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
for (Index1 = 0; Index1 < 10; Index1 += 1) {
|
||||
if (Echo(Index1) == Index1) {
|
||||
Counter += 3;
|
||||
leave;
|
||||
}
|
||||
Counter += 100;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (AbnormalTermination() == 0) {
|
||||
Counter += 5;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 8) {
|
||||
printf("TEST 52 FAILED, Counter = %d\n", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
45
modules/rostests/apitests/compiler/ms/seh/seh0053.c
Normal file
45
modules/rostests/apitests/compiler/ms/seh/seh0053.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "seh0053.c";
|
||||
int perfect;
|
||||
|
||||
#define BLUE 0
|
||||
#define RED 1
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
ULONG Index2 = RED;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
switch (Index2) {
|
||||
case BLUE:
|
||||
break;
|
||||
|
||||
case RED:
|
||||
Counter += 3;
|
||||
leave;
|
||||
}
|
||||
|
||||
Counter += 100;
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() == FALSE) {
|
||||
Counter += 5;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 8) {
|
||||
printf("TEST 53 FAILED, Counter = %d\n", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
56
modules/rostests/apitests/compiler/ms/seh/seh0054.c
Normal file
56
modules/rostests/apitests/compiler/ms/seh/seh0054.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "seh0054.c";
|
||||
int perfect;
|
||||
|
||||
LONG Echo(LONG Value) { return Value; }
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
try {
|
||||
if (Echo(Counter) == Counter) {
|
||||
Counter += 3;
|
||||
leave;
|
||||
|
||||
} else {
|
||||
Counter += 100;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() == FALSE) {
|
||||
Counter += 5;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Echo(Counter) == Counter) {
|
||||
Counter += 3;
|
||||
leave;
|
||||
|
||||
} else {
|
||||
Counter += 100;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() == FALSE) {
|
||||
Counter += 5;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 16) {
|
||||
printf("TEST 54 FAILED, Counter = %d\n", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
51
modules/rostests/apitests/compiler/ms/seh/seh0055.c
Normal file
51
modules/rostests/apitests/compiler/ms/seh/seh0055.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "seh0055.c";
|
||||
int perfect;
|
||||
|
||||
LONG Echo(LONG Value) { return Value; }
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
try {
|
||||
if (Echo(Counter) == Counter) {
|
||||
Counter += 3;
|
||||
leave;
|
||||
|
||||
} else {
|
||||
Counter += 100;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() == FALSE) {
|
||||
Counter += 5;
|
||||
leave;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
Counter += 100;
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() == FALSE) {
|
||||
Counter += 5;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 13) {
|
||||
printf("TEST 55 FAILED, Counter = %d\n", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
40
modules/rostests/apitests/compiler/ms/seh/seh0056.c
Normal file
40
modules/rostests/apitests/compiler/ms/seh/seh0056.c
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0056.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
Counter += 1;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /* no flags */
|
||||
0, NULL);
|
||||
}
|
||||
except(Counter) {
|
||||
try {
|
||||
Counter += 3;
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() == FALSE) {
|
||||
Counter += 5;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 9) {
|
||||
printf("TEST 56 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
40
modules/rostests/apitests/compiler/ms/seh/seh0057.c
Normal file
40
modules/rostests/apitests/compiler/ms/seh/seh0057.c
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "seh0057.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
Counter += 1;
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() == FALSE) {
|
||||
try {
|
||||
Counter += 3;
|
||||
}
|
||||
finally {
|
||||
if (abnormal_termination() == FALSE) {
|
||||
Counter += 5;
|
||||
}
|
||||
}
|
||||
endtry
|
||||
}
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 9) {
|
||||
printf("TEST 57 FAILED, Counter = %d\n", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
38
modules/rostests/apitests/compiler/ms/seh/seh0058.c
Normal file
38
modules/rostests/apitests/compiler/ms/seh/seh0058.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
#include <windows.h>
|
||||
#include "seh.h"
|
||||
|
||||
char test[] = "SEH0058.c";
|
||||
int perfect;
|
||||
|
||||
int main() {
|
||||
LONG Counter;
|
||||
|
||||
Counter = 0;
|
||||
|
||||
try {
|
||||
Counter += 1;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /* no flags */
|
||||
0, NULL);
|
||||
}
|
||||
except(Counter) {
|
||||
try {
|
||||
Counter += 3;
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /* no flags */
|
||||
0, NULL);
|
||||
}
|
||||
except(Counter - 3) { Counter += 5; }
|
||||
endtry
|
||||
}
|
||||
endtry
|
||||
|
||||
if (Counter != 9) {
|
||||
printf("TEST 58 FAILED. Counter = %d\n\r", Counter);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
25
modules/rostests/apitests/compiler/ms/seh/seh_noreturn.c
Normal file
25
modules/rostests/apitests/compiler/ms/seh/seh_noreturn.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
// SEH + no-return (explicit)
|
||||
|
||||
__declspec(noreturn) int bar(int);
|
||||
|
||||
void foo(int arg) { bar(arg); }
|
||||
|
||||
int filter() { return bar(3); }
|
||||
|
||||
void moo1(int arg) {
|
||||
__try { bar(arg); }
|
||||
__except(filter()) { bar(1); }
|
||||
|
||||
bar(0);
|
||||
}
|
||||
|
||||
void moo2(int arg) {
|
||||
__try { bar(arg); }
|
||||
__finally { bar(2); }
|
||||
|
||||
bar(0);
|
||||
}
|
974
modules/rostests/apitests/compiler/ms/seh/sehframes.cpp
Normal file
974
modules/rostests/apitests/compiler/ms/seh/sehframes.cpp
Normal file
|
@ -0,0 +1,974 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for
|
||||
// full license information.
|
||||
|
||||
/*
|
||||
* Exercise lots of different kinds of C++ EH frames. Compile this with
|
||||
* every combination of opts you can to stress the C++ EH frame code in the
|
||||
* backend.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <stdarg.h>
|
||||
#include <memory.h>
|
||||
|
||||
#ifndef ALIGN
|
||||
#define ALIGN 64
|
||||
#endif
|
||||
|
||||
#define ARG(x) &x, sizeof(x)
|
||||
#define ARG2(x) ARG(x), ARG(x)
|
||||
#define ARG5(x) ARG(x), ARG(x), ARG(x), ARG(x), ARG(x)
|
||||
|
||||
extern int TestFunc(int, ...);
|
||||
|
||||
int failures;
|
||||
|
||||
int one = 1;
|
||||
int zero = 0;
|
||||
|
||||
size_t global = 16;
|
||||
volatile bool TestFuncThrows;
|
||||
|
||||
struct SmallObj {
|
||||
int x;
|
||||
};
|
||||
|
||||
struct BigObj {
|
||||
char x[1024];
|
||||
};
|
||||
|
||||
int Simple(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
SmallObj f;
|
||||
__try { TestFunc(1, ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
__finally { res = TestFunc(1, ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int Try(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
SmallObj f;
|
||||
__try { res = TestFunc(1, ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
__except(TestFunc(2, ARG(f), ARG(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookie(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
SmallObj f;
|
||||
__try { TestFunc(1, ARG(buf), ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
__finally { res = TestFunc(1, ARG(buf), ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookie(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
SmallObj f;
|
||||
__try { res = TestFunc(1, ARG(buf), ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
__except(TestFunc(2, ARG(buf), ARG(f), ARG(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int Align(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
__try { TestFunc(1, ARG(d), ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
__finally { res = TestFunc(1, ARG(d), ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndAlign(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
__try { res = TestFunc(1, ARG(d), ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
__except(TestFunc(2, ARG(d), ARG(f), ARG(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(d), ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlign(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
__try { TestFunc(1, ARG(buf), ARG(d), ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
__finally {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlign(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(buf), ARG(d), ARG(f), ARG(res), ARG(arg), NULL),
|
||||
zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(d), ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int Alloca(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
SmallObj f;
|
||||
__try {
|
||||
TestFunc(1, _alloca(global), global, ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
__finally { res = TestFunc(1, ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndAlloca(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
SmallObj f;
|
||||
__try {
|
||||
res =
|
||||
TestFunc(1, _alloca(global), global, ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(f), ARG(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlloca(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
SmallObj f;
|
||||
__try {
|
||||
TestFunc(1, ARG(buf), _alloca(global), global, ARG(f), ARG(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
__finally { res = TestFunc(1, ARG(buf), ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlloca(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
SmallObj f;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(buf), _alloca(global), global, ARG(f), ARG(res),
|
||||
ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(buf), ARG(f), ARG(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AlignAndAlloca(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
__try {
|
||||
TestFunc(1, ARG(d), _alloca(global), global, ARG(f), ARG(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
__finally { res = TestFunc(1, ARG(d), ARG(f), ARG(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndAlignAndAlloca(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(d), _alloca(global), global, ARG(f), ARG(res),
|
||||
ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(d), ARG(f), ARG(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(d), ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlignAndAlloca(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
__try {
|
||||
TestFunc(1, ARG(buf), ARG(d), _alloca(global), global, ARG(f), ARG(res),
|
||||
ARG(arg), NULL);
|
||||
}
|
||||
__finally {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlignAndAlloca(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
SmallObj f;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), _alloca(global), global, ARG(f),
|
||||
ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(buf), ARG(d), ARG(f), ARG(res), ARG(arg), NULL),
|
||||
zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(d), ARG(f), ARG(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* The BigLocals variants try to trigger EBP adjustment, and generally do in
|
||||
* the /O1 case for the non-aligned stacks.
|
||||
*/
|
||||
|
||||
int BigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
BigObj f1;
|
||||
__try { TestFunc(1, ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
__finally { res = TestFunc(1, ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
BigObj f1;
|
||||
__try { res = TestFunc(1, ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
__except(TestFunc(2, ARG(f1), ARG5(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
__try { TestFunc(1, ARG(buf), ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
__finally { res = TestFunc(1, ARG(buf), ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
__try { res = TestFunc(1, ARG(buf), ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
__except(TestFunc(2, ARG(buf), ARG(f1), ARG5(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AlignAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try { TestFunc(1, ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
__finally { res = TestFunc(1, ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndAlignAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try { res = TestFunc(1, ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
__except(TestFunc(2, ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlignAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try { TestFunc(1, ARG(buf), ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
__finally {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlignAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(buf), ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL),
|
||||
zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AllocaAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
BigObj f1;
|
||||
__try {
|
||||
TestFunc(1, _alloca(global), global, ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
__finally { res = TestFunc(1, ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndAllocaAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, _alloca(global), global, ARG(f1), ARG5(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(f1), ARG5(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAllocaAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
__try {
|
||||
TestFunc(1, ARG(buf), _alloca(global), global, ARG(f1), ARG5(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
__finally { res = TestFunc(1, ARG(buf), ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAllocaAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(buf), _alloca(global), global, ARG(f1), ARG5(res),
|
||||
ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(buf), ARG(f1), ARG5(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AlignAndAllocaAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
TestFunc(1, ARG(d), _alloca(global), global, ARG(f1), ARG5(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
__finally { res = TestFunc(1, ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndAlignAndAllocaAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(d), _alloca(global), global, ARG(f1), ARG5(res),
|
||||
ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlignAndAllocaAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
TestFunc(1, ARG(buf), ARG(d), _alloca(global), global, ARG(f1), ARG5(res),
|
||||
ARG(arg), NULL);
|
||||
}
|
||||
__finally {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlignAndAllocaAndBigLocals(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), _alloca(global), global, ARG(f1),
|
||||
ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(buf), ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL),
|
||||
zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(d), ARG(f1), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* The EbpAdj variants try to trigger EBP adjustment, and generally do in
|
||||
* the /O1 case for the non-aligned stacks. They add a non-GS-protected
|
||||
* buffer so the EH node is far from both sides of the local variable
|
||||
* allocation. Doesn't seem to add any testing over what the BigLocals cases
|
||||
* already do.
|
||||
*/
|
||||
|
||||
int EbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
BigObj f1;
|
||||
__try { TestFunc(1, ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL); }
|
||||
__finally { res = TestFunc(1, ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
BigObj f1;
|
||||
__try { res = TestFunc(1, ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL); }
|
||||
__except(TestFunc(2, ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
__try { TestFunc(1, ARG(buf), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL); }
|
||||
__finally {
|
||||
res = TestFunc(1, ARG(buf), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(buf), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(buf), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL),
|
||||
zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AlignAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try { TestFunc(1, ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL); }
|
||||
__finally {
|
||||
res = TestFunc(1, ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndAlignAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL),
|
||||
zero) {
|
||||
res = TestFunc(2, ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlignAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
TestFunc(1, ARG(buf), ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
__finally {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlignAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(buf), ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg),
|
||||
NULL),
|
||||
zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AllocaAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
BigObj f1;
|
||||
__try {
|
||||
TestFunc(1, _alloca(global), global, ARG(f1), ARG2(a), ARG5(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
__finally { res = TestFunc(1, ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL); }
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndAllocaAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, _alloca(global), global, ARG(f1), ARG2(a), ARG5(res),
|
||||
ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL), zero) {
|
||||
res = TestFunc(2, ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAllocaAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
__try {
|
||||
TestFunc(1, ARG(buf), _alloca(global), global, ARG(f1), ARG2(a), ARG5(res),
|
||||
ARG(arg), NULL);
|
||||
}
|
||||
__finally {
|
||||
res = TestFunc(1, ARG(buf), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAllocaAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
char buf[16];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(buf), _alloca(global), global, ARG(f1), ARG2(a),
|
||||
ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(buf), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL),
|
||||
zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int AlignAndAllocaAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
TestFunc(1, ARG(d), _alloca(global), global, ARG(f1), ARG2(a), ARG5(res),
|
||||
ARG(arg), NULL);
|
||||
}
|
||||
__finally {
|
||||
res = TestFunc(1, ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndAlignAndAllocaAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(d), _alloca(global), global, ARG(f1), ARG2(a),
|
||||
ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL),
|
||||
zero) {
|
||||
res = TestFunc(2, ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSCookieAndAlignAndAllocaAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
TestFunc(1, ARG(buf), ARG(d), _alloca(global), global, ARG(f1), ARG2(a),
|
||||
ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
__finally {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int TryAndGSCookieAndAlignAndAllocaAndEbpAdj(int arg) {
|
||||
puts(__FUNCTION__);
|
||||
int res = 0;
|
||||
int a[512];
|
||||
char buf[16];
|
||||
__declspec(align(ALIGN)) double d[4];
|
||||
BigObj f1;
|
||||
__try {
|
||||
res = TestFunc(1, ARG(buf), ARG(d), _alloca(global), global, ARG(f1),
|
||||
ARG2(a), ARG5(res), ARG(arg), NULL);
|
||||
}
|
||||
__except(TestFunc(2, ARG(buf), ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg),
|
||||
NULL),
|
||||
zero) {
|
||||
res = TestFunc(2, ARG(buf), ARG(d), ARG(f1), ARG2(a), ARG5(res), ARG(arg),
|
||||
NULL);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
__declspec(noinline) int TestFunc(int x, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, x);
|
||||
|
||||
for (;;) {
|
||||
void *pbuf = va_arg(ap, void *);
|
||||
if (pbuf == NULL) {
|
||||
break;
|
||||
}
|
||||
size_t len = va_arg(ap, size_t);
|
||||
memset(pbuf, 0, len);
|
||||
}
|
||||
|
||||
if (TestFuncThrows) {
|
||||
TestFuncThrows = false;
|
||||
*(volatile int *)0;
|
||||
}
|
||||
|
||||
return static_cast<int>(global);
|
||||
}
|
||||
|
||||
void RunTests() {
|
||||
puts("Test pass 1 - no exceptions");
|
||||
|
||||
__try {
|
||||
Simple(1);
|
||||
Try(1);
|
||||
GSCookie(1);
|
||||
TryAndGSCookie(1);
|
||||
Align(1);
|
||||
TryAndAlign(1);
|
||||
GSCookieAndAlign(1);
|
||||
TryAndGSCookieAndAlign(1);
|
||||
Alloca(1);
|
||||
TryAndAlloca(1);
|
||||
GSCookieAndAlloca(1);
|
||||
TryAndGSCookieAndAlloca(1);
|
||||
AlignAndAlloca(1);
|
||||
TryAndAlignAndAlloca(1);
|
||||
GSCookieAndAlignAndAlloca(1);
|
||||
TryAndGSCookieAndAlignAndAlloca(1);
|
||||
BigLocals(1);
|
||||
TryAndBigLocals(1);
|
||||
GSCookieAndBigLocals(1);
|
||||
TryAndGSCookieAndBigLocals(1);
|
||||
AlignAndBigLocals(1);
|
||||
TryAndAlignAndBigLocals(1);
|
||||
GSCookieAndAlignAndBigLocals(1);
|
||||
TryAndGSCookieAndAlignAndBigLocals(1);
|
||||
AllocaAndBigLocals(1);
|
||||
TryAndAllocaAndBigLocals(1);
|
||||
GSCookieAndAllocaAndBigLocals(1);
|
||||
TryAndGSCookieAndAllocaAndBigLocals(1);
|
||||
AlignAndAllocaAndBigLocals(1);
|
||||
TryAndAlignAndAllocaAndBigLocals(1);
|
||||
GSCookieAndAlignAndAllocaAndBigLocals(1);
|
||||
TryAndGSCookieAndAlignAndAllocaAndBigLocals(1);
|
||||
EbpAdj(1);
|
||||
TryAndEbpAdj(1);
|
||||
GSCookieAndEbpAdj(1);
|
||||
TryAndGSCookieAndEbpAdj(1);
|
||||
AlignAndEbpAdj(1);
|
||||
TryAndAlignAndEbpAdj(1);
|
||||
GSCookieAndAlignAndEbpAdj(1);
|
||||
TryAndGSCookieAndAlignAndEbpAdj(1);
|
||||
AllocaAndEbpAdj(1);
|
||||
TryAndAllocaAndEbpAdj(1);
|
||||
GSCookieAndAllocaAndEbpAdj(1);
|
||||
TryAndGSCookieAndAllocaAndEbpAdj(1);
|
||||
AlignAndAllocaAndEbpAdj(1);
|
||||
TryAndAlignAndAllocaAndEbpAdj(1);
|
||||
GSCookieAndAlignAndAllocaAndEbpAdj(1);
|
||||
TryAndGSCookieAndAlignAndAllocaAndEbpAdj(1);
|
||||
}
|
||||
__except(one) {
|
||||
puts("ERROR - exception not expected");
|
||||
++failures;
|
||||
}
|
||||
|
||||
puts("Test pass 2 - exceptions");
|
||||
|
||||
for (int i = 0; i < 48; ++i) {
|
||||
TestFuncThrows = true;
|
||||
bool caught = false;
|
||||
__try {
|
||||
switch (i) {
|
||||
case 0:
|
||||
Simple(1);
|
||||
break;
|
||||
case 1:
|
||||
Try(1);
|
||||
break;
|
||||
case 2:
|
||||
GSCookie(1);
|
||||
break;
|
||||
case 3:
|
||||
TryAndGSCookie(1);
|
||||
break;
|
||||
case 4:
|
||||
Align(1);
|
||||
break;
|
||||
case 5:
|
||||
TryAndAlign(1);
|
||||
break;
|
||||
case 6:
|
||||
GSCookieAndAlign(1);
|
||||
break;
|
||||
case 7:
|
||||
TryAndGSCookieAndAlign(1);
|
||||
break;
|
||||
case 8:
|
||||
Alloca(1);
|
||||
break;
|
||||
case 9:
|
||||
TryAndAlloca(1);
|
||||
break;
|
||||
case 10:
|
||||
GSCookieAndAlloca(1);
|
||||
break;
|
||||
case 11:
|
||||
TryAndGSCookieAndAlloca(1);
|
||||
break;
|
||||
case 12:
|
||||
AlignAndAlloca(1);
|
||||
break;
|
||||
case 13:
|
||||
TryAndAlignAndAlloca(1);
|
||||
break;
|
||||
case 14:
|
||||
GSCookieAndAlignAndAlloca(1);
|
||||
break;
|
||||
case 15:
|
||||
TryAndGSCookieAndAlignAndAlloca(1);
|
||||
break;
|
||||
case 16:
|
||||
BigLocals(1);
|
||||
break;
|
||||
case 17:
|
||||
TryAndBigLocals(1);
|
||||
break;
|
||||
case 18:
|
||||
GSCookieAndBigLocals(1);
|
||||
break;
|
||||
case 19:
|
||||
TryAndGSCookieAndBigLocals(1);
|
||||
break;
|
||||
case 20:
|
||||
AlignAndBigLocals(1);
|
||||
break;
|
||||
case 21:
|
||||
TryAndAlignAndBigLocals(1);
|
||||
break;
|
||||
case 22:
|
||||
GSCookieAndAlignAndBigLocals(1);
|
||||
break;
|
||||
case 23:
|
||||
TryAndGSCookieAndAlignAndBigLocals(1);
|
||||
break;
|
||||
case 24:
|
||||
AllocaAndBigLocals(1);
|
||||
break;
|
||||
case 25:
|
||||
TryAndAllocaAndBigLocals(1);
|
||||
break;
|
||||
case 26:
|
||||
GSCookieAndAllocaAndBigLocals(1);
|
||||
break;
|
||||
case 27:
|
||||
TryAndGSCookieAndAllocaAndBigLocals(1);
|
||||
break;
|
||||
case 28:
|
||||
AlignAndAllocaAndBigLocals(1);
|
||||
break;
|
||||
case 29:
|
||||
TryAndAlignAndAllocaAndBigLocals(1);
|
||||
break;
|
||||
case 30:
|
||||
GSCookieAndAlignAndAllocaAndBigLocals(1);
|
||||
break;
|
||||
case 31:
|
||||
TryAndGSCookieAndAlignAndAllocaAndBigLocals(1);
|
||||
break;
|
||||
case 32:
|
||||
EbpAdj(1);
|
||||
break;
|
||||
case 33:
|
||||
TryAndEbpAdj(1);
|
||||
break;
|
||||
case 34:
|
||||
GSCookieAndEbpAdj(1);
|
||||
break;
|
||||
case 35:
|
||||
TryAndGSCookieAndEbpAdj(1);
|
||||
break;
|
||||
case 36:
|
||||
AlignAndEbpAdj(1);
|
||||
break;
|
||||
case 37:
|
||||
TryAndAlignAndEbpAdj(1);
|
||||
break;
|
||||
case 38:
|
||||
GSCookieAndAlignAndEbpAdj(1);
|
||||
break;
|
||||
case 39:
|
||||
TryAndGSCookieAndAlignAndEbpAdj(1);
|
||||
break;
|
||||
case 40:
|
||||
AllocaAndEbpAdj(1);
|
||||
break;
|
||||
case 41:
|
||||
TryAndAllocaAndEbpAdj(1);
|
||||
break;
|
||||
case 42:
|
||||
GSCookieAndAllocaAndEbpAdj(1);
|
||||
break;
|
||||
case 43:
|
||||
TryAndGSCookieAndAllocaAndEbpAdj(1);
|
||||
break;
|
||||
case 44:
|
||||
AlignAndAllocaAndEbpAdj(1);
|
||||
break;
|
||||
case 45:
|
||||
TryAndAlignAndAllocaAndEbpAdj(1);
|
||||
break;
|
||||
case 46:
|
||||
GSCookieAndAlignAndAllocaAndEbpAdj(1);
|
||||
break;
|
||||
case 47:
|
||||
TryAndGSCookieAndAlignAndAllocaAndEbpAdj(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
__except(one) { caught = true; }
|
||||
|
||||
if (!caught) {
|
||||
puts("ERROR - did not see expected exception");
|
||||
++failures;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
__try { RunTests(); }
|
||||
__except(1) {
|
||||
puts("ERROR - Unexpectedly caught an exception");
|
||||
++failures;
|
||||
}
|
||||
|
||||
if (failures) {
|
||||
printf("Test failed with %d failure%s\n", failures,
|
||||
failures == 1 ? "" : "s");
|
||||
} else {
|
||||
puts("Test passed");
|
||||
}
|
||||
|
||||
return failures;
|
||||
}
|
99
modules/rostests/apitests/compiler/ms/seh/sehframes.out
Normal file
99
modules/rostests/apitests/compiler/ms/seh/sehframes.out
Normal file
|
@ -0,0 +1,99 @@
|
|||
Test pass 1 - no exceptions
|
||||
Simple
|
||||
Try
|
||||
GSCookie
|
||||
TryAndGSCookie
|
||||
Align
|
||||
TryAndAlign
|
||||
GSCookieAndAlign
|
||||
TryAndGSCookieAndAlign
|
||||
Alloca
|
||||
TryAndAlloca
|
||||
GSCookieAndAlloca
|
||||
TryAndGSCookieAndAlloca
|
||||
AlignAndAlloca
|
||||
TryAndAlignAndAlloca
|
||||
GSCookieAndAlignAndAlloca
|
||||
TryAndGSCookieAndAlignAndAlloca
|
||||
BigLocals
|
||||
TryAndBigLocals
|
||||
GSCookieAndBigLocals
|
||||
TryAndGSCookieAndBigLocals
|
||||
AlignAndBigLocals
|
||||
TryAndAlignAndBigLocals
|
||||
GSCookieAndAlignAndBigLocals
|
||||
TryAndGSCookieAndAlignAndBigLocals
|
||||
AllocaAndBigLocals
|
||||
TryAndAllocaAndBigLocals
|
||||
GSCookieAndAllocaAndBigLocals
|
||||
TryAndGSCookieAndAllocaAndBigLocals
|
||||
AlignAndAllocaAndBigLocals
|
||||
TryAndAlignAndAllocaAndBigLocals
|
||||
GSCookieAndAlignAndAllocaAndBigLocals
|
||||
TryAndGSCookieAndAlignAndAllocaAndBigLocals
|
||||
EbpAdj
|
||||
TryAndEbpAdj
|
||||
GSCookieAndEbpAdj
|
||||
TryAndGSCookieAndEbpAdj
|
||||
AlignAndEbpAdj
|
||||
TryAndAlignAndEbpAdj
|
||||
GSCookieAndAlignAndEbpAdj
|
||||
TryAndGSCookieAndAlignAndEbpAdj
|
||||
AllocaAndEbpAdj
|
||||
TryAndAllocaAndEbpAdj
|
||||
GSCookieAndAllocaAndEbpAdj
|
||||
TryAndGSCookieAndAllocaAndEbpAdj
|
||||
AlignAndAllocaAndEbpAdj
|
||||
TryAndAlignAndAllocaAndEbpAdj
|
||||
GSCookieAndAlignAndAllocaAndEbpAdj
|
||||
TryAndGSCookieAndAlignAndAllocaAndEbpAdj
|
||||
Test pass 2 - exceptions
|
||||
Simple
|
||||
Try
|
||||
GSCookie
|
||||
TryAndGSCookie
|
||||
Align
|
||||
TryAndAlign
|
||||
GSCookieAndAlign
|
||||
TryAndGSCookieAndAlign
|
||||
Alloca
|
||||
TryAndAlloca
|
||||
GSCookieAndAlloca
|
||||
TryAndGSCookieAndAlloca
|
||||
AlignAndAlloca
|
||||
TryAndAlignAndAlloca
|
||||
GSCookieAndAlignAndAlloca
|
||||
TryAndGSCookieAndAlignAndAlloca
|
||||
BigLocals
|
||||
TryAndBigLocals
|
||||
GSCookieAndBigLocals
|
||||
TryAndGSCookieAndBigLocals
|
||||
AlignAndBigLocals
|
||||
TryAndAlignAndBigLocals
|
||||
GSCookieAndAlignAndBigLocals
|
||||
TryAndGSCookieAndAlignAndBigLocals
|
||||
AllocaAndBigLocals
|
||||
TryAndAllocaAndBigLocals
|
||||
GSCookieAndAllocaAndBigLocals
|
||||
TryAndGSCookieAndAllocaAndBigLocals
|
||||
AlignAndAllocaAndBigLocals
|
||||
TryAndAlignAndAllocaAndBigLocals
|
||||
GSCookieAndAlignAndAllocaAndBigLocals
|
||||
TryAndGSCookieAndAlignAndAllocaAndBigLocals
|
||||
EbpAdj
|
||||
TryAndEbpAdj
|
||||
GSCookieAndEbpAdj
|
||||
TryAndGSCookieAndEbpAdj
|
||||
AlignAndEbpAdj
|
||||
TryAndAlignAndEbpAdj
|
||||
GSCookieAndAlignAndEbpAdj
|
||||
TryAndGSCookieAndAlignAndEbpAdj
|
||||
AllocaAndEbpAdj
|
||||
TryAndAllocaAndEbpAdj
|
||||
GSCookieAndAllocaAndEbpAdj
|
||||
TryAndGSCookieAndAllocaAndEbpAdj
|
||||
AlignAndAllocaAndEbpAdj
|
||||
TryAndAlignAndAllocaAndEbpAdj
|
||||
GSCookieAndAlignAndAllocaAndEbpAdj
|
||||
TryAndGSCookieAndAlignAndAllocaAndEbpAdj
|
||||
Test passed
|
3463
modules/rostests/apitests/compiler/ms/seh/xcpt4u.c
Normal file
3463
modules/rostests/apitests/compiler/ms/seh/xcpt4u.c
Normal file
File diff suppressed because it is too large
Load diff
89
modules/rostests/apitests/compiler/ms/seh/xcpt4u.correct
Normal file
89
modules/rostests/apitests/compiler/ms/seh/xcpt4u.correct
Normal file
|
@ -0,0 +1,89 @@
|
|||
Start of exception test
|
||||
test1...succeeded
|
||||
test2...succeeded
|
||||
test3...succeeded
|
||||
test4...succeeded
|
||||
test5...succeeded
|
||||
test6...succeeded
|
||||
test7...succeeded
|
||||
test8...succeeded
|
||||
test9...succeeded
|
||||
test10...succeeded
|
||||
test11...succeeded
|
||||
test12...succeeded...succeeded
|
||||
test13...succeeded...succeeded
|
||||
test14...succeeded
|
||||
test15...succeeded
|
||||
test16...succeeded
|
||||
test17...succeeded
|
||||
test18...succeeded
|
||||
test19...succeeded
|
||||
test20...succeeded
|
||||
test21...succeeded
|
||||
test22...succeeded
|
||||
test23...succeeded
|
||||
test24...succeeded
|
||||
test25...succeeded
|
||||
test26...succeeded
|
||||
test27...succeeded
|
||||
test28...succeeded
|
||||
test30...succeeded
|
||||
test31...succeeded
|
||||
test32...succeeded
|
||||
test33...succeeded
|
||||
test34...succeeded
|
||||
test35...succeeded
|
||||
test36...succeeded
|
||||
test37...succeeded
|
||||
test38...succeeded
|
||||
test39...succeeded
|
||||
test40...succeeded
|
||||
test41...succeeded
|
||||
test42...succeeded
|
||||
test43...succeeded
|
||||
test44...succeeded
|
||||
test45...succeeded
|
||||
test46...succeeded
|
||||
test47...succeeded
|
||||
test48...succeeded
|
||||
test49...succeeded
|
||||
test50...succeeded
|
||||
test51...succeeded
|
||||
test52...succeeded
|
||||
test53...succeeded
|
||||
test54...succeeded
|
||||
test55...succeeded
|
||||
test56...succeeded
|
||||
test57...succeeded
|
||||
test58...succeeded
|
||||
test59...succeeded
|
||||
test60...succeeded
|
||||
test61...succeeded
|
||||
test62...succeeded
|
||||
test63...succeeded
|
||||
test64...succeeded
|
||||
test65...succeeded
|
||||
test66...succeeded
|
||||
test67...succeeded
|
||||
test68...succeeded
|
||||
test69...filter entered...succeeded
|
||||
test70...filter entered...succeeded
|
||||
test71...filter entered...succeeded
|
||||
test72...filter entered...succeeded
|
||||
test73...filter entered...succeeded
|
||||
test74...filter entered...succeeded
|
||||
test75...filter entered...succeeded
|
||||
test76...filter entered...succeeded
|
||||
test77...filter entered...succeeded
|
||||
test78...filter entered...succeeded
|
||||
test79...filter 1...filter 2...finally 1...filter 1...filter 2...finally 2...passed
|
||||
test80...passed
|
||||
test81...in finally passed
|
||||
test82...succeeded
|
||||
test83...succeeded
|
||||
test84...succeeded
|
||||
test85...succeeded
|
||||
test86...Filter1 0..Handler1 0..Finally1 0..Finally2 1..succeeded
|
||||
test87...succeeded
|
||||
test88...succeeded
|
||||
End of exception test
|
89
modules/rostests/apitests/compiler/ms/seh/xcpt4u.out
Normal file
89
modules/rostests/apitests/compiler/ms/seh/xcpt4u.out
Normal file
|
@ -0,0 +1,89 @@
|
|||
Start of exception test
|
||||
test1...succeeded
|
||||
test2...succeeded
|
||||
test3...succeeded
|
||||
test4...succeeded
|
||||
test5...succeeded
|
||||
test6...succeeded
|
||||
test7...succeeded
|
||||
test8...succeeded
|
||||
test9...succeeded
|
||||
test10...succeeded
|
||||
test11...succeeded
|
||||
test12...succeeded...succeeded
|
||||
test13...succeeded...succeeded
|
||||
test14...succeeded
|
||||
test15...succeeded
|
||||
test16...succeeded
|
||||
test17...succeeded
|
||||
test18...succeeded
|
||||
test19...succeeded
|
||||
test20...succeeded
|
||||
test21...succeeded
|
||||
test22...succeeded
|
||||
test23...succeeded
|
||||
test24...succeeded
|
||||
test25...succeeded
|
||||
test26...succeeded
|
||||
test27...succeeded
|
||||
test28...succeeded
|
||||
test30...succeeded
|
||||
test31...succeeded
|
||||
test32...succeeded
|
||||
test33...succeeded
|
||||
test34...succeeded
|
||||
test35...succeeded
|
||||
test36...succeeded
|
||||
test37...succeeded
|
||||
test38...succeeded
|
||||
test39...succeeded
|
||||
test40...succeeded
|
||||
test41...succeeded
|
||||
test42...succeeded
|
||||
test43...succeeded
|
||||
test44...succeeded
|
||||
test45...succeeded
|
||||
test46...succeeded
|
||||
test47...succeeded
|
||||
test48...succeeded
|
||||
test49...succeeded
|
||||
test50...succeeded
|
||||
test51...succeeded
|
||||
test52...succeeded
|
||||
test53...succeeded
|
||||
test54...succeeded
|
||||
test55...succeeded
|
||||
test56...succeeded
|
||||
test57...succeeded
|
||||
test58...skipped
|
||||
test59...succeeded
|
||||
test60...succeeded
|
||||
test61...skipped
|
||||
test62...succeeded
|
||||
test63...succeeded
|
||||
test64...succeeded
|
||||
test65...succeeded
|
||||
test66...succeeded
|
||||
test67...succeeded
|
||||
test68...succeeded
|
||||
test69...filter entered...succeeded
|
||||
test70...filter entered...succeeded
|
||||
test71...filter entered...succeeded
|
||||
test72...filter entered...succeeded
|
||||
test73...filter entered...succeeded
|
||||
test74...filter entered...succeeded
|
||||
test75...filter entered...succeeded
|
||||
test76...filter entered...succeeded
|
||||
test77...filter entered...succeeded
|
||||
test78...filter entered...succeeded
|
||||
test79...filter 1...filter 2...finally 1...filter 1...filter 2...finally 2...passed
|
||||
test80...passed
|
||||
test81...in finally passed
|
||||
test82...succeeded
|
||||
test83...succeeded
|
||||
test84...succeeded
|
||||
test85...succeeded
|
||||
test86...Filter1 0..Handler1 0..Finally1 0..Finally2 1..succeeded
|
||||
test87...succeeded
|
||||
test88...succeeded
|
||||
End of exception test
|
89
modules/rostests/apitests/compiler/ms/seh/xcpt4u.test.out
Normal file
89
modules/rostests/apitests/compiler/ms/seh/xcpt4u.test.out
Normal file
|
@ -0,0 +1,89 @@
|
|||
Start of exception test
|
||||
test1...succeeded
|
||||
test2...succeeded
|
||||
test3...succeeded
|
||||
test4...succeeded
|
||||
test5...succeeded
|
||||
test6...succeeded
|
||||
test7...succeeded
|
||||
test8...succeeded
|
||||
test9...succeeded
|
||||
test10...succeeded
|
||||
test11...succeeded
|
||||
test12...succeeded...succeeded
|
||||
test13...succeeded...succeeded
|
||||
test14...succeeded
|
||||
test15...succeeded
|
||||
test16...succeeded
|
||||
test17...succeeded
|
||||
test18...succeeded
|
||||
test19...succeeded
|
||||
test20...succeeded
|
||||
test21...succeeded
|
||||
test22...succeeded
|
||||
test23...succeeded
|
||||
test24...succeeded
|
||||
test25...succeeded
|
||||
test26...succeeded
|
||||
test27...succeeded
|
||||
test28...succeeded
|
||||
test30...succeeded
|
||||
test31...succeeded
|
||||
test32...succeeded
|
||||
test33...succeeded
|
||||
test34...succeeded
|
||||
test35...succeeded
|
||||
test36...succeeded
|
||||
test37...succeeded
|
||||
test38...succeeded
|
||||
test39...succeeded
|
||||
test40...succeeded
|
||||
test41...succeeded
|
||||
test42...succeeded
|
||||
test43...succeeded
|
||||
test44...succeeded
|
||||
test45...succeeded
|
||||
test46...succeeded
|
||||
test47...succeeded
|
||||
test48...succeeded
|
||||
test49...succeeded
|
||||
test50...succeeded
|
||||
test51...succeeded
|
||||
test52...succeeded
|
||||
test53...succeeded
|
||||
test54...succeeded
|
||||
test55...succeeded
|
||||
test56...succeeded
|
||||
test57...succeeded
|
||||
test58...skipped
|
||||
test59...succeeded
|
||||
test60...succeeded
|
||||
test61...skipped
|
||||
test62...succeeded
|
||||
test63...succeeded
|
||||
test64...succeeded
|
||||
test65...succeeded
|
||||
test66...succeeded
|
||||
test67...succeeded
|
||||
test68...succeeded
|
||||
test69...filter entered...succeeded
|
||||
test70...filter entered...succeeded
|
||||
test71...filter entered...succeeded
|
||||
test72...filter entered...succeeded
|
||||
test73...filter entered...succeeded
|
||||
test74...filter entered...succeeded
|
||||
test75...filter entered...succeeded
|
||||
test76...filter entered...succeeded
|
||||
test77...filter entered...succeeded
|
||||
test78...filter entered...succeeded
|
||||
test79...filter 1...filter 2...finally 1...filter 1...filter 2...finally 2...passed
|
||||
test80...passed
|
||||
test81...in finally passed
|
||||
test82...succeeded
|
||||
test83...succeeded
|
||||
test84...succeeded
|
||||
test85...succeeded
|
||||
test86...Filter1 0..Handler1 0..Finally1 0..Finally2 1..succeeded
|
||||
test87...succeeded
|
||||
test88...succeeded
|
||||
End of exception test
|
144
modules/rostests/apitests/compiler/ms_seh.c
Normal file
144
modules/rostests/apitests/compiler/ms_seh.c
Normal file
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* PROJECT: ReactOS API tests
|
||||
* LICENSE: MIT (https://spdx.org/licenses/MIT)
|
||||
* PURPOSE: Test for SEH
|
||||
* COPYRIGHT: Copyright 2020 Timo Kreuzer <timo.kreuzer@reactos.org>
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
#include "stdio.h"
|
||||
#include <pseh/pseh2.h>
|
||||
|
||||
int seh0001();
|
||||
int seh0002();
|
||||
int seh0003();
|
||||
int seh0004();
|
||||
int seh0005();
|
||||
int seh0006();
|
||||
int seh0007();
|
||||
int seh0008();
|
||||
int seh0009();
|
||||
int seh0010();
|
||||
int seh0011();
|
||||
int seh0012();
|
||||
int seh0013();
|
||||
int seh0014();
|
||||
int seh0015();
|
||||
int seh0016();
|
||||
int seh0017();
|
||||
int seh0018();
|
||||
int seh0019();
|
||||
int seh0020();
|
||||
int seh0021();
|
||||
int seh0022();
|
||||
int seh0023();
|
||||
int seh0024();
|
||||
int seh0025();
|
||||
int seh0026();
|
||||
int seh0027();
|
||||
int seh0028();
|
||||
int seh0029();
|
||||
int seh0030();
|
||||
int seh0031();
|
||||
int seh0032();
|
||||
int seh0033();
|
||||
int seh0034();
|
||||
int seh0035();
|
||||
int seh0036();
|
||||
int seh0037();
|
||||
int seh0038();
|
||||
int seh0039();
|
||||
int seh0040();
|
||||
int seh0041();
|
||||
int seh0042();
|
||||
int seh0043();
|
||||
int seh0044();
|
||||
int seh0045();
|
||||
int seh0046();
|
||||
int seh0047();
|
||||
int seh0048();
|
||||
int seh0049();
|
||||
int seh0050();
|
||||
int seh0051();
|
||||
int seh0052();
|
||||
int seh0053();
|
||||
int seh0054();
|
||||
int seh0055();
|
||||
int seh0056();
|
||||
int seh0057();
|
||||
int seh0058();
|
||||
|
||||
#define run_test(test) \
|
||||
_SEH2_TRY \
|
||||
{ \
|
||||
ok_int(test(), 0); \
|
||||
} \
|
||||
_SEH2_EXCEPT(1) \
|
||||
{ \
|
||||
ok(0, "Exception while running test " #test "\n"); \
|
||||
} \
|
||||
_SEH2_END
|
||||
|
||||
START_TEST(ms_seh)
|
||||
{
|
||||
run_test(seh0001);
|
||||
run_test(seh0002);
|
||||
run_test(seh0003);
|
||||
run_test(seh0004);
|
||||
run_test(seh0005);
|
||||
run_test(seh0006);
|
||||
run_test(seh0007);
|
||||
run_test(seh0008);
|
||||
run_test(seh0009);
|
||||
run_test(seh0010);
|
||||
run_test(seh0011);
|
||||
run_test(seh0012);
|
||||
run_test(seh0013);
|
||||
run_test(seh0014);
|
||||
run_test(seh0015);
|
||||
run_test(seh0016);
|
||||
run_test(seh0017);
|
||||
run_test(seh0018);
|
||||
run_test(seh0019);
|
||||
run_test(seh0020);
|
||||
run_test(seh0021);
|
||||
run_test(seh0022);
|
||||
run_test(seh0023);
|
||||
run_test(seh0024);
|
||||
run_test(seh0025);
|
||||
run_test(seh0026);
|
||||
run_test(seh0027);
|
||||
run_test(seh0028);
|
||||
run_test(seh0029);
|
||||
run_test(seh0030);
|
||||
run_test(seh0031);
|
||||
run_test(seh0032);
|
||||
run_test(seh0033);
|
||||
run_test(seh0034);
|
||||
run_test(seh0035);
|
||||
run_test(seh0036);
|
||||
run_test(seh0037);
|
||||
run_test(seh0038);
|
||||
run_test(seh0039);
|
||||
run_test(seh0040);
|
||||
run_test(seh0041);
|
||||
run_test(seh0042);
|
||||
run_test(seh0043);
|
||||
run_test(seh0044);
|
||||
run_test(seh0045);
|
||||
run_test(seh0046);
|
||||
run_test(seh0047);
|
||||
run_test(seh0048);
|
||||
run_test(seh0049);
|
||||
run_test(seh0050);
|
||||
run_test(seh0051);
|
||||
run_test(seh0052);
|
||||
run_test(seh0053);
|
||||
run_test(seh0054);
|
||||
#if !defined(_PSEH3_H_)
|
||||
run_test(seh0055);
|
||||
#endif
|
||||
run_test(seh0056);
|
||||
run_test(seh0057);
|
||||
run_test(seh0058);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue