Enable compiler errors for implicit switch case fallthroughs.
Also unify warning options across Clang and GCC and fix minor issues that was surfaced by this. PiperOrigin-RevId: 508619655 Change-Id: I59b777bf2dfea4422485670e2427c7d3f5cf6405
This commit is contained in:
committed by
Copybara-Service
parent
8a53a33fd1
commit
5e989d18c3
@@ -316,7 +316,7 @@ int mjc_CapsuleBox(const mjModel* m, const mjData* d, mjContact* con,
|
||||
};
|
||||
mjtNum c[2];
|
||||
} d2;
|
||||
d2 p, s, d, c /*, tmp1*/;
|
||||
d2 p, s, d /*, c, tmp1*/;
|
||||
mjtNum u, v, w, e1, best /* ,e2 */, l /* , e3, e4 */;
|
||||
|
||||
bestdist = bestdistmax;
|
||||
@@ -366,8 +366,8 @@ int mjc_CapsuleBox(const mjModel* m, const mjData* d, mjContact* con,
|
||||
}
|
||||
}
|
||||
|
||||
c.x = s.x * ((c1 / 2) ? -1 : 1);
|
||||
c.y = s.y * ((c1 % 2) ? -1 : 1);
|
||||
// c.x = s.x * ((c1 / 2) ? -1 : 1);
|
||||
// c.y = s.y * ((c1 % 2) ? -1 : 1);
|
||||
|
||||
e1 = fabs(w) / l;
|
||||
// e2 = best / l;
|
||||
|
||||
@@ -540,6 +540,7 @@ void mj_instantiateEquality(const mjModel* m, mjData* d) {
|
||||
|
||||
case mjEQ_DISTANCE:
|
||||
mju_error("distance equality constraints are no longer supported");
|
||||
break;
|
||||
|
||||
default: // SHOULD NOT OCCUR
|
||||
mju_error_i("Invalid equality constraint type %d", m->eq_type[i]);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <mujoco/mjmodel.h>
|
||||
#include "engine/engine_callback.h"
|
||||
#include "engine/engine_core_constraint.h"
|
||||
#include "engine/engine_crossplatform.h"
|
||||
#include "engine/engine_io.h"
|
||||
#include "engine/engine_macro.h"
|
||||
#include "engine/engine_plugin.h"
|
||||
@@ -236,6 +237,7 @@ void mj_comPos(const mjModel* m, mjData* d) {
|
||||
|
||||
// rotation components: same as ball
|
||||
skip = 18;
|
||||
mjFALLTHROUGH;
|
||||
|
||||
case mjJNT_BALL:
|
||||
for (int i=0; i<3; i++) {
|
||||
@@ -1283,6 +1285,7 @@ void mj_comVel(const mjModel* m, mjData* d) {
|
||||
|
||||
// continue with rotations
|
||||
j += 3;
|
||||
mjFALLTHROUGH;
|
||||
|
||||
case mjJNT_BALL:
|
||||
// compute all 3 cdofdots using parent velocity
|
||||
@@ -1349,6 +1352,7 @@ void mj_passive(const mjModel* m, mjData* d) {
|
||||
// continue with rotations
|
||||
dadr += 3;
|
||||
padr += 3;
|
||||
mjFALLTHROUGH;
|
||||
|
||||
case mjJNT_BALL:
|
||||
// covert quatertion difference into angular "velocity"
|
||||
@@ -2032,6 +2036,7 @@ void mj_rnePostConstraint(const mjModel* m, mjData* d) {
|
||||
|
||||
case mjEQ_DISTANCE:
|
||||
mju_error("distance equality constraints are no longer supported");
|
||||
break;
|
||||
|
||||
default:
|
||||
mju_error_i("Unknown constraint type type %d", m->eq_type[id]); // SHOULD NOT OCCUR
|
||||
|
||||
@@ -46,8 +46,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 7
|
||||
#define mjFALLTHROUGH __attribute__ ((fallthrough))
|
||||
#if defined(__cplusplus)
|
||||
#define mjFALLTHROUGH [[fallthrough]]
|
||||
#elif defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 7)
|
||||
#define mjFALLTHROUGH __attribute__((fallthrough))
|
||||
#else
|
||||
#define mjFALLTHROUGH ((void) 0)
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "engine/engine_core_smooth.h"
|
||||
#include "engine/engine_forward.h"
|
||||
#include "engine/engine_core_constraint.h"
|
||||
#include "engine/engine_crossplatform.h"
|
||||
#include "engine/engine_io.h"
|
||||
#include "engine/engine_inverse.h"
|
||||
#include "engine/engine_macro.h"
|
||||
@@ -402,6 +403,7 @@ static void mjd_comVel_vel(const mjModel* m, mjData* d, mjtNum* Dcvel, mjtNum* D
|
||||
|
||||
// continue with rotations
|
||||
j += 3;
|
||||
mjFALLTHROUGH;
|
||||
|
||||
case mjJNT_BALL:
|
||||
// Dcdofdot = D crossMotion(cvel, cdof)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <mujoco/mjplugin.h>
|
||||
#include "engine/engine_callback.h"
|
||||
#include "engine/engine_core_smooth.h"
|
||||
#include "engine/engine_crossplatform.h"
|
||||
#include "engine/engine_io.h"
|
||||
#include "engine/engine_macro.h"
|
||||
#include "engine/engine_plugin.h"
|
||||
@@ -804,6 +805,7 @@ void mj_energyPos(const mjModel* m, mjData* d) {
|
||||
|
||||
// continue with rotations
|
||||
padr += 3;
|
||||
mjFALLTHROUGH;
|
||||
|
||||
case mjJNT_BALL:
|
||||
// covert quatertion difference into angular "velocity"
|
||||
|
||||
@@ -1270,7 +1270,8 @@ void mj_differentiatePos(const mjModel* m, mjtNum* qvel, mjtNum dt,
|
||||
vadr += 3;
|
||||
padr += 3;
|
||||
|
||||
// continute with rotations
|
||||
// continute with rotations
|
||||
mjFALLTHROUGH;
|
||||
|
||||
case mjJNT_BALL:
|
||||
mju_negQuat(neg, qpos1+padr); // solve: qpos1 * dif = qpos2
|
||||
@@ -1304,7 +1305,8 @@ void mj_integratePos(const mjModel* m, mjtNum* qpos, const mjtNum* qvel, mjtNum
|
||||
padr += 3;
|
||||
vadr += 3;
|
||||
|
||||
// continue with rotation update
|
||||
// continue with rotation update
|
||||
mjFALLTHROUGH;
|
||||
|
||||
case mjJNT_BALL:
|
||||
// quaternion update
|
||||
|
||||
@@ -62,6 +62,7 @@ static void makeLabel(const mjModel* m, mjtObj type, int id, char* label) {
|
||||
|
||||
// copy result into label
|
||||
strncpy(label, txt, 99);
|
||||
label[99] = '\0';
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user