From 51bd7a7967acabd0be4329215f197709d8f235f2 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 24 May 2021 21:31:52 +0700 Subject: [PATCH] better fix warning with "-Wclass-memaccess" in SPI --- libraries/SPI/SPI.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index 5a321b56..48a7b99b 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -333,24 +333,16 @@ void SPIClass::dmaAllocate(void) { use_dma = true; // Everything allocated successfully extraWriteDescriptors = &extraReadDescriptors[numReadDescriptors]; - // dmac.h didn't include extern "C" which cause - // DmacDescriptor and its members are defined as C++ struct therefore - // memcpy will throw warning on copying where simple assignment won't work - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wclass-memaccess" - // Initialize descriptors (copy from first ones) + // cast to void* to suppress warning: with no trivial copy-assignment [-Wclass-memaccess] for(int i=0; i