mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-11 17:13:56 -03:00
AP_HAL: fix unit test compilation due to -Werror=format-truncation
This commit is contained in:
parent
b5d21a71ef
commit
3f9a4ee5f9
@ -36,7 +36,10 @@ TEST(vsnprintf_Test, Basic)
|
|||||||
}
|
}
|
||||||
{ // ensure rest of buffer survives
|
{ // ensure rest of buffer survives
|
||||||
memset(output, 'A', 10);
|
memset(output, 'A', 10);
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-truncation"
|
||||||
const int bytes_required = snprintf(output, 5, "012345678");
|
const int bytes_required = snprintf(output, 5, "012345678");
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
EXPECT_TRUE(streq(output, "0123"));
|
EXPECT_TRUE(streq(output, "0123"));
|
||||||
EXPECT_EQ(bytes_required, 9);
|
EXPECT_EQ(bytes_required, 9);
|
||||||
EXPECT_EQ(output[6], 'A');
|
EXPECT_EQ(output[6], 'A');
|
||||||
|
Loading…
Reference in New Issue
Block a user