From ccbf86f781902dbe96c1133933054919610bf8d6 Mon Sep 17 00:00:00 2001 From: "andrey.bychkov" Date: Wed, 18 Mar 2026 09:30:28 +0300 Subject: [PATCH] disable exeptions in cmake --- 3rd/LuaBridge/detail/LuaException.h | 9 ++++++--- 3rd/LuaBridge/detail/Namespace.h | 9 ++++++--- 3rd/LuaBridge/detail/Userdata.h | 7 +++++-- CMakeLists.txt | 2 +- libs/main/core/pibase.h | 15 +++++++-------- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/3rd/LuaBridge/detail/LuaException.h b/3rd/LuaBridge/detail/LuaException.h index 836cb852..2fe6d608 100644 --- a/3rd/LuaBridge/detail/LuaException.h +++ b/3rd/LuaBridge/detail/LuaException.h @@ -97,8 +97,10 @@ public: { int code = lua_pcall (L, nargs, nresults, msgh); - if (code != LUABRIDGE_LUA_OK) - Throw (LuaException (L, code)); + if (code != LUABRIDGE_LUA_OK) { + // Throw (LuaException (L, code)); + assert(true); + } } //---------------------------------------------------------------------------- @@ -128,7 +130,8 @@ protected: private: static int throwAtPanic (lua_State* L) { - throw LuaException (L, -1); + // throw LuaException (L, -1); + return -1; } }; diff --git a/3rd/LuaBridge/detail/Namespace.h b/3rd/LuaBridge/detail/Namespace.h index 68ae21fa..8a4dd20a 100644 --- a/3rd/LuaBridge/detail/Namespace.h +++ b/3rd/LuaBridge/detail/Namespace.h @@ -101,7 +101,8 @@ protected: { if (m_stackSize == 0) { - throw std::logic_error ("Unable to continue registration"); + std::cerr << ("Unable to continue registration"); + assert(true); } } }; @@ -1054,7 +1055,8 @@ public: { if (m_stackSize == 1) { - throw std::logic_error ("endNamespace () called on global namespace"); + std::cerr << ("endNamespace () called on global namespace"); + assert(true); } assert (m_stackSize > 1); @@ -1150,7 +1152,8 @@ public: { if (m_stackSize == 1) { - throw std::logic_error ("addProperty () called on global namespace"); + std::cerr << ("addProperty () called on global namespace"); + assert(true); } assert (lua_istable (L, -1)); // Stack: namespace table (ns) diff --git a/3rd/LuaBridge/detail/Userdata.h b/3rd/LuaBridge/detail/Userdata.h index ef13d9fc..3993e176 100644 --- a/3rd/LuaBridge/detail/Userdata.h +++ b/3rd/LuaBridge/detail/Userdata.h @@ -33,6 +33,7 @@ #include #include +#include namespace luabridge { @@ -320,7 +321,8 @@ public: lua_rawgetp (L, LUA_REGISTRYINDEX, ClassInfo ::getClassKey ()); if (!lua_istable (L, -1)) { - throw std::logic_error ("The class is not registered in LuaBridge"); + std::cerr << ("The class is not registered in LuaBridge"); + assert(true); } lua_setmetatable (L, -2); return ud; @@ -375,7 +377,8 @@ private: lua_rawgetp (L, LUA_REGISTRYINDEX, key); if (!lua_istable (L, -1)) { - throw std::logic_error ("The class is not registered in LuaBridge"); + std::cerr << ("The class is not registered in LuaBridge"); + assert(true); } lua_setmetatable (L, -2); } diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e4740bd..8478147f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -363,7 +363,7 @@ if(WIN32) set(CMAKE_CXX_FLAGS "/O2 /Ob2 /Ot /W0") endif() else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fno-exceptions") if(DEFINED ENV{QNX_HOST} OR PIP_FREERTOS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32") endif() diff --git a/libs/main/core/pibase.h b/libs/main/core/pibase.h index 8f6223c8..b379dea4 100644 --- a/libs/main/core/pibase.h +++ b/libs/main/core/pibase.h @@ -726,6 +726,7 @@ inline bool piDeleteSafety(T *& pointer) { //! \~english In this example "Error!" will be printed on every \b false function return. //! \~russian В данном примере будет выведен "Error!" при каждом \b false возврате из функции. class PIP_EXPORT PIScopeExitCall { + NO_COPY_CLASS(PIScopeExitCall) public: //! \~\brief //! \~english Constructor that takes a function to execute @@ -758,8 +759,6 @@ public: } private: - NO_COPY_CLASS(PIScopeExitCall) - std::function func; }; @@ -768,14 +767,14 @@ private: //! \~english Inherit from this class to make your class non-trivially copyable. //! \~russian Наследуйтесь от этого класса чтобы сделать свой класс нетривиально копируемым. struct PIP_EXPORT PINonTriviallyCopyable { - PINonTriviallyCopyable() noexcept = default; - PINonTriviallyCopyable(const PINonTriviallyCopyable &) noexcept = default; - PINonTriviallyCopyable(PINonTriviallyCopyable &&) noexcept; - PINonTriviallyCopyable & operator=(const PINonTriviallyCopyable &) noexcept = default; - PINonTriviallyCopyable & operator=(PINonTriviallyCopyable &&) noexcept = default; + PINonTriviallyCopyable() = default; + PINonTriviallyCopyable(const PINonTriviallyCopyable &) = default; + PINonTriviallyCopyable(PINonTriviallyCopyable &&) ; + PINonTriviallyCopyable & operator=(const PINonTriviallyCopyable &) = default; + PINonTriviallyCopyable & operator=(PINonTriviallyCopyable &&) = default; ~PINonTriviallyCopyable() = default; }; -inline PINonTriviallyCopyable::PINonTriviallyCopyable(PINonTriviallyCopyable &&) noexcept = default; +inline PINonTriviallyCopyable::PINonTriviallyCopyable(PINonTriviallyCopyable &&) = default; //! \~\brief