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:
Saleem Abdulrasool
2017-07-19 15:46:21 +00:00
parent 0dcb48eab1
commit f76e099ca7
2 changed files with 4 additions and 2 deletions

View File

@@ -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);

View File

@@ -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;