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

Fix Wimplicit-fallthrough warnings (#713) #1498

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/utils/xrQSlim/MxPropSlim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ void MxPropSlim::collect_quadrics()
case MX_WEIGHT_AREA:
case MX_WEIGHT_AREA_AVG:
Q *= Q.area();
// no break: fallthrough
[[fallthrough]];

default:
quadric(f[0]) += Q;
quadric(f[1]) += Q;
Expand Down
3 changes: 2 additions & 1 deletion src/utils/xrQSlim/MxQSlim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ void MxQSlim::collect_quadrics()
case MX_WEIGHT_AREA:
case MX_WEIGHT_AREA_AVG:
Q *= Q.area();
// no break: fallthrough
[[fallthrough]];

default:
quadrics(f[0]) += Q;
quadrics(f[1]) += Q;
Expand Down
12 changes: 12 additions & 0 deletions src/xrCDB/Frustum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,39 +106,51 @@ bool CFrustum::testSphere_dirty(const Fvector& c, float r) const
case 12:
if (planes[11].classify(c) > r)
return FALSE;
[[fallthrough]];
case 11:
if (planes[10].classify(c) > r)
return FALSE;
[[fallthrough]];
case 10:
if (planes[9].classify(c) > r)
return FALSE;
[[fallthrough]];
case 9:
if (planes[8].classify(c) > r)
return FALSE;
[[fallthrough]];
case 8:
if (planes[7].classify(c) > r)
return FALSE;
[[fallthrough]];
case 7:
if (planes[6].classify(c) > r)
return FALSE;
[[fallthrough]];
case 6:
if (planes[5].classify(c) > r)
return FALSE;
[[fallthrough]];
case 5:
if (planes[4].classify(c) > r)
return FALSE;
[[fallthrough]];
case 4:
if (planes[3].classify(c) > r)
return FALSE;
[[fallthrough]];
case 3:
if (planes[2].classify(c) > r)
return FALSE;
[[fallthrough]];
case 2:
if (planes[1].classify(c) > r)
return FALSE;
[[fallthrough]];
case 1:
if (planes[0].classify(c) > r)
return FALSE;
[[fallthrough]];
case 0: break;
default: NODEFAULT;
}
Expand Down
6 changes: 6 additions & 0 deletions src/xrCore/XML/tinyxmlparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,20 @@ void TiXmlBase::ConvertUTF32ToUTF8(unsigned long input, char* output, int* lengt
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
[[fallthrough]];

case 3:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
[[fallthrough]];

case 2:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
[[fallthrough]];

case 1: --output; *output = (char)(input | FIRST_BYTE_MARK[*length]);
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/xrPhysics/PHJoint.cpp
Xottab-DUTY marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ CPHJoint::CPHJoint(CPhysicsJoint::enumType type, CPhysicsElement* first, CPhysic
axes.push_back(axis);
axes.push_back(axis2);
axes.push_back(axis3);
[[fallthrough]];

case slider: axes.push_back(axis); axes.push_back(axis);
}
}
Expand Down Expand Up @@ -700,6 +702,7 @@ void CPHJoint::SetForceActive(const int axis_num)
case -1:
dJointSetHinge2Param(m_joint, dParamFMax, axes[0].force);
dJointSetHinge2Param(m_joint, dParamFMax2, axes[1].force);
break;
case 0: dJointSetHinge2Param(m_joint, dParamFMax, axes[0].force); break;
case 1: dJointSetHinge2Param(m_joint, dParamFMax2, axes[1].force); break;
}
Expand All @@ -710,6 +713,7 @@ void CPHJoint::SetForceActive(const int axis_num)
case -1:
dJointSetSliderParam(m_joint, dParamFMax, axes[0].force);
dJointSetAMotorParam(m_joint1, dParamFMax, axes[1].force);
break;
case 0: dJointSetSliderParam(m_joint, dParamFMax, axes[0].force); break;
case 1: dJointSetAMotorParam(m_joint1, dParamFMax, axes[1].force); break;
}
Expand All @@ -724,6 +728,7 @@ void CPHJoint::SetForceActive(const int axis_num)
dJointSetAMotorParam(m_joint1, dParamFMax, axes[0].force);
dJointSetAMotorParam(m_joint1, dParamFMax2, axes[1].force);
dJointSetAMotorParam(m_joint1, dParamFMax3, axes[2].force);
break;
case 0: dJointSetAMotorParam(m_joint1, dParamFMax, axes[0].force); break;
case 1: dJointSetAMotorParam(m_joint1, dParamFMax2, axes[1].force); break;
case 2: dJointSetAMotorParam(m_joint1, dParamFMax3, axes[2].force); break;
Expand Down Expand Up @@ -776,6 +781,7 @@ void CPHJoint::SetVelocityActive(const int axis_num)
case -1:
dJointSetHinge2Param(m_joint, dParamVel, axes[0].velocity);
dJointSetHinge2Param(m_joint, dParamVel2, axes[1].velocity);
break;
case 0: dJointSetHinge2Param(m_joint, dParamVel, axes[0].velocity); break;
case 1: dJointSetHinge2Param(m_joint, dParamVel2, axes[1].velocity); break;
}
Expand All @@ -786,6 +792,7 @@ void CPHJoint::SetVelocityActive(const int axis_num)
case -1:
dJointSetSliderParam(m_joint, dParamVel, axes[0].velocity);
dJointSetAMotorParam(m_joint1, dParamVel, axes[1].velocity);
break;
case 0: dJointSetSliderParam(m_joint, dParamVel, axes[0].velocity); break;
case 1: dJointSetAMotorParam(m_joint1, dParamVel, axes[1].velocity); break;
}
Expand All @@ -800,6 +807,7 @@ void CPHJoint::SetVelocityActive(const int axis_num)
dJointSetAMotorParam(m_joint1, dParamVel, axes[0].velocity);
dJointSetAMotorParam(m_joint1, dParamVel2, axes[1].velocity);
dJointSetAMotorParam(m_joint1, dParamVel3, axes[2].velocity);
break;
case 0: dJointSetAMotorParam(m_joint1, dParamVel, axes[0].velocity); break;
case 1: dJointSetAMotorParam(m_joint1, dParamVel2, axes[1].velocity); break;
case 2: dJointSetAMotorParam(m_joint1, dParamVel3, axes[2].velocity); break;
Expand Down Expand Up @@ -1255,6 +1263,8 @@ void CPHJoint::SetAxisSDfactorsActive(int axis_num)
case 0:
dJointSetSliderParam(m_joint, dParamStopERP, axes[0].erp);
dJointSetSliderParam(m_joint, dParamStopCFM, axes[0].cfm);
[[fallthrough]];

case 1:
dJointSetAMotorParam(m_joint1, dParamStopERP, axes[1].erp);
dJointSetAMotorParam(m_joint1, dParamStopCFM, axes[1].cfm);
Expand Down