From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [217.69.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id F36534765E1 for ; Wed, 30 Dec 2020 01:23:49 +0300 (MSK) From: Sergey Kaplun Date: Wed, 30 Dec 2020 01:22:56 +0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit 1/3] misc: fix build with disabled memory profiler List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Ostanevich , Igor Munkin Cc: tarantool-patches@dev.tarantool.org This patch fixes the regression introduced in scope of b4e6bf0d82100049d29af1aa3196e781270f39d1 ('misc: add Lua API for memory profiler'). Build is failed with disabled memory profiler because related error messages are not defined. This patch fixes build by making LJ_ERR_PROF_MISUSE visible and avoiding usage of other profiler-related errors when the profiler is disabled. Follows up tarantool/tarantool#5442 --- src/lib_misc.c | 4 ++++ src/lj_errmsg.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib_misc.c b/src/lib_misc.c index 958c189..f89827e 100644 --- a/src/lib_misc.c +++ b/src/lib_misc.c @@ -187,6 +187,7 @@ LJLIB_CF(misc_memprof_start) lua_pushstring(L, err2msg(LJ_ERR_PROF_MISUSE)); lua_pushinteger(L, EINVAL); return 3; +#if LJ_HASMEMPROF case PROFILE_ERRRUN: lua_pushnil(L); lua_pushstring(L, err2msg(LJ_ERR_PROF_ISRUNNING)); @@ -194,6 +195,7 @@ LJLIB_CF(misc_memprof_start) return 3; case PROFILE_ERRIO: return luaL_fileresult(L, 0, fname); +#endif default: lua_assert(0); return 0; @@ -214,6 +216,7 @@ LJLIB_CF(misc_memprof_stop) lua_pushstring(L, err2msg(LJ_ERR_PROF_MISUSE)); lua_pushinteger(L, EINVAL); return 3; +#if LJ_HASMEMPROF case PROFILE_ERRRUN: lua_pushnil(L); lua_pushstring(L, err2msg(LJ_ERR_PROF_NOTRUNNING)); @@ -221,6 +224,7 @@ LJLIB_CF(misc_memprof_stop) return 3; case PROFILE_ERRIO: return luaL_fileresult(L, 0, NULL); +#endif default: lua_assert(0); return 0; diff --git a/src/lj_errmsg.h b/src/lj_errmsg.h index bebe804..ae0a18c 100644 --- a/src/lj_errmsg.h +++ b/src/lj_errmsg.h @@ -185,9 +185,9 @@ ERRDEF(FFI_NYIPACKBIT, "NYI: packed bit fields") ERRDEF(FFI_NYICALL, "NYI: cannot call this C function (yet)") #endif -#if LJ_HASMEMPROF /* Profiler errors. */ ERRDEF(PROF_MISUSE, "profiler misuse") +#if LJ_HASMEMPROF ERRDEF(PROF_ISRUNNING, "profiler is running already") ERRDEF(PROF_NOTRUNNING, "profiler is not running") #endif -- 2.28.0