chore(util/lua): remove dead code
I removed lua_module helper class because it does not work. The problem is that the linker may eliminate ignore a object file that contains a lua_module global object used for initialization. When this happens, the associated Lua bindings will not be exposed in the Lua API. Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
feca9dbdf8
commit
4c5ec53a44
2 changed files with 0 additions and 28 deletions
|
@ -149,21 +149,4 @@ int (*g_safe_function_wrapper)(lua_State * L, lua_CFunction f) = simple_safe_fun
|
|||
set_safe_function_wrapper::set_safe_function_wrapper(int (*f)(lua_State *, lua_CFunction)) {
|
||||
g_safe_function_wrapper = f;
|
||||
}
|
||||
|
||||
static std::unique_ptr<std::vector<lua_module::init_fn>> g_modules;
|
||||
|
||||
lua_module::lua_module(init_fn f) {
|
||||
if (!g_modules) {
|
||||
g_modules.reset(new std::vector<init_fn>());
|
||||
}
|
||||
g_modules->push_back(f);
|
||||
}
|
||||
|
||||
void lua_module::init(lua_State * L) {
|
||||
if (g_modules) {
|
||||
for (auto f : *g_modules) {
|
||||
f(L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,17 +28,6 @@ int get_nonnil_top(lua_State * L);
|
|||
// =======================================
|
||||
// Goodies/Macros for automating Lua binding
|
||||
// generation.
|
||||
/**
|
||||
\brief Helper class for registering a new
|
||||
set of Lua bindings.
|
||||
*/
|
||||
class lua_module {
|
||||
public:
|
||||
typedef void (*init_fn)(lua_State * L);
|
||||
lua_module(init_fn f);
|
||||
static void init(lua_State * L);
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Wrapper for invoking function f, and catching Lean exceptions.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue