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

Remove union in struct Settings (type punning is UB in C++). #656

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

Jarod42
Copy link
Member

@Jarod42 Jarod42 commented Apr 24, 2024

No description provided.

@Jarod42 Jarod42 merged commit 32bb8f1 into master Apr 24, 2024
3 of 4 checks passed
@Jarod42 Jarod42 deleted the Setting branch April 24, 2024 14:11
@ipochto
Copy link
Member

ipochto commented Apr 25, 2024

Got this:

/src/include/settings.h:263:14: error: ‘uint32_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
[build]   263 |         std::uint32_t getBitfield() const
[build]       |              ^~~~~~~~
[build]       |              wint_t
[build] stratagus/src/include/settings.h:268:26: error: ‘std::uint32_t’ has not been declared
[build]   268 |         void setBitfield(std::uint32_t bitfield)
[build]       |                          ^~~
[build] stratagus/src/include/settings.h: In member function ‘bool Settings::operator==(const Settings&) const’:
[build]stratagus/src/include/settings.h:296:25: error: ‘getBitfield’ was not declared in this scope; did you mean ‘setBitfield’?
[build]   296 |                         getBitfield() == other.getBitfield();
[build]       |                         ^~~~~~~~~~~
[build]       |                         setBitfield
[build] stratagus/src/include/settings.h:296:48: error: ‘const struct Settings’ has no member named ‘getBitfield’; did you mean ‘setBitfield’?
[build]   296 |                         getBitfield() == other.getBitfield();
[build]       |                                                ^~~~~~~~~~~
[build]       |                                                setBitfield
[build] stratagus/src/include/settings.h: In member function ‘void Settings::Save(const std::function<void(std::__cxx11::basic_string<char>)>&, bool)’:
[build] stratagus/src/include/settings.h:316:60: error: ‘getBitfield’ was not declared in this scope; did you mean ‘setBitfield’?
[build]   316 |                 f(std::string("Flags = ") + std::to_string(getBitfield()));
[build]       |                                                            ^~~~~~~~~~~
[build]       |                                                            setBitfield

unit32_t without std:: is ok.

@Jarod42
Copy link
Member Author

Jarod42 commented Apr 25, 2024

Should be fixed by #660

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.

2 participants