File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -332,21 +332,25 @@ void SPIClass::dmaAllocate(void) {
332332 totalDescriptors * sizeof (DmacDescriptor)))) {
333333 use_dma = true ; // Everything allocated successfully
334334 extraWriteDescriptors = &extraReadDescriptors[numReadDescriptors];
335+
336+ // dmac.h didn't include extern "C" which cause
337+ // DmacDescriptor and its members are defined as C++ struct therefore
338+ // memcpy will throw warning on copying where simple assignment won't work
339+ #pragma GCC diagnostic push
340+ #pragma GCC diagnostic ignored "-Wclass-memaccess"
341+
335342 // Initialize descriptors (copy from first ones)
336343 for (int i=0 ; i<numReadDescriptors; i++) {
337- #pragma GCC diagnostic push
338- #pragma GCC diagnostic ignored "-Wclass-memaccess"
339344 memcpy (&extraReadDescriptors[i], firstReadDescriptor,
340345 sizeof (DmacDescriptor));
341- #pragma GCC diagnostic pop
342346 }
343347 for (int i=0 ; i<numWriteDescriptors; i++) {
344- #pragma GCC diagnostic push
345- #pragma GCC diagnostic ignored "-Wclass-memaccess"
346348 memcpy (&extraWriteDescriptors[i], firstWriteDescriptor,
347349 sizeof (DmacDescriptor));
348- #pragma GCC diagnostic pop
349350 }
351+
352+ #pragma GCC diagnostic pop
353+
350354 } // end malloc
351355 } // end extra descriptor check
352356
You can’t perform that action at this time.
0 commit comments