Skip to content

Conversation

illwieckz
Copy link
Member

@illwieckz illwieckz commented Sep 4, 2025

Only include gmp.h on MSVC to disable the warning, add a comment explaining why.


Former comment:

Do not include gmp.h, It is unused.

We need to link against GMP because we link against Nettle that requires it, but it looks like ourselves never use any symbol from GMP directly.

Imported from #1433:

When testing #1433 I was able to rebuild every engine binaries and NaCl VMs in Docker with this commit, I also built dll VM locally fine.

@@ -27,11 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "q_shared.h"
#include "qcommon.h"

#pragma warning(push)
#pragma warning(disable : 4146) // "unary minus operator applied to unsigned type, result still unsigned"
#include <gmp.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Nettle headers include the GMP header. So this may be here just for the warning fix. You could get rid of the GMP include but the MSVC warning adjustment would still need to be used for the Nettle headers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified the commit to only include GMP on MSVC for the purpose of disabling the warning, and added a comment explaining why we do that.

@illwieckz illwieckz changed the title crypto: do not include gmp.h crypto: only include gmp.h on MSVC to disable the warning, add a comment explaining why Sep 4, 2025
@illwieckz illwieckz force-pushed the illwieckz/crypto-gmp branch from a470161 to 6d4808e Compare September 4, 2025 12:16
@slipher
Copy link
Member

slipher commented Sep 5, 2025

LGTM

@illwieckz illwieckz force-pushed the illwieckz/crypto-gmp branch from 6d4808e to 5d14eff Compare September 6, 2025 17:59
@illwieckz
Copy link
Member Author

I modified the ifdef to test for _MSC_VER instead of _WIN32.

@slipher
Copy link
Member

slipher commented Sep 6, 2025

LGTM

@illwieckz illwieckz merged commit 0092988 into master Sep 6, 2025
9 checks passed
@illwieckz illwieckz deleted the illwieckz/crypto-gmp branch September 6, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants