]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Wrapper a function to make gcc-10 happy 7923/head
authorDonald Sharp <sharpd@nvidia.com>
Sun, 24 Jan 2021 13:00:43 +0000 (08:00 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 25 Jan 2021 14:15:36 +0000 (09:15 -0500)
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>
lib/frrlua.h
lib/frrscript.c

index 8e52931e503ab5c6f457ff1823ba119daefa544b..6fb30938b061d5bedd4cc5328cd90f850bb68f72 100644 (file)
 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.
  */
index a43f389f99760ce46caf90fa23bb58b20b309784..10d400886d835de6e55b5d8459d76b5c1e1527d1 100644 (file)
@@ -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,