[Lldb-commits] [lldb] r308489 - silence a couple of -Wqual-cast warning from GCC (NFC)
Saleem Abdulrasool via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 19 08:46:21 PDT 2017
Author: compnerd
Date: Wed Jul 19 08:46:21 2017
New Revision: 308489
URL: http://llvm.org/viewvc/llvm-project?rev=308489&view=rev
Log:
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]
Modified:
lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp?rev=308489&r1=308488&r2=308489&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp Wed Jul 19 08:46:21 2017
@@ -203,7 +203,8 @@ size_t EmulationStateARM::WritePseudoMem
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);
Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=308489&r1=308488&r2=308489&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Wed Jul 19 08:46:21 2017
@@ -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;
More information about the lldb-commits
mailing list