From 0138266feec6e2587e90d4fbde156bc65b94cfeb Mon Sep 17 00:00:00 2001 From: Siddharth Purohit Date: Sat, 26 Jun 2021 16:29:19 +0530 Subject: [PATCH] AP_HAL: disable cast align check while casting char* read pointer to object --- libraries/AP_HAL/utility/RingBuffer.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/AP_HAL/utility/RingBuffer.h b/libraries/AP_HAL/utility/RingBuffer.h index 0d014b5dd6..74c91b38b4 100644 --- a/libraries/AP_HAL/utility/RingBuffer.h +++ b/libraries/AP_HAL/utility/RingBuffer.h @@ -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; }