From 67847228e715cb56680827a334335475b0dc6f67 Mon Sep 17 00:00:00 2001 From: Tzvetan Mikov Date: Sun, 25 Aug 2024 22:36:25 -0700 Subject: [PATCH] Const correctness of ZoneStackBase::Block::data() The C-style cast was discarding const and casting to `(uint8_t *)` at the same time, causing a warning. Add const and non-const versions of the method. --- src/asmjit/core/zonestack.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/asmjit/core/zonestack.h b/src/asmjit/core/zonestack.h index 2cf078b..16d5d09 100644 --- a/src/asmjit/core/zonestack.h +++ b/src/asmjit/core/zonestack.h @@ -62,7 +62,9 @@ public: ASMJIT_INLINE_NODEBUG void setEnd(T* end) noexcept { _end = (void*)end; } template - ASMJIT_INLINE_NODEBUG T* data() const noexcept { return (T*)((uint8_t*)(this) + sizeof(Block)); } + ASMJIT_INLINE_NODEBUG const T* data() const noexcept { return (const T*)((const uint8_t*)(this) + sizeof(Block)); } + template + ASMJIT_INLINE_NODEBUG T* data() noexcept { return (T*)((uint8_t*)(this) + sizeof(Block)); } template ASMJIT_INLINE_NODEBUG bool canPrepend() const noexcept { return _start > data(); }