From: Timo Kreuzer Date: Sat, 5 Apr 2014 16:49:17 +0000 (+0000) Subject: [PSEH_TEST] X-Git-Tag: backups/0.3.17@66124~1845 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=73512e7ad460a2f3bef00dcee83fdec7c16bf78c [PSEH_TEST] #if out a test for C++. This test only shows the limitations of PSEH and does not provide a satisfying result anyway. svn path=/trunk/; revision=62629 --- diff --git a/rostests/tests/pseh2/psehtest.c b/rostests/tests/pseh2/psehtest.c index e23dc7376c1..3fc2160efa3 100644 --- a/rostests/tests/pseh2/psehtest.c +++ b/rostests/tests/pseh2/psehtest.c @@ -2447,6 +2447,15 @@ DEFINE_TEST(test_unvolatile_2) return (val == 3) || (val == 4) || (val == 5); } +/* This test is mainly for documentation purpose. As can be seen it doesn't + provide a satisfying result. In fact the compiler could do even more + crazy things like reusing val1 between the assignment to 0 and the last + assignment to 3. This DOES happen with C++ and it's NOT a PSEH bug, but + rather an unavoidable consequence of how the compiler works. + The conclusion: Do not use assignments to a variable inside a __try block + that is being used later inside the __except block, unless it is declared + volatile! */ +#ifndef __cplusplus DEFINE_TEST(test_unvolatile_3) { int register val1 = 0, val2 = 0; @@ -2494,6 +2503,7 @@ DEFINE_TEST(test_unvolatile_3) return FALSE; } +#endif // __cplusplus DEFINE_TEST(test_unvolatile_4) { @@ -2840,7 +2850,9 @@ void testsuite_syntax(void) USE_TEST(test_unvolatile), USE_TEST(test_unvolatile_2), +#ifndef __cplusplus USE_TEST(test_unvolatile_3), +#endif USE_TEST(test_unvolatile_4), USE_TEST(test_finally_goto), USE_TEST(test_nested_exception),