fix MSVC warnings

This commit is contained in:
2024-02-22 22:40:53 -06:00
parent 2a71914ed8
commit a8c1a10cab
3 changed files with 12 additions and 10 deletions

2
luakiwi.def Normal file
View File

@@ -0,0 +1,2 @@
EXPORTS
luaopen_ckiwi

View File

@@ -120,36 +120,36 @@ template<typename F>
inline const KiwiErr* wrap_err(F&& f) { inline const KiwiErr* wrap_err(F&& f) {
try { try {
f(); f();
} catch (const UnsatisfiableConstraint& ex) { } catch (const UnsatisfiableConstraint&) {
static const constexpr KiwiErr err { static const constexpr KiwiErr err {
KiwiErrUnsatisfiableConstraint, KiwiErrUnsatisfiableConstraint,
"The constraint cannot be satisfied."}; "The constraint cannot be satisfied."};
return &err; return &err;
} catch (const UnknownConstraint& ex) { } catch (const UnknownConstraint&) {
static const constexpr KiwiErr err { static const constexpr KiwiErr err {
KiwiErrUnknownConstraint, KiwiErrUnknownConstraint,
"The constraint has not been added to the solver."}; "The constraint has not been added to the solver."};
return &err; return &err;
} catch (const DuplicateConstraint& ex) { } catch (const DuplicateConstraint&) {
static const constexpr KiwiErr err { static const constexpr KiwiErr err {
KiwiErrDuplicateConstraint, KiwiErrDuplicateConstraint,
"The constraint has already been added to the solver."}; "The constraint has already been added to the solver."};
return &err; return &err;
} catch (const UnknownEditVariable& ex) { } catch (const UnknownEditVariable&) {
static const constexpr KiwiErr err { static const constexpr KiwiErr err {
KiwiErrUnknownEditVariable, KiwiErrUnknownEditVariable,
"The edit variable has not been added to the solver."}; "The edit variable has not been added to the solver."};
return &err; return &err;
} catch (const DuplicateEditVariable& ex) { } catch (const DuplicateEditVariable&) {
static const constexpr KiwiErr err { static const constexpr KiwiErr err {
KiwiErrDuplicateEditVariable, KiwiErrDuplicateEditVariable,
"The edit variable has already been added to the solver."}; "The edit variable has already been added to the solver."};
return &err; return &err;
} catch (const BadRequiredStrength& ex) { } catch (const BadRequiredStrength&) {
static const constexpr KiwiErr err { static const constexpr KiwiErr err {
KiwiErrBadRequiredStrength, KiwiErrBadRequiredStrength,
"A required strength cannot be used in this context."}; "A required strength cannot be used in this context."};

View File

@@ -1340,7 +1340,7 @@ static int lkiwi_add_remove_tab(lua_State* L, add_remove_fn_t fn, void* d) {
return 1; return 1;
} }
static const KiwiErr* add_constraint_fn(lua_State* L, KiwiSolver* s, void* d) { static const KiwiErr* add_constraint_fn(lua_State* L, KiwiSolver* s, void*) {
return kiwi_solver_add_constraint(s->solver, *get_constraint(L, -1)); return kiwi_solver_add_constraint(s->solver, *get_constraint(L, -1));
} }
@@ -1348,7 +1348,7 @@ static int lkiwi_solver_add_constraints(lua_State* L) {
return lkiwi_add_remove_tab(L, add_constraint_fn, 0); return lkiwi_add_remove_tab(L, add_constraint_fn, 0);
} }
static const KiwiErr* remove_constraint_fn(lua_State* L, KiwiSolver* s, void* d) { static const KiwiErr* remove_constraint_fn(lua_State* L, KiwiSolver* s, void*) {
return kiwi_solver_remove_constraint(s->solver, *get_constraint(L, -1)); return kiwi_solver_remove_constraint(s->solver, *get_constraint(L, -1));
} }
@@ -1365,7 +1365,7 @@ static int lkiwi_solver_add_edit_vars(lua_State* L) {
return lkiwi_add_remove_tab(L, add_edit_var_fn, &strength); return lkiwi_add_remove_tab(L, add_edit_var_fn, &strength);
} }
static const KiwiErr* remove_edit_var_fn(lua_State* L, KiwiSolver* s, void* d) { static const KiwiErr* remove_edit_var_fn(lua_State* L, KiwiSolver* s, void*) {
return kiwi_solver_remove_edit_var(s->solver, *get_var(L, -1)); return kiwi_solver_remove_edit_var(s->solver, *get_var(L, -1));
} }
@@ -1610,7 +1610,7 @@ static void compat_init(lua_State* L, int context_absi) {
lua_rawseti(L, context_absi, VAR_SUB_FN); lua_rawseti(L, context_absi, VAR_SUB_FN);
} }
#else #else
static void compat_init(lua_State* L, int i) {} static void compat_init(lua_State*, int) {}
#endif /* Lua 5.1 */ #endif /* Lua 5.1 */
#ifdef __cplusplus #ifdef __cplusplus