summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-01-24 08:00:43 -0500
committerDonald Sharp <sharpd@nvidia.com>2021-01-25 09:15:36 -0500
commitea6caa1f523a355cc95a1c73432e595f5ef4ec46 (patch)
tree4fd5e98f7f8e0943a15a16675009edc91c1df568
parent833c1f9fd14c4764b9f36f5e61c57130ff4f7118 (diff)
lib: Wrapper a function to make gcc-10 happy
gcc-10 is complaining: lib/frrscript.c:42:14: error: cast between incompatible function types from ‘const char * (*)(lua_State *, const char *)’ to ‘void (*)(lua_State *, const void *)’ [-Werror=cast-function-type] 42 | .encoder = (encoder_func)lua_pushstring, | ^ Wrapper it to make it happy. Not sure what else to do. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--lib/frrlua.h11
-rw-r--r--lib/frrscript.c2
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/frrlua.h b/lib/frrlua.h
index 8e52931e50..6fb30938b0 100644
--- a/lib/frrlua.h
+++ b/lib/frrlua.h
@@ -35,6 +35,17 @@ extern "C" {
#endif
/*
+ * gcc-10 is complaining about the wrapper function
+ * not being compatible with lua_pushstring returning
+ * a char *. Let's wrapper it here to make our life
+ * easier
+ */
+static inline void lua_pushstring_wrapper(lua_State *L, const char *str)
+{
+ (void)lua_pushstring(L, str);
+}
+
+/*
* Converts a prefix to a Lua value and pushes it on the stack.
*/
void lua_pushprefix(lua_State *L, const struct prefix *prefix);
diff --git a/lib/frrscript.c b/lib/frrscript.c
index a43f389f99..10d400886d 100644
--- a/lib/frrscript.c
+++ b/lib/frrscript.c
@@ -39,7 +39,7 @@ struct frrscript_codec frrscript_codecs_lib[] = {
.encoder = (encoder_func)lua_pushintegerp,
.decoder = lua_tointegerp},
{.typename = "string",
- .encoder = (encoder_func)lua_pushstring,
+ .encoder = (encoder_func)lua_pushstring_wrapper,
.decoder = lua_tostringp},
{.typename = "prefix",
.encoder = (encoder_func)lua_pushprefix,