From ad36622a6865faccf918f955b99538ad3eb647e9 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Tue, 4 Jun 2013 23:31:36 +0400 Subject: [PATCH] Move to C++: post-merge fixes. --- CMakeLists.txt | 6 +++--- src/box/box_lua.cc | 4 ++-- src/fiber.cc | 2 +- src/lua/cjson.cc | 2 +- src/lua/init.cc | 21 +++++++++++++-------- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ce6f1f52c..54ed75ac79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,9 +236,9 @@ endif() # usable on a system which has only gcc 4.1, statically link with # builtin libgcc by default. # -if (CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_CLANG) - add_compile_flags("C;CXX;OBJC;OBJCXX" "-static-libgcc") -endif() +#if (CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_COMPILER_IS_CLANG) +# add_compile_flags("C;CXX;OBJC;OBJCXX" "-static-libgcc") +#endif() ## ## Third-Party libraries diff --git a/src/box/box_lua.cc b/src/box/box_lua.cc index 9c5a286e94..b811f9585a 100644 --- a/src/box/box_lua.cc +++ b/src/box/box_lua.cc @@ -1713,10 +1713,10 @@ box_unpack_response(struct lua_State *L, const void *s, const void *end) t->field_count = field_count; memcpy(t->data, s, bsize); - s += bsize; + s = (const char *) s + bsize; lbox_pushtuple(L, t); } - return s; + return (const char *) s; } diff --git a/src/fiber.cc b/src/fiber.cc index 8894a8b7ec..d8c3faf04b 100644 --- a/src/fiber.cc +++ b/src/fiber.cc @@ -92,7 +92,7 @@ void fiber_checkstack() { if (sp + 1 - call_stack >= FIBER_CALL_STACK) - tnt_raise(ClientError, :ER_FIBER_STACK); + tnt_raise(ClientError, ER_FIBER_STACK); } /** Interrupt a synchronous wait of a fiber inside the event loop. diff --git a/src/lua/cjson.cc b/src/lua/cjson.cc index 45dd508511..59dc450b07 100644 --- a/src/lua/cjson.cc +++ b/src/lua/cjson.cc @@ -32,9 +32,9 @@ extern "C" { #include "lua.h" #include "lauxlib.h" #include "lualib.h" +int luaopen_cjson(lua_State *l); } -int luaopen_cjson(lua_State *l); int tarantool_lua_cjson_init(struct lua_State *L) diff --git a/src/lua/init.cc b/src/lua/init.cc index b2b3a72a50..e78dfcd67b 100644 --- a/src/lua/init.cc +++ b/src/lua/init.cc @@ -665,18 +665,23 @@ box_lua_fiber_run_detached(va_list ap) { int coro_ref = va_arg(ap, int); struct lua_State *L = va_arg(ap, struct lua_State *); - @try { + auto cleanup = [=] { + luaL_unref(L, LUA_REGISTRYINDEX, coro_ref); + }; + try { lua_call(L, lua_gettop(L) - 1, LUA_MULTRET); - } @catch (FiberCancelException *e) { - @throw; - } @catch (tnt_Exception *e) { - [e log]; - } @catch (id allOthers) { + cleanup(); + } catch (const FiberCancelException &e) { + throw; + cleanup(); + } catch (const Exception &e) { + e.log(); + cleanup(); + } catch (...) { lua_settop(L, 1); if (lua_tostring(L, -1) != NULL) say_error("%s", lua_tostring(L, -1)); - } @finally { - luaL_unref(L, LUA_REGISTRYINDEX, coro_ref); + cleanup(); } } -- GitLab