Skip to content

FastLED compiler warnings on gcc/linux #985

Closed

Description

@marcmerlin

I'm not sure if they are worth fixing/easy to fix. Full list attached:
out.txt

libraries/FastLED/colorutils.h: In copy constructor ‘CHSVPalette16::CHSVPalette16(const CHSVPalette16&)’:
libraries/FastLED/colorutils.h:455:69: warning: ‘void* memmove(void*, const void*, size_t)’ writing to an object of type ‘struct CHSV’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
         memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
                                                                     ^
In file included from libraries/FastLED/controller.h:9,
                 from libraries/FastLED/FastLED.h:47,
                 from examples/GFX_Table_Mark_Estes/neomatrix_config.h:112,
                 from examples/GFX_Table_Mark_Estes/Table_Mark_Estes.ino:5,
                 from src/main.cpp:13:
libraries/FastLED/pixeltypes.h:23:8: note: ‘struct CHSV’ declared here
 struct CHSV {
        ^~~~
In file included from libraries/FastLED/FastLED.h:58,
                 from examples/GFX_Table_Mark_Estes/neomatrix_config.h:112,
                 from examples/GFX_Table_Mark_Estes/Table_Mark_Estes.ino:5,
                 from src/main.cpp:13:
libraries/FastLED/colorutils.h: In member function ‘CHSVPalette16& CHSVPalette16::operator=(const CHSVPalette16&)’:
libraries/FastLED/colorutils.h:459:69: warning: ‘void* memmove(void*, const void*, size_t)’ writing to an object of type ‘struct CHSV’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
         memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));
                                                                     ^
In file included from libraries/FastLED/controller.h:9,
                 from libraries/FastLED/FastLED.h:47,
                 from examples/GFX_Table_Mark_Estes/neomatrix_config.h:112,
                 from examples/GFX_Table_Mark_Estes/Table_Mark_Estes.ino:5,
                 from src/main.cpp:13:
libraries/FastLED/pixeltypes.h:23:8: note: ‘struct CHSV’ declared here
 struct CHSV {
        ^~~~
In file included from libraries/FastLED/FastLED.h:58,
                 from examples/GFX_Table_Mark_Estes/neomatrix_config.h:112,
                 from examples/GFX_Table_Mark_Estes/Table_Mark_Estes.ino:5,
                 from src/main.cpp:13:
libraries/FastLED/colorutils.h: In copy constructor ‘CHSVPalette256::CHSVPalette256(const CHSVPalette256&)’:
libraries/FastLED/colorutils.h:558:69: warning: ‘void* memmove(void*, const void*, size_t)’ writing to an object of type ‘struct CHSV’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
         memmove8( &(entries[0]), &(rhs.entries[0]), sizeof( entries));

Activity

  1. 5chmidti commented on Mar 21, 2020

    @5chmidti
    Contributor

    How about casting to a void* to get around it being recognized as a struct CHSV in memmove8. Because the copy constructor of CHSVPalette16 is using memmove anyways, there is no need to have it complain about not having a trivial copy constructor. (I guess this is true for all CHSVPalettes)
    Would need to cast at ln 455 and 459 to test this. I cant, as I would need a newer gcc version

    EDIT: see #971 (comment)

  2. added a commit that references this issue on Mar 24, 2020
  3. marcmerlin commented on Mar 24, 2020

    @marcmerlin
    ContributorAuthor

    Thanks @5chmidti this did quiet the warnings, I just wanted to make sure that this was ok/safe to do.
    MarcFork@be2013e

  4. marcmerlin commented on Mar 24, 2020

    @marcmerlin
    ContributorAuthor

    I cherry picked this into master: #986
    Not sure who has review power outside of @kriegsman , do you by any chance?

  5. 5chmidti commented on Mar 25, 2020

    @5chmidti
    Contributor

    I believe everybody can review changes in a pull request. Merging is reserved for people with write permission.

    I looked at it once more and wrote something in the pr to completely remove the warning instead of going around it.

  6. 5chmidti commented on Mar 27, 2020

    @5chmidti
    Contributor

    As I've said in the pr (should have stayed here, to keep the discussion in here):

    I've done a quick test on the following (only if it compiles on c++14, but this should be correct according to the standard):
    Why not just outright remove the warnings about CRGB and CHSV not being trivially copyable instead of casting the warning away?
    By simply removing the user defined copy constructor' and copy assignments', CRGB and CHSV could simply be made trivially copyable by using the default copy constructor and copy assignment. One could write explicitly that we want to use the default with for example:
    inline CRGB &operator=(const CRGB &rhs) __attribute__((always_inline)) = default;
    Which I guess could be preferrable or even necessary because we have other copy assignments with other arguments for CRGB, as I don't know if the copy assignment for CRGB would be deleted.
    After that the warnings shouldn't be there anymore, as the types would be trivially copyable.

    I've gone ahead and commited these changes to my fork.

    Performance wise there shouldn't be a difference between this and the master, but if someone knows how to reliably check, please do so. I've done some testing myself and found that they are about the same (no major difference / within margin of error).

  7. 5chmidti commented on Mar 28, 2020

    @5chmidti
    Contributor

    I've opened #990
    There was actually a similar discussion at #971

  8. marcmerlin commented on Mar 28, 2020

    @marcmerlin
    ContributorAuthor

    Thanks for following up on this (been busy/distracted with other things)

  9. added
    area: core
    status: stale
    status: triage
    on Apr 16, 2026
  10. zackees commented on Aug 20, 2026

    @zackees
    Member

    Resolved by #986 and #990. Verified: both PRs merged to master; #986 removed the reported palette memmove warning sites and #990 made CRGB/CHSV copy construction and assignment trivial, which the current implementation retains.

  11. moved this from Triage to Done in FastLED Trackeron Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: corestatus: stalestatus: triage

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions