From 732df52aefd39c83e8d4fd170e1df0f39a825353 Mon Sep 17 00:00:00 2001 From: Gustavo Henrique Nihei Date: Fri, 25 Mar 2022 16:01:05 -0300 Subject: [PATCH] testing: Fix cxxtest application for "no-rtti" builds Signed-off-by: Gustavo Henrique Nihei --- testing/cxxtest/cxxtest_main.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/testing/cxxtest/cxxtest_main.cxx b/testing/cxxtest/cxxtest_main.cxx index 06cfc86c9..39a1c9a1d 100644 --- a/testing/cxxtest/cxxtest_main.cxx +++ b/testing/cxxtest/cxxtest_main.cxx @@ -167,6 +167,7 @@ static void test_stl(void) // Name: test_rtti //***************************************************************************/ +#ifdef CONFIG_CXX_RTTI static void test_rtti(void) { std::cout << "test rtti===============================" << std::endl; @@ -185,6 +186,7 @@ static void test_rtti(void) delete a; delete b; } +#endif //*************************************************************************** // Name: test_exception @@ -195,14 +197,13 @@ static void test_exception(void) { std::cout << "test exception==========================" << std::endl; try - { - throw runtime_error("runtime error"); - } - + { + throw runtime_error("runtime error"); + } catch (runtime_error &e) - { - std::cout << "Catch exception: " << e.what() << std::endl; - } + { + std::cout << "Catch exception: " << e.what() << std::endl; + } } #endif @@ -219,7 +220,9 @@ extern "C" int main(int argc, char *argv[]) test_ofstream(); test_iostream(); test_stl(); +#ifdef CONFIG_CXX_RTTI test_rtti(); +#endif #ifdef CONFIG_CXX_EXCEPTION test_exception(); #endif