Skip to content

Conversation

@henrygab
Copy link

Fixes #287

The warnings look like:

      Line 338 Char 37
      warning: 'void* memcpy(void*, const void*, size_t)' 
               writing to an object of type 'struct DmacDescriptor'
               with no trivial copy-assignment [-Wclass-memaccess]

Fixes #287

The warnings look like:
```
      Line 338 Char 37
      warning: 'void* memcpy(void*, const void*, size_t)' 
               writing to an object of type 'struct DmacDescriptor'
               with no trivial copy-assignment [-Wclass-memaccess]
```
@ladyada ladyada merged commit 439c6b5 into adafruit:master Apr 30, 2021
@henrygab henrygab deleted the patch-3 branch May 2, 2021 03:27
Copy link
Member

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit late, but I think we can simply suppress this warning by using the assign operator instead of memcpy. Just an opinion, you don't have to make any changes at all. I will do/test it next time, I got to work with the repo.

          for(int i=0; i<numReadDescriptors; i++) {
            extraReadDescriptors[i] = firstReadDescriptor;
          }

@hathach
Copy link
Member

hathach commented May 24, 2021

The above solution does not work due to trivial class initialization issue, I have come to using the good-old void* that could suppress the warning

            memcpy((void*) &extraReadDescriptors[i], firstReadDescriptor,
              sizeof(DmacDescriptor));

@hathach hathach mentioned this pull request May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use of undefined behavior

3 participants