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

Make dtMeshTile POD #2639

Merged
merged 1 commit into from Dec 20, 2019
Merged

Make dtMeshTile POD #2639

merged 1 commit into from Dec 20, 2019

Conversation

akortunov
Copy link
Collaborator

Fixes this warning:

/home/travis/build/OpenMW/openmw/extern/recastnavigation/Detour/Source/DetourNavMesh.cpp: In member function ‘dtStatus dtNavMesh::init(const dtNavMeshParams*)’:
/home/travis/build/OpenMW/openmw/extern/recastnavigation/Detour/Source/DetourNavMesh.cpp:243:50: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct dtMeshTile’ with no trivial copy-assignment [-Wclass-memaccess]
  memset(m_tiles, 0, sizeof(dtMeshTile)*m_maxTiles);
                                                  ^
In file included from /home/travis/build/OpenMW/openmw/extern/recastnavigation/Detour/Source/DetourNavMesh.cpp:22:
/home/travis/build/OpenMW/openmw/extern/recastnavigation/Detour/Include/DetourNavMesh.h:276:8: note: ‘struct dtMeshTile’ declared here
 struct dtMeshTile
        ^~~~~~~~~~

Private constructors without implementation (a pre-C++11 hack to mark constructors as "deleted") make dtMeshTile struct non-POD, so memset can not be used to initialize it.

The simplest solution is to remove such constructors, so dtMeshTile becomes POD, and compilers will not try to optimize data alignment.

R&D developers are not going to fix this issue in their upstream code.

@akortunov akortunov merged commit 2f13300 into OpenMW:master Dec 20, 2019
@psi29a
Copy link
Member

psi29a commented Dec 22, 2019

I'm not a fan of diverging from upstream on extern projects we pull in. Could you at least mark the code that has diverged, that way when we pull in upstream later, we'll see in the diff what code OpenMW has changed.

@akortunov
Copy link
Collaborator Author

#2645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants