-
Notifications
You must be signed in to change notification settings - Fork 38.6k
[Qt] fix unused function warning in scicon.cpp #6143
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
Conversation
|
Can you please explain how this could help? |
|
Hmm, looks like I was looking at the older version of the file ;-) |
|
I'm not too happy about this. If the code can compile on all platforms the compiler should do it, this makes it less likely that someone will push code that doesn't work on all platforms. I'm sure there is another way to disable the warning (one is to make the function non-static). |
|
Making it non-static is liable to cause the binaries to be unnecessarily larger too. If we want to disable unused code warnings, I'm sure there's a compiler option for that. |
|
These should really all be runtime checks anyway. As for making it non-static, anon namespace is the c++ way to handle that. That lets the compiler know that if it's not used in the compilation unit, it's safe to prune. |
|
Agree that an anonymous namespace is the way to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about wrapping L16-L24 with the #ifdefs and remove the ifdef at L30 below?
This will probably remove the warning, keep the amounts of ifdefs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is not to reduce the number of ifdefs, but to require the compiler to compile the largest possible share of the code on all platforms.
|
@Diapolo can you check laanwj@0dab129 |
|
@laanwj Seems like you've got a working patch, feel free to pull that ;). |
Enclose MakeSingleColorImage in an anonymous namespace to avoid a unused function warning on Windows and MacOSX. Github-Pull: #6143
|
Done via e2e7f95 |
No description provided.