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:
Saran Tunyasuvunakool
2023-02-10 03:48:12 -08:00
committed by Copybara-Service
parent 8a53a33fd1
commit 5e989d18c3
24 changed files with 150 additions and 76 deletions
+8 -2
View File
@@ -25,6 +25,11 @@
namespace mujoco::python {
namespace {
template <typename T, int N>
constexpr inline std::size_t sizeof_arr(const T(&arr)[N]) {
return sizeof(arr);
}
PYBIND11_MODULE(_simulate, pymodule) {
namespace py = ::pybind11;
using SimulateMutex = decltype(mujoco::Simulate::mtx);
@@ -138,8 +143,9 @@ PYBIND11_MODULE(_simulate, pymodule) {
return simulate.loadError;
},
[](mujoco::Simulate& simulate, const std::string& error) {
std::strncpy(simulate.loadError, error.c_str(),
simulate.kMaxFilenameLength);
const auto max_length = sizeof_arr(simulate.loadError);
std::strncpy(simulate.loadError, error.c_str(), max_length - 1);
simulate.loadError[max_length - 1] = '\0';
});
pymodule.def("setglfwdlhandle", [](std::uintptr_t dlhandle) {