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

Refactoring code and fixes: cmake, crashes and codecy #1005

Merged
merged 5 commits into from
May 9, 2022
Merged

Refactoring code and fixes: cmake, crashes and codecy #1005

merged 5 commits into from
May 9, 2022

Conversation

NIKEA-SOFT
Copy link
Contributor

No description provided.

Copy link
Contributor

@lmoureaux lmoureaux left a comment

Choose a reason for hiding this comment

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

Very easy to review! It's clear that the second commit changes nothing, which let me focus on the rest of the code. I have two minor comments on the last commit, I leave them to you (i.e. do as you prefer).

Apparently we see in #999 that adding the header files to CMakeLists isn't necessary for VS 2022. I think we can still merge this PR while we figure out whether this is indeed the case, since the change could be reverted without breaking the blame too much (I would prefer to have only the .cpp if possible, since that's how CMake is intended to work and it's less verbose).

common/aicore/cm.h Outdated Show resolved Hide resolved
common/aicore/path_finding.cpp Outdated Show resolved Hide resolved
@jwrober
Copy link
Collaborator

jwrober commented May 6, 2022

When I run a build of this PR I am seeing a lot more warnings that from what we see on master branch right now.

common/packets_gen.cpp:8284:48: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct packet_city_info’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
common/packets_gen.cpp:8766:32: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct packet_city_info’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
common/packets_gen.cpp:12111:48: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct packet_city_manager’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
common/packets_gen.cpp:12161:32: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct packet_city_manager’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
../client/governor.cpp:439:46: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct cm_parameter’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
../server/citytools.cpp:2609:66: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct cm_parameter’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
../client/packhand.cpp:170:66: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct player’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

Not sure if this is an issue or not, just making mention of it.

@NIKEA-SOFT
Copy link
Contributor Author

When I run a build of this PR I am seeing a lot more warnings that from what we see on master branch right now.

common/packets_gen.cpp:8284:48: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct packet_city_info’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
common/packets_gen.cpp:8766:32: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct packet_city_info’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
common/packets_gen.cpp:12111:48: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct packet_city_manager’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
common/packets_gen.cpp:12161:32: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct packet_city_manager’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
../client/governor.cpp:439:46: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘struct cm_parameter’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
../server/citytools.cpp:2609:66: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct cm_parameter’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
../client/packhand.cpp:170:66: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct player’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]

Not sure if this is an issue or not, just making mention of it.

Thank you for writing about this.
The problem is that the copy assignment operator defined by me changed the structure and it ceased to be a POD.
Fixed.

@lmoureaux lmoureaux merged commit 65cd09c into longturn:master May 9, 2022
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this pull request May 9, 2022
The headers were added because Microsoft Visual Studio's "Solution" view
doesn't show the headers.  However, VS' built-in CMake handling doesn't use the
solution view and is based on folders (much like CMake itself).  There is no
recommendation from the CMake side on how to handle this problem with CMake's
built-in generators for Visual Studio.

Following the VS documentation and the instructions added in longturn#999, one can get
(at least) decent VS support with IntelliSense working.  This doesn't require
keeping the headers in the CMakeLists, so remove them for more idiomatic CMake
code.

This reverts part of commit 6e38a15.
See longturn#1005.
lmoureaux added a commit that referenced this pull request May 10, 2022
The headers were added because Microsoft Visual Studio's "Solution" view
doesn't show the headers.  However, VS' built-in CMake handling doesn't use the
solution view and is based on folders (much like CMake itself).  There is no
recommendation from the CMake side on how to handle this problem with CMake's
built-in generators for Visual Studio.

Following the VS documentation and the instructions added in #999, one can get
(at least) decent VS support with IntelliSense working.  This doesn't require
keeping the headers in the CMakeLists, so remove them for more idiomatic CMake
code.

This reverts part of commit 6e38a15.
See #1005.
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.

3 participants