Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation warning about fpconv_init #81

Open
graywolf-at-work opened this issue Mar 15, 2022 · 0 comments
Open

Compilation warning about fpconv_init #81

graywolf-at-work opened this issue Mar 15, 2022 · 0 comments

Comments

@graywolf-at-work
Copy link

cc -c -O3 -Wall -pedantic -DNDEBUG  -I/usr/local/include -fpic -o lua_cjson.o lua_cjson.c
In file included from lua_cjson.c:48:
fpconv.h:15:20: warning: inline function ‘fpconv_init’ declared but never defined
   15 | extern inline void fpconv_init();
      |                    ^~~~~~~~~~~
cc -c -O3 -Wall -pedantic -DNDEBUG  -I/usr/local/include -fpic -o strbuf.o strbuf.c
cc -c -O3 -Wall -pedantic -DNDEBUG  -I/usr/local/include -fpic -o fpconv.o fpconv.c
cc  -shared -o cjson.so lua_cjson.o strbuf.o fpconv.o

I cannot imagine what good the inline without body is. I've compiled with the following patch and everything seems to work fine.

From c9551b68ec78ecea8d31af41bbffc2f4a39d1965 Mon Sep 17 00:00:00 2001
From: Tomas Volf <tomas.volf@showmax.com>
Date: Tue, 15 Mar 2022 18:30:24 +0100
Subject: [PATCH] Fix compilation warning about fpconv_init
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In file included from lua_cjson.c:48:
fpconv.h:15:20: warning: inline function ‘fpconv_init’ declared but never defined
   15 | extern inline void fpconv_init();
      |                    ^~~~~~~~~~~

inline does not seem to do anything useful here, since there is no body
to inline. And extern is default. So let's just drop both, we get no
warning and everything still works.
---
 fpconv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fpconv.h b/fpconv.h
index 0124908..22cab98 100644
--- a/fpconv.h
+++ b/fpconv.h
@@ -12,7 +12,7 @@ static inline void fpconv_init()
     /* Do nothing - not required */
 }
 #else
-extern inline void fpconv_init();
+void fpconv_init();
 #endif

 extern int fpconv_g_fmt(char*, double, int);
--
2.35.1

rzanol pushed a commit to rzanol/lua-cjson that referenced this issue Sep 21, 2023
…re light userdata address with masked address (mpx#82)

Since we used `json_lightudata_mask` when creating lightuserdata, same
mask should be applied when comparing the return of `touserdata`

Fixes mpx#81.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant