AP_HAL: disable cast align check while casting char* read pointer to object

This commit is contained in:
Siddharth Purohit 2021-06-26 16:29:19 +05:30 committed by Andrew Tridgell
parent 3c9bc52b64
commit 0138266fee

View File

@ -238,7 +238,10 @@ public:
// !!! Note ObjectBuffer_TS is a duplicate of this, update in both places !!!
const T *readptr(uint32_t &n) {
uint32_t avail_bytes = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
const T *ret = (const T *)buffer->readptr(avail_bytes);
#pragma pop
if (!ret || avail_bytes < sizeof(T)) {
return nullptr;
}
@ -414,7 +417,10 @@ public:
const T *readptr(uint32_t &n) {
WITH_SEMAPHORE(sem);
uint32_t avail_bytes = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
const T *ret = (const T *)buffer->readptr(avail_bytes);
#pragma pop
if (!ret || avail_bytes < sizeof(T)) {
return nullptr;
}