Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling with GCC 9 on Linux #155

Open
dmarian opened this issue Nov 19, 2019 · 1 comment
Open

Error compiling with GCC 9 on Linux #155

dmarian opened this issue Nov 19, 2019 · 1 comment

Comments

@dmarian
Copy link

dmarian commented Nov 19, 2019

When compiling with GCC 9 on Linux I get these errors:
Libs/Anvil/src/misc/types_struct.cpp: In constructor ‘Anvil::FormatProperties::FormatProperties()’: Libs/Anvil/src/misc/types_struct.cpp:1168:26: error: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct Anvil::FormatProperties’ with no trivial copy-assignment; use assignment or value-initialization instead [-Werror=class-memaccess] 1168 | sizeof(*this) ); | ^ In file included from Libs/Anvil/include/misc/types_classes.h:25, from Libs/Anvil/include/misc/types.h:286, from Libs/Anvil/include/misc/descriptor_set_create_info.h:26, from Libs/Anvil/src/misc/types_struct.cpp:22: Libs/Anvil/include/misc/types_struct.h:1272:20: note: ‘struct Anvil::FormatProperties’ declared here 1272 | typedef struct FormatProperties | ^~~~~~~~~~~~~~~~ Libs/Anvil/src/misc/types_struct.cpp: In constructor ‘Anvil::SparseImageAspectProperties::SparseImageAspectProperties()’: Libs/Anvil/src/misc/types_struct.cpp:3792:26: error: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct Anvil::SparseImageAspectProperties’ with no trivial copy-assignment; use assignment or value-initialization instead [-Werror=class-memaccess] 3792 | sizeof(*this) ); | ^ In file included from Libs/Anvil/include/misc/types_classes.h:25, from Libs/Anvil/include/misc/types.h:286, from Libs/Anvil/include/misc/descriptor_set_create_info.h:26, from Libs/Anvil/src/misc/types_struct.cpp:22: Libs/Anvil/include/misc/types_struct.h:2854:20: note: ‘struct Anvil::SparseImageAspectProperties’ declared here 2854 | typedef struct SparseImageAspectProperties | ^~~~~~~~~~~~~~~~~~~~~~~~~~~

@VaelynPhi
Copy link

VaelynPhi commented May 1, 2020

Can confirm still an issue; the offending code is the memset in these structs' empty initializers; I think in C++11 forward these can just be empty, as the struct is zero-initialized by default; or like I did just set each member to its empty initializer:

Anvil::SparseImageAspectProperties::SparseImageAspectProperties()
{
        aspect_mask = {};
        flags = {};
        granularity = {};
        mip_tail_first_lod = {};
        mip_tail_offset = {};
        mip_tail_size = {};
        mip_tail_stride = {};

    // memset(this,
    //        0,
    //        sizeof(*this) );
}

And

Anvil::FormatProperties::FormatProperties()
{
    buffer_capabilities = {};
    linear_tiling_capabilities = {};
    optimal_tiling_capabilities = {};
    // memset(this,
    //        0,
    //        sizeof(*this) );
}

@dmarian if you were still trying to build. If any maintainers would like a pull request, I don't mind putting one together, but I imagine ya'll probably have a better notion of what you'd prefer to do here than I.

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

No branches or pull requests

2 participants