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

Request: clean up build warnings so compiles cleanly #17

Open
xandark opened this issue May 14, 2024 · 2 comments
Open

Request: clean up build warnings so compiles cleanly #17

xandark opened this issue May 14, 2024 · 2 comments

Comments

@xandark
Copy link

xandark commented May 14, 2024

Excellent project and just getting better. Every time I compile it, I get a lot of compile warnings which don't inspire confidence though. I just have to trust that everything works.

In particular, I see a lot of warn_unused_result warnings. Could these be cleaned up in the code so that they're not generated?

@buserror
Copy link
Owner

What OS version and what compiler are you using?
I know that ubuntu has some stupid default compile flags that triggers all kind of non-warning. The code is compiled with -Wall and -Wextra -- that is largely enough already!
Fixing 'warn_unused_result' warning often involve adding a "fake" expression around it to trick the compiler. It doesn't help the 'safety' and it makes the code less readable.
Or add -Wno-warn-unused_result to the Makefile that will make them all disappear! :-)
(there is already a line with -Wno-unused-parameter -Wno-unused-function )

@xandark
Copy link
Author

xandark commented May 16, 2024

gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

Fixing 'warn_unused_result' warning often involve adding a "fake" expression around it to trick the compiler. It doesn't help the 'safety' and it makes the code less readable.

I agree, I'm just wondering how to adjust the pragmas to make the noise go away.

I added -Wno-warn-unused-result and -Wno-unused-result to line 24 of Makefile, and I am still getting a spew of ‘warn_unused_result’ [-Wunused-result] warnings. Sorry, I'm not an expert in modern day C/C++ build scaffoldings.

I'm also getting this warnings at the start of the build telling me that it doesn't understand the directive:

libmish/src/minipt.h:28:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]

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

2 participants