mirror of
https://github.com/intel/llvm.git
synced 2026-01-18 16:50:51 +08:00
silence a couple of -Wqual-cast warning from GCC (NFC)
Cast to `const uint8_t *` instead of `uint8_t *` to avoid the warning
from GCC.
EmulationStateARM.cpp:206:34: warning: cast from type 'const void*' to type 'uint8_t* {aka unsigned char*}' casts away qualifiers [-Wcast-qual]
Cast to `const uint32_t *` and the explicitly cast away the const-ness
of the value. This seems pretty sketchy as the `DataExtractor` holds a
const reference to the data. However, this is no worse than before.
ObjectFilePECOFF.cpp:540:78: warning: cast from type 'const uint8_t* {aka const unsigned char*}' to type 'uint32_t* {aka unsigned int*}' casts away qualifiers [-Wcast-qual]
llvm-svn: 308489
This commit is contained in:
@@ -203,7 +203,8 @@ size_t EmulationStateARM::WritePseudoMemory(
|
||||
uint32_t value1;
|
||||
uint32_t value2;
|
||||
memcpy (&value1, dst, sizeof (uint32_t));
|
||||
memcpy (&value2, (uint8_t *) dst + sizeof (uint32_t), sizeof (uint32_t));
|
||||
memcpy(&value2, static_cast<const uint8_t *>(dst) + sizeof(uint32_t),
|
||||
sizeof(uint32_t));
|
||||
if (endian::InlHostByteOrder() == lldb::eByteOrderBig) {
|
||||
value1 = llvm::ByteSwap_32(value1);
|
||||
value2 = llvm::ByteSwap_32(value2);
|
||||
|
||||
@@ -537,7 +537,8 @@ Symtab *ObjectFilePECOFF::GetSymtab() {
|
||||
|
||||
// First 4 bytes should be zeroed after strtab_size has been read,
|
||||
// because it is used as offset 0 to encode a NULL string.
|
||||
uint32_t *strtab_data_start = (uint32_t *)strtab_data.GetDataStart();
|
||||
uint32_t *strtab_data_start = const_cast<uint32_t *>(
|
||||
reinterpret_cast<const uint32_t *>(strtab_data.GetDataStart()));
|
||||
strtab_data_start[0] = 0;
|
||||
|
||||
offset = 0;
|
||||
|
||||
Reference in New Issue
Block a user