From 2afcfa6dbd6504cbc3b776ee97cdc1c14bc262e7 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 5 Apr 2014 14:24:16 +0000 Subject: [PATCH] [PSEH2_TEST} Use the tests with C++, too. svn path=/trunk/; revision=62620 --- rostests/tests/pseh2/CMakeLists.txt | 11 ++++++++++ rostests/tests/pseh2/psehtest.c | 30 ++++++++++++++++++++++++++- rostests/tests/pseh2/psehtest_cpp.cpp | 3 +++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 rostests/tests/pseh2/psehtest_cpp.cpp diff --git a/rostests/tests/pseh2/CMakeLists.txt b/rostests/tests/pseh2/CMakeLists.txt index 38b627f093c..6c551df3710 100644 --- a/rostests/tests/pseh2/CMakeLists.txt +++ b/rostests/tests/pseh2/CMakeLists.txt @@ -8,3 +8,14 @@ add_cd_file(TARGET pseh2_test DESTINATION reactos/bin FOR all) if(NOT MSVC) add_target_compile_flags(pseh2_test "-Wno-format") endif() + + +add_executable(pseh2_test_cpp psehtest_cpp.cpp psehtest2.c) +target_link_libraries(pseh2_test_cpp wine ${PSEH_LIB}) +set_module_type(pseh2_test_cpp win32cui) +add_importlibs(pseh2_test_cpp msvcrt kernel32 ntdll) +add_cd_file(TARGET pseh2_test_cpp DESTINATION reactos/bin FOR all) + +if(NOT MSVC) + add_target_compile_flags(pseh2_test_cpp "-Wno-format") +endif() diff --git a/rostests/tests/pseh2/psehtest.c b/rostests/tests/pseh2/psehtest.c index 66cd6e5620e..e23dc7376c1 100644 --- a/rostests/tests/pseh2/psehtest.c +++ b/rostests/tests/pseh2/psehtest.c @@ -22,6 +22,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #define STANDALONE #include @@ -54,7 +58,11 @@ extern int return_minusone_4(void *, int); extern void set_positive(int *); -static int call_test(int (*)(void)); +//static int call_test(int (*)(void)); + +#ifdef __cplusplus +} // extern "C" +#endif #define DEFINE_TEST(NAME_) static int NAME_(void) @@ -2487,6 +2495,25 @@ DEFINE_TEST(test_unvolatile_3) return FALSE; } +DEFINE_TEST(test_unvolatile_4) +{ + unsigned result = 0xdeadbeef; + + _SEH2_TRY + { + *(char*)0x80000000 = 1; + } + _SEH2_EXCEPT(result == 0xdeadbeef) + { + result = 2; + } + _SEH2_END; + + result = (result == 0xdeadbeef) ? 0 : result + 1; + + return result == 3; +} + DEFINE_TEST(test_finally_goto) { volatile int val = 0; @@ -2814,6 +2841,7 @@ void testsuite_syntax(void) USE_TEST(test_unvolatile), USE_TEST(test_unvolatile_2), USE_TEST(test_unvolatile_3), + USE_TEST(test_unvolatile_4), USE_TEST(test_finally_goto), USE_TEST(test_nested_exception), USE_TEST(test_PSEH3_bug), diff --git a/rostests/tests/pseh2/psehtest_cpp.cpp b/rostests/tests/pseh2/psehtest_cpp.cpp new file mode 100644 index 00000000000..d6fe2e51d75 --- /dev/null +++ b/rostests/tests/pseh2/psehtest_cpp.cpp @@ -0,0 +1,3 @@ + + +#include "psehtest.c"