Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun <skaplun@tarantool.org>
To: Sergey Ostanevich <sergos@tarantool.org>,
	Igor Munkin <imun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH luajit 1/3] misc: fix build with disabled memory profiler
Date: Wed, 30 Dec 2020 01:22:56 +0300	[thread overview]
Message-ID: <a44cf48f548c623235218b4bf51bf268422b9191.1609278043.git.skaplun@tarantool.org> (raw)
In-Reply-To: <cover.1609278043.git.skaplun@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

  reply	other threads:[~2020-12-29 22:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-29 22:22 [Tarantool-patches] [PATCH luajit 0/3] LuaJIT memory profiler bug fixes Sergey Kaplun
2020-12-29 22:22 ` Sergey Kaplun [this message]
2020-12-30  8:49   ` [Tarantool-patches] [PATCH luajit 1/3] misc: fix build with disabled memory profiler Igor Munkin
2020-12-30  8:52     ` Sergey Kaplun
2020-12-30  9:42       ` Sergey Ostanevich
2020-12-29 22:22 ` [Tarantool-patches] [PATCH luajit 2/3] core: fix resources leak in " Sergey Kaplun
2020-12-30  9:06   ` Igor Munkin
2020-12-30  9:31     ` Sergey Ostanevich
2020-12-30  9:33       ` Sergey Kaplun
2020-12-30  9:32     ` Sergey Kaplun
2020-12-30  9:53       ` Sergey Ostanevich
2020-12-29 22:22 ` [Tarantool-patches] [PATCH luajit 3/3] core: remove excess assertion inside memprof Sergey Kaplun
2020-12-30  9:39   ` Igor Munkin
2020-12-30  9:50     ` Sergey Kaplun
2020-12-30 10:50       ` Sergey Ostanevich
2020-12-30 11:06         ` Sergey Kaplun
2020-12-30  8:24 ` [Tarantool-patches] [PATCH luajit 0/3] LuaJIT memory profiler bug fixes Alexander V. Tikhonov
2020-12-30 11:20 ` Igor Munkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a44cf48f548c623235218b4bf51bf268422b9191.1609278043.git.skaplun@tarantool.org \
    --to=skaplun@tarantool.org \
    --cc=imun@tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 1/3] misc: fix build with disabled memory profiler' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox