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

Compile mpqapi.cpp as C #554

Merged
merged 2 commits into from
Jan 5, 2019
Merged

Compile mpqapi.cpp as C #554

merged 2 commits into from
Jan 5, 2019

Conversation

AJenbo
Copy link
Member

@AJenbo AJenbo commented Jan 5, 2019

Bin exactness of the file is not affected.

@AJenbo AJenbo mentioned this pull request Jan 5, 2019
38 tasks
@mewmew
Copy link
Contributor

mewmew commented Jan 5, 2019

Does the C compiler have const?

@AJenbo
Copy link
Member Author

AJenbo commented Jan 5, 2019

Yes const can be applied to variables.

@squidcc
Copy link
Contributor

squidcc commented Jan 5, 2019

Not sure why you're removing all the consts since they have no bearing on C++ -> C, plus it does break binary exactness.

pfile_encode_hero() calls mpqapi_write_file() with a literal constant string "hero", by removing the const specifier from the function definition that string can't be passed as a pointer to .rdata (which is what the original code does).

@mewmew
Copy link
Contributor

mewmew commented Jan 5, 2019

pfile_encode_hero() calls mpqapi_write_file() with a literal constant string "hero", by removing the const specifier from the function definition that string can't be passed as a pointer to .rdata (which is what the original code does).

That's a good point. DIdn't know exactly how the compiler decides which segment to put string literal in.

@mewmew
Copy link
Contributor

mewmew commented Jan 5, 2019

@AJenbo would mpqapi.cpp also compile with the consts? If so, lets keep them. Was there any other issues that prevent us from compiling this file with /Tc?

@AJenbo
Copy link
Member Author

AJenbo commented Jan 5, 2019

As described in #528; compiling mpqapi.cpp as C was causing the compiler to emit some errors. Looking at it I found that the issue was introduced in this commit e2adda1 where the const where added, reverting the const resolved the build issue. Looking closer at the issue now I noticed that it's because the header file was not correctly updated when they where added. I have changed this PR to fix this issue instead.

@mewmew
Copy link
Contributor

mewmew commented Jan 5, 2019

As described in #528; compiling mpqapi.cpp as C was causing the compiler to emit some errors. Looking at it I found that the issue was introduced in this commit e2adda1 where the const where added, reverting the const resolved the build issue. Looking closer at the issue now I noticed that it's because the header file was not correctly updated when they where added. I have changed this PR to fix this issue instead.

Ah, that makes sense. Thanks!

Copy link
Contributor

@mewmew mewmew left a comment

Choose a reason for hiding this comment

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

LGTM.

@mewmew mewmew merged commit 98b0b5e into diasurgical:nightly Jan 5, 2019
@AJenbo AJenbo deleted the mpqapi.cpp branch January 6, 2019 00:01
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

Successfully merging this pull request may close these issues.

None yet

3 participants