-
Notifications
You must be signed in to change notification settings - Fork 105
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 in C++ fails when -Wpedantic and -Werror=unused-parameter flags are used #585
Comments
Patches are welcome for the first one but the code has a ton of unused parameters so it'll be tedious to get rid of all then I'm afraid! |
This is the whole error log so there are only a few functions defined in the header file that cause this behaviour. The definitions can be either moved to the source file or the unused parameters to be casted to void - like The bigger issue is with the macro - I am not an expert in that area and not sure what C++ will like. |
If I change the JS_MKVAL macro to the following:
and cast the unused variables to void, the code now compiles. But not sure do the rest of the macros like JS_MKPTR and JS_NAN need this too? Maybe they do not generate errors because they are currently not used in the code I am compiling. |
Will these codes work? |
@wuqi yes, this compiles and works but I think the issue is more complex. I tried to use one of the other macros to test it and I now get a different error message:
So I may need to handle this in a different way |
Maybe a more pragmatic solution is to disable warnings inside the header file, e.g. // at the top
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
// etc.
//...
// and at the bottom
#pragma GCC diagnostic pop |
Once #615 lands (more accurately: if and when I figure out to invoke standalone cl.exe on the CI), I'll follow up with a pull request to make quickjs.h |
I am happy to test on Linux with my strict flags settings before you merge if you provide a commit hash. |
The pull request is now open: #628 |
I just merged it. LMK if you still get build errors. |
I tested the current master branch and my build with strict flags now passes. Thanks! |
I am compiling the library with relaxed flags but I have stricter flags on my C++ code. And because my code includes quickjs.h I get the errors below
The text was updated successfully, but these errors were encountered: