[Nit] Fixup nontrivial memcall warning

* Silenced -Wnontrivial-memcall in asmjit

* Silenced -Wnontrivial-memcall in tools

* Silenced -Wnontrivial-memcall

* (to squash) Silenced -Wnontrivial-memcall (as reviewed by Jay)

* (to squash) Silenced -Wnontrivial-memcall (as reviewed by Jay [again])
This commit is contained in:
Marcus Minhorst 2025-09-19 15:38:53 -04:00 committed by GitHub
commit e2bd23dfa0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 156 additions and 76 deletions

View file

@ -37,15 +37,17 @@ public:
// [Construction / Destruction]
// --------------------------------------------------------------------------
ASMJIT_INLINE CpuFeatures() noexcept { reset(); }
ASMJIT_INLINE CpuFeatures(const CpuFeatures& other) noexcept { init(other); }
ASMJIT_INLINE CpuFeatures() noexcept : _bits{} {}
ASMJIT_INLINE CpuFeatures(const CpuFeatures& other) noexcept = default;
ASMJIT_INLINE CpuFeatures& operator=(const CpuFeatures& other) noexcept = default;
// --------------------------------------------------------------------------
// [Init / Reset]
// --------------------------------------------------------------------------
ASMJIT_INLINE void init(const CpuFeatures& other) noexcept { ::memcpy(this, &other, sizeof(*this)); }
ASMJIT_INLINE void reset() noexcept { ::memset(this, 0, sizeof(*this)); }
ASMJIT_INLINE void init(const CpuFeatures& other) noexcept { *this = other; }
ASMJIT_INLINE void reset() noexcept { *this = CpuFeatures{}; }
// --------------------------------------------------------------------------
// [Ops]
@ -248,8 +250,21 @@ public:
// [Construction / Destruction]
// --------------------------------------------------------------------------
ASMJIT_INLINE CpuInfo() noexcept { reset(); }
ASMJIT_INLINE CpuInfo(const CpuInfo& other) noexcept { init(other); }
ASMJIT_INLINE CpuInfo() noexcept:
_archInfo{},
_vendorId{},
_family{},
_model{},
_stepping{},
_hwThreadsCount{},
_features{},
_vendorString{},
_brandString{},
_x86Data{}
{}
ASMJIT_INLINE CpuInfo(const CpuInfo& other) noexcept = default;
ASMJIT_INLINE CpuInfo& operator=(const CpuInfo& other) noexcept = default;
// --------------------------------------------------------------------------
// [Init / Reset]
@ -260,8 +275,8 @@ public:
_archInfo.init(archType, archMode);
}
ASMJIT_INLINE void init(const CpuInfo& other) noexcept { ::memcpy(this, &other, sizeof(*this)); }
ASMJIT_INLINE void reset() noexcept { ::memset(this, 0, sizeof(*this)); }
ASMJIT_INLINE void init(const CpuInfo& other) noexcept { *this = other; }
ASMJIT_INLINE void reset() noexcept { *this = CpuInfo{}; }
// --------------------------------------------------------------------------
// [Detect]

View file

@ -734,10 +734,18 @@ public:
// [Construction / Destruction]
// --------------------------------------------------------------------------
ASMJIT_INLINE FuncDetail() noexcept { reset(); }
ASMJIT_INLINE FuncDetail(const FuncDetail& other) noexcept {
::memcpy(this, &other, sizeof(*this));
}
ASMJIT_INLINE FuncDetail() noexcept:
_callConv{},
_argCount{},
_retCount{},
_usedRegs{},
_argStackSize{},
_rets{},
_args{}
{}
ASMJIT_INLINE FuncDetail(const FuncDetail& other) noexcept = default;
ASMJIT_INLINE FuncDetail& operator=(const FuncDetail& other) noexcept = default;
// --------------------------------------------------------------------------
// [Init / Reset]
@ -745,7 +753,7 @@ public:
//! Initialize this `FuncDetail` to the given signature.
ASMJIT_API Error init(const FuncSignature& sign);
ASMJIT_INLINE void reset() noexcept { ::memset(this, 0, sizeof(*this)); }
ASMJIT_INLINE void reset() noexcept { *this = FuncDetail{}; }
// --------------------------------------------------------------------------
// [Accessors - Calling Convention]
@ -878,20 +886,23 @@ struct FuncFrameInfo {
// [Construction / Destruction]
// --------------------------------------------------------------------------
ASMJIT_INLINE FuncFrameInfo() noexcept { reset(); }
ASMJIT_INLINE FuncFrameInfo() noexcept:
_attributes{},
_dirtyRegs{},
_stackFrameAlignment{},
_callFrameAlignment{},
_stackArgsRegId{Globals::kInvalidRegId},
_stackFrameSize{},
_callFrameSize{}
{}
ASMJIT_INLINE FuncFrameInfo(const FuncFrameInfo& other) noexcept {
::memcpy(this, &other, sizeof(*this));
}
ASMJIT_INLINE FuncFrameInfo(const FuncFrameInfo& other) noexcept = default;
// --------------------------------------------------------------------------
// [Init / Reset]
// --------------------------------------------------------------------------
ASMJIT_INLINE void reset() noexcept {
::memset(this, 0, sizeof(*this));
_stackArgsRegId = Globals::kInvalidRegId;
}
ASMJIT_INLINE void reset() noexcept { *this = FuncFrameInfo{}; }
// --------------------------------------------------------------------------
// [Accessors]
@ -1180,19 +1191,18 @@ public:
// [Construction / Destruction]
// --------------------------------------------------------------------------
explicit ASMJIT_INLINE FuncArgsMapper(const FuncDetail* fd) noexcept { reset(fd); }
ASMJIT_INLINE FuncArgsMapper(const FuncArgsMapper& other) noexcept {
::memcpy(this, &other, sizeof(*this));
}
explicit ASMJIT_INLINE FuncArgsMapper(const FuncDetail* fd = nullptr) noexcept:
_funcDetail(fd),
_args{}
{}
ASMJIT_INLINE FuncArgsMapper(const FuncArgsMapper& other) noexcept = default;
// --------------------------------------------------------------------------
// [Reset]
// --------------------------------------------------------------------------
ASMJIT_INLINE void reset(const FuncDetail* fd = nullptr) noexcept {
_funcDetail = fd;
::memset(_args, 0, sizeof(_args));
}
ASMJIT_INLINE void reset(const FuncDetail* fd = nullptr) noexcept { *this = FuncArgsMapper(fd); }
// --------------------------------------------------------------------------
// [Accessors]

View file

@ -101,7 +101,7 @@ struct TiedReg {
// --------------------------------------------------------------------------
ASMJIT_INLINE TiedReg& operator=(const TiedReg& other) {
::memcpy(this, &other, sizeof(TiedReg));
::memcpy((void*)this, &other, sizeof(TiedReg));
return *this;
}

View file

@ -221,7 +221,8 @@ void ZoneHeap::reset(Zone* zone) noexcept {
}
// Zero the entire class and initialize to the given `zone`.
::memset(this, 0, sizeof(*this));
_dynamicBlocks = nullptr;
::memset(_slots, 0, sizeof(_slots));
_zone = zone;
}

View file

@ -297,14 +297,19 @@ class ZoneHeap {
//! Create a new `ZoneHeap`.
//!
//! NOTE: To use it, you must first `init()` it.
ASMJIT_INLINE ZoneHeap() noexcept {
::memset(this, 0, sizeof(*this));
}
ASMJIT_INLINE ZoneHeap() noexcept:
_zone{},
_slots{},
_dynamicBlocks{}
{}
//! Create a new `ZoneHeap` initialized to use `zone`.
explicit ASMJIT_INLINE ZoneHeap(Zone* zone) noexcept {
::memset(this, 0, sizeof(*this));
_zone = zone;
}
explicit ASMJIT_INLINE ZoneHeap(Zone* zone) noexcept:
_zone(zone),
_slots{},
_dynamicBlocks{}
{}
//! Destroy the `ZoneHeap`.
ASMJIT_INLINE ~ZoneHeap() noexcept { reset(); }