Remove empty initializers to ensure MSVC compatibility.
Add -Wgnu-empty-initializer to Clang builds to catch this issue in the future. Initialising arrays with empty braces is not part of the C standard and fails on MSVC. This commit should catch the issue earlier by detecting it in Clang. PiperOrigin-RevId: 517373961 Change-Id: I518006e84151e8d5b45a7fe00ba7675dfb031ca0
This commit is contained in:
committed by
Copybara-Service
parent
70959c1a2c
commit
ee566eb880
@@ -93,6 +93,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang
|
||||
-Wno-int-in-bool-context
|
||||
-Wno-sign-compare
|
||||
-Wno-unknown-pragmas
|
||||
-Wgnu-empty-initializer
|
||||
)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# Set -Wimplicit-fallthrough=5 to only allow fallthrough annotation via __attribute__.
|
||||
|
||||
@@ -93,6 +93,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang
|
||||
-Wno-int-in-bool-context
|
||||
-Wno-sign-compare
|
||||
-Wno-unknown-pragmas
|
||||
-Wgnu-empty-initializer
|
||||
)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# Set -Wimplicit-fallthrough=5 to only allow fallthrough annotation via __attribute__.
|
||||
|
||||
@@ -93,6 +93,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang
|
||||
-Wno-int-in-bool-context
|
||||
-Wno-sign-compare
|
||||
-Wno-unknown-pragmas
|
||||
-Wgnu-empty-initializer
|
||||
)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# Set -Wimplicit-fallthrough=5 to only allow fallthrough annotation via __attribute__.
|
||||
|
||||
@@ -222,8 +222,8 @@ void mj_collideTree(const mjModel* m, mjData* d, int b1, int b2,
|
||||
const mjtNum* bvh2 = m->bvh_aabb + 6 * bvhadr2;
|
||||
const int* child1 = m->bvh_child + 2 * bvhadr1;
|
||||
const int* child2 = m->bvh_child + 2 * bvhadr2;
|
||||
mjtNum product[36] = {}; // 2 bb x 2 bb x 3 axes (body) x 3 axes (world)
|
||||
mjtNum offset[12] = {}; // 2 bb x 2 bb x 3 axes (world)
|
||||
mjtNum product[36]; // 2 bb x 2 bb x 3 axes (body) x 3 axes (world)
|
||||
mjtNum offset[12]; // 2 bb x 2 bb x 3 axes (world)
|
||||
mjtByte initialize = 1;
|
||||
|
||||
mjMARKSTACK;
|
||||
|
||||
@@ -757,7 +757,7 @@ int mjCBody::MakeBVH(std::vector<mjCGeom *>& elements, int lev) {
|
||||
mjtNum vert[3] = {elements[i]->pos[0] - ipos[0],
|
||||
elements[i]->pos[1] - ipos[1],
|
||||
elements[i]->pos[2] - ipos[2]};
|
||||
mjtNum lpos[3] = {};
|
||||
mjtNum lpos[3];
|
||||
mju_rotVecQuat(lpos, vert, qinv);
|
||||
pos[i] = lpos[axis];
|
||||
}
|
||||
@@ -776,7 +776,7 @@ int mjCBody::MakeBVH(std::vector<mjCGeom *>& elements, int lev) {
|
||||
mjtNum vert[3] = {elements[i]->pos[0] - ipos[0],
|
||||
elements[i]->pos[1] - ipos[1],
|
||||
elements[i]->pos[2] - ipos[2]};
|
||||
mjtNum lpos[3] = {};
|
||||
mjtNum lpos[3];
|
||||
mju_rotVecQuat(lpos, vert, qinv);
|
||||
|
||||
// skip visual objects
|
||||
|
||||
Reference in New Issue
Block a user