From f2dfb64bf265874e001a78af1a286881d2dcd726 Mon Sep 17 00:00:00 2001 From: Tzvetan Mikov Date: Tue, 27 Aug 2024 09:55:03 -0700 Subject: [PATCH] [AsmJIT: Const correctness for Block::data() Summary: 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. Reviewed By: avp Differential Revision: D61772029 fbshipit-source-id: b03536b5a0dad20caecdf810d4ed475ab00c88ad --- external/asmjit/asmjit/src/asmjit/core/zonestack.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/external/asmjit/asmjit/src/asmjit/core/zonestack.h b/external/asmjit/asmjit/src/asmjit/core/zonestack.h index 2cf078b3d21..16d5d09dbc1 100644 --- a/external/asmjit/asmjit/src/asmjit/core/zonestack.h +++ b/external/asmjit/asmjit/src/asmjit/core/zonestack.h @@ -62,7 +62,9 @@ class ZoneStackBase { 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(); }