Disallow variable-length arrays and turn on -Wpedantic in Clang and GCC.
PiperOrigin-RevId: 562832747 Change-Id: I0532624cee31e089a47426305d885687eb0fc5c5
This commit is contained in:
committed by
Copybara-Service
parent
8ffdee355a
commit
329ed193ac
@@ -23,7 +23,7 @@
|
||||
namespace mujoco {
|
||||
namespace {
|
||||
|
||||
constexpr int kBufferSize = 1000;
|
||||
constexpr int kBufferSize = 1024;
|
||||
|
||||
char* ErrorMessageBuffer() {
|
||||
static char error_message[kBufferSize] = "";
|
||||
@@ -132,5 +132,13 @@ TEST_F(MujocoErrorAndWarningTest, MjuWarningS) {
|
||||
EXPECT_EQ(std::string(WarningMessageBuffer()), expected_message);
|
||||
}
|
||||
|
||||
TEST_F(MujocoErrorAndWarningTest, MjuErrorInternal) {
|
||||
ClearErrorMessage();
|
||||
mjERROR("foobar %d", 123);
|
||||
std::string funcname(__func__);
|
||||
ASSERT_TRUE(funcname.length());
|
||||
EXPECT_EQ(std::string(ErrorMessageBuffer()), funcname + ": foobar 123");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace mujoco
|
||||
|
||||
Reference in New Issue
Block a user