Skip to content

Use void casts to silence warnings about memcpy to a class#3800

Merged
BenzhengZhang merged 1 commit intocisco:masterfrom
mstorsjo:silence-class-memaccess
Nov 18, 2024
Merged

Use void casts to silence warnings about memcpy to a class#3800
BenzhengZhang merged 1 commit intocisco:masterfrom
mstorsjo:silence-class-memaccess

Conversation

@mstorsjo
Copy link
Copy Markdown
Contributor

@mstorsjo mstorsjo commented Nov 7, 2024

This was previously silenced by passing -Wno-class-memaccess, to the compiler, if it was supported (for GCC, it was supported since GCC 8).

Clang supports a similar option, -Wno-nontrivial-memaccess since Clang 8. It didn't use to warn about these cases, but since Clang 20, it also warns about this.

Simplify handling the issue by just adding void casts, to avoid needing to check for whether the options for silencing the warnings are supported.

This silences these warnings when building with Clang 20.

This was previously silenced by passing -Wno-class-memaccess, to
the compiler, if it was supported (for GCC, it was supported since
GCC 8).

Clang supports a similar option, -Wno-nontrivial-memaccess since
Clang 8. It didn't use to warn about these cases, but since Clang 20,
it also warns about this.

Simplify handling the issue by just adding void casts, to avoid
needing to check for whether the options for silencing the warnings
are supported.
@BenzhengZhang BenzhengZhang merged commit 6746bc4 into cisco:master Nov 18, 2024
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.

2 participants