Skip to content

Conversation

@Diapolo
Copy link

@Diapolo Diapolo commented May 15, 2015

No description provided.

@paveljanik
Copy link
Contributor

Can you please explain how this could help?

@paveljanik
Copy link
Contributor

Hmm, looks like I was looking at the older version of the file ;-)
It is clear from the current version. I do not like these #ifdefs all around one file though. But your change really fixes the problem introduced, so ACK.

@laanwj
Copy link
Member

laanwj commented May 15, 2015

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).

@laanwj laanwj added the GUI label May 15, 2015
@luke-jr
Copy link
Member

luke-jr commented May 15, 2015

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.

@theuni
Copy link
Member

theuni commented May 15, 2015

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.

@laanwj
Copy link
Member

laanwj commented May 16, 2015

Agree that an anonymous namespace is the way to go.

Copy link
Contributor

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.

Copy link
Member

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.

@laanwj
Copy link
Member

laanwj commented May 18, 2015

@Diapolo can you check laanwj@0dab129

@Diapolo
Copy link
Author

Diapolo commented May 18, 2015

@laanwj Seems like you've got a working patch, feel free to pull that ;).

laanwj added a commit that referenced this pull request May 19, 2015
Enclose MakeSingleColorImage in an anonymous namespace to avoid a
unused function warning on Windows and MacOSX.

Github-Pull: #6143
@laanwj
Copy link
Member

laanwj commented May 19, 2015

Done via e2e7f95

@laanwj laanwj closed this May 19, 2015
@Diapolo Diapolo deleted the unused_func branch May 19, 2015 10:15
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants