You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/03/26 04:31:58 UTC

[incubator-nuttx-apps] branch master updated: testing: Fix cxxtest application for "no-rtti" builds

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 732df52  testing: Fix cxxtest application for "no-rtti" builds
732df52 is described below

commit 732df52aefd39c83e8d4fd170e1df0f39a825353
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Fri Mar 25 16:01:05 2022 -0300

    testing: Fix cxxtest application for "no-rtti" builds
    
    Signed-off-by: Gustavo Henrique Nihei <gu...@espressif.com>
---
 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 06cfc86..39a1c9a 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