Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 21456d7

Browse files
committedJul 22, 2015
Fix warnings.
Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11404 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@242913 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 886a673 commit 21456d7

29 files changed

+101
-63
lines changed
 

‎source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer (StringExtractorGD
133133
int platform_port;
134134
std::string platform_path;
135135
bool ok = UriParser::Parse(GetConnection()->GetURI().c_str(), platform_scheme, platform_ip, platform_port, platform_path);
136+
(void)ok;
136137
assert(ok);
137138
Error error = StartDebugserverProcess (
138139
platform_ip.c_str(),

‎source/Symbol/ClangASTImporter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ ClangASTImporter::Minion::ExecuteDeportWorkQueues ()
623623
m_decls_to_deport->erase(decl);
624624

625625
DeclOrigin &origin = to_context_md->m_origins[decl];
626+
(void)origin;
626627

627628
assert (origin.ctx == m_source_ctx); // otherwise we should never have added this
628629
// because it doesn't need to be deported

‎source/Target/Process.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2843,6 +2843,7 @@ Process::WriteMemory (addr_t addr, const void *buf, size_t size, Error &error)
28432843
size_t intersect_size;
28442844
size_t opcode_offset;
28452845
const bool intersects = bp->IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset);
2846+
(void)intersects;
28462847
assert(intersects);
28472848
assert(addr <= intersect_addr && intersect_addr < addr + size);
28482849
assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size);

‎tools/debugserver/source/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,30 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
1010
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_SOURCE_DIR}/../resources/lldb-debugserver-Info.plist")
1111
endif()
1212

13+
check_cxx_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments"
14+
CXX_SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
15+
if (CXX_SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
16+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-gnu-zero-variadic-macro-arguments")
17+
endif ()
18+
19+
check_cxx_compiler_flag("-Wno-vla-extension"
20+
CXX_SUPPORTS_NO_VLA_EXTENSION)
21+
if (CXX_SUPPORTS_NO_VLA_EXTENSION)
22+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla-extension")
23+
endif ()
24+
25+
check_cxx_compiler_flag("-Wno-zero-length-array"
26+
CXX_SUPPORTS_NO_ZERO_LENGTH_ARRAY)
27+
if (CXX_SUPPORTS_NO_ZERO_LENGTH_ARRAY)
28+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-zero-length-array")
29+
endif ()
30+
31+
check_cxx_compiler_flag("-Wno-extended-offsetof"
32+
CXX_SUPPORTS_NO_EXTENDED_OFFSETOF)
33+
if (CXX_SUPPORTS_NO_EXTENDED_OFFSETOF)
34+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extended-offsetof")
35+
endif ()
36+
1337
add_definitions(
1438
-DDEBUGSERVER_VERSION_STR="${LLDB_VERSION}"
1539
)

‎tools/debugserver/source/DNB.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ DNBProcessLaunch (const char *path,
446446
else
447447
{
448448
bool res = AddProcessToMap(pid, processSP);
449+
(void)res;
449450
assert(res && "Couldn't add process to map!");
450451
return pid;
451452
}
@@ -494,6 +495,7 @@ DNBProcessAttach (nub_process_t attach_pid, struct timespec *timeout, char *err_
494495
if (pid != INVALID_NUB_PROCESS)
495496
{
496497
bool res = AddProcessToMap(pid, processSP);
498+
(void)res;
497499
assert(res && "Couldn't add process to map!");
498500
spawn_waitpid_thread(pid);
499501
}

‎tools/debugserver/source/DNBArch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ DNBArchProtocol::Create (MachThread *thread)
8686

8787
}
8888

89-
const uint8_t * const
89+
const uint8_t *
9090
DNBArchProtocol::GetBreakpointOpcode (nub_size_t byte_size)
9191
{
9292
const DNBArchPluginInfo *arch_info = GetArchInfo ();

‎tools/debugserver/source/DNBArch.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class MachThread;
2727

2828
typedef DNBArchProtocol * (* DNBArchCallbackCreate)(MachThread *thread);
2929
typedef const DNBRegisterSetInfo * (* DNBArchCallbackGetRegisterSetInfo)(nub_size_t *num_reg_sets);
30-
typedef const uint8_t * const (* DNBArchCallbackGetBreakpointOpcode)(nub_size_t byte_size);
30+
typedef const uint8_t * (* DNBArchCallbackGetBreakpointOpcode)(nub_size_t byte_size);
3131

3232
typedef struct DNBArchPluginInfoTag
3333
{
@@ -49,7 +49,7 @@ class DNBArchProtocol
4949
static const DNBRegisterSetInfo *
5050
GetRegisterSetInfo (nub_size_t *num_reg_sets);
5151

52-
static const uint8_t * const
52+
static const uint8_t *
5353
GetBreakpointOpcode (nub_size_t byte_size);
5454

5555
static void
@@ -94,7 +94,7 @@ class DNBArchProtocol
9494
virtual uint32_t EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write, bool also_set_on_task) { return INVALID_NUB_HW_INDEX; }
9595
virtual bool DisableHardwareBreakpoint (uint32_t hw_index) { return false; }
9696
virtual bool DisableHardwareWatchpoint (uint32_t hw_index, bool also_set_on_task) { return false; }
97-
virtual uint32_t GetHardwareWatchpointHit() { return INVALID_NUB_HW_INDEX; }
97+
virtual uint32_t GetHardwareWatchpointHit(nub_addr_t &addr) { return INVALID_NUB_HW_INDEX; }
9898
virtual bool StepNotComplete () { return false; }
9999

100100
protected:

‎tools/debugserver/source/DNBDataRef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ DNBDataRef::Dump
334334
uint32_t count;
335335
char str[1024];
336336
str[0] = '\0';
337-
int str_offset = 0;
337+
size_t str_offset = 0;
338338

339339
for (offset = startOffset, count = 0; ValidOffset(offset) && offset < endOffset; ++count)
340340
{

‎tools/debugserver/source/DNBRegisterInfo.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ DNBRegisterValueClass::Dump(const char *pre, const char *post) const
4545
{
4646
if (info.name != NULL)
4747
{
48-
int i;
4948
char str[1024];
5049
char *pos;
5150
char *end = str + sizeof(str);
@@ -62,7 +61,7 @@ DNBRegisterValueClass::Dump(const char *pre, const char *post) const
6261
default:
6362
strncpy(str, "0x", 3);
6463
pos = str + 2;
65-
for (i=0; i<info.size; ++i)
64+
for (uint32_t i=0; i<info.size; ++i)
6665
{
6766
if (pos < end)
6867
pos += snprintf(pos, end - pos, "%2.2x", (uint32_t)value.v_uint8[i]);
@@ -113,7 +112,7 @@ DNBRegisterValueClass::Dump(const char *pre, const char *post) const
113112
case VectorOfSInt8:
114113
snprintf(str, sizeof(str), "%s", "sint8 { ");
115114
pos = str + strlen(str);
116-
for (i=0; i<info.size; ++i)
115+
for (uint32_t i=0; i<info.size; ++i)
117116
{
118117
PRINT_COMMA_SEPARATOR;
119118
if (pos < end)
@@ -127,7 +126,7 @@ DNBRegisterValueClass::Dump(const char *pre, const char *post) const
127126
case VectorOfUInt8:
128127
snprintf(str, sizeof(str), "%s", "uint8 { ");
129128
pos = str + strlen(str);
130-
for (i=0; i<info.size; ++i)
129+
for (uint32_t i=0; i<info.size; ++i)
131130
{
132131
PRINT_COMMA_SEPARATOR;
133132
if (pos < end)
@@ -138,7 +137,7 @@ DNBRegisterValueClass::Dump(const char *pre, const char *post) const
138137
case VectorOfSInt16:
139138
snprintf(str, sizeof(str), "%s", "sint16 { ");
140139
pos = str + strlen(str);
141-
for (i=0; i<info.size/2; ++i)
140+
for (uint32_t i=0; i<info.size/2; ++i)
142141
{
143142
PRINT_COMMA_SEPARATOR;
144143
if (pos < end)
@@ -149,7 +148,7 @@ DNBRegisterValueClass::Dump(const char *pre, const char *post) const
149148
case VectorOfUInt16:
150149
snprintf(str, sizeof(str), "%s", "uint16 { ");
151150
pos = str + strlen(str);
152-
for (i=0; i<info.size/2; ++i)
151+
for (uint32_t i=0; i<info.size/2; ++i)
153152
{
154153
PRINT_COMMA_SEPARATOR;
155154
if (pos < end)
@@ -160,7 +159,7 @@ DNBRegisterValueClass::Dump(const char *pre, const char *post) const
160159
case VectorOfSInt32:
161160
snprintf(str, sizeof(str), "%s", "sint32 { ");
162161
pos = str + strlen(str);
163-
for (i=0; i<info.size/4; ++i)
162+
for (uint32_t i=0; i<info.size/4; ++i)
164163
{
165164
PRINT_COMMA_SEPARATOR;
166165
if (pos < end)
@@ -171,7 +170,7 @@ DNBRegisterValueClass::Dump(const char *pre, const char *post) const
171170
case VectorOfUInt32:
172171
snprintf(str, sizeof(str), "%s", "uint32 { ");
173172
pos = str + strlen(str);
174-
for (i=0; i<info.size/4; ++i)
173+
for (uint32_t i=0; i<info.size/4; ++i)
175174
{
176175
PRINT_COMMA_SEPARATOR;
177176
if (pos < end)
@@ -182,7 +181,7 @@ DNBRegisterValueClass::Dump(const char *pre, const char *post) const
182181
case VectorOfFloat32:
183182
snprintf(str, sizeof(str), "%s", "float32 { ");
184183
pos = str + strlen(str);
185-
for (i=0; i<info.size/4; ++i)
184+
for (uint32_t i=0; i<info.size/4; ++i)
186185
{
187186
PRINT_COMMA_SEPARATOR;
188187
if (pos < end)
@@ -193,7 +192,7 @@ DNBRegisterValueClass::Dump(const char *pre, const char *post) const
193192
case VectorOfUInt128:
194193
snprintf(str, sizeof(str), "%s", "uint128 { ");
195194
pos = str + strlen(str);
196-
for (i=0; i<info.size/16; ++i)
195+
for (uint32_t i=0; i<info.size/16; ++i)
197196
{
198197
PRINT_COMMA_SEPARATOR;
199198
if (pos < end)

‎tools/debugserver/source/MacOSX/MachProcess.mm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,16 @@
158158
m_stdio_thread (0),
159159
m_stdio_mutex (PTHREAD_MUTEX_RECURSIVE),
160160
m_stdout_data (),
161-
m_thread_actions (),
162161
m_profile_enabled (false),
163162
m_profile_interval_usec (0),
164163
m_profile_thread (0),
165164
m_profile_data_mutex(PTHREAD_MUTEX_RECURSIVE),
166165
m_profile_data (),
167-
m_thread_list (),
168-
m_activities (),
166+
m_thread_actions (),
169167
m_exception_messages (),
170168
m_exception_messages_mutex (PTHREAD_MUTEX_RECURSIVE),
169+
m_thread_list (),
170+
m_activities (),
171171
m_state (eStateUnloaded),
172172
m_state_mutex (PTHREAD_MUTEX_RECURSIVE),
173173
m_events (0, kAllEventsMask),
@@ -376,7 +376,7 @@
376376
info.pathname += strbuf;
377377
pathname_ptr += sizeof (strbuf) - 1;
378378
// Stop if we found nul byte indicating the end of the string
379-
for (int i = 0; i < sizeof(strbuf) - 1; i++)
379+
for (size_t i = 0; i < sizeof(strbuf) - 1; i++)
380380
{
381381
if (strbuf[i] == '\0')
382382
{
@@ -1032,6 +1032,7 @@
10321032
DNBBreakpoint *bp = bps[i];
10331033

10341034
const bool intersects = bp->IntersectsRange(addr, size, &intersect_addr, &intersect_size, &opcode_offset);
1035+
(void)intersects;
10351036
assert(intersects);
10361037
assert(addr <= intersect_addr && intersect_addr < addr + size);
10371038
assert(addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= addr + size);

‎tools/debugserver/source/MacOSX/MachTask.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static void get_threads_profile_data(DNBProfileDataScanType scanType, task_t tas
266266
if (kr != KERN_SUCCESS)
267267
return;
268268

269-
for (int i = 0; i < tcnt; i++)
269+
for (mach_msg_type_number_t i = 0; i < tcnt; i++)
270270
{
271271
thread_identifier_info_data_t identifier_info;
272272
mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
@@ -431,7 +431,7 @@ static void get_threads_profile_data(DNBProfileDataScanType scanType, task_t tas
431431
// Make sure that thread name doesn't interfere with our delimiter.
432432
profile_data_stream << RAW_HEXBASE << std::setw(2);
433433
const uint8_t *ubuf8 = (const uint8_t *)(thread_name);
434-
for (int j=0; j<len; j++)
434+
for (size_t j=0; j<len; j++)
435435
{
436436
profile_data_stream << (uint32_t)(ubuf8[j]);
437437
}
@@ -720,7 +720,7 @@ static void get_threads_profile_data(DNBProfileDataScanType scanType, task_t tas
720720

721721
// NULL our our exception port and let our exception thread exit
722722
mach_port_t exception_port = m_exception_port;
723-
m_exception_port = NULL;
723+
m_exception_port = 0;
724724

725725
err.SetError(::pthread_cancel(m_exception_thread), DNBError::POSIX);
726726
if (DNBLogCheckLogBit(LOG_TASK) || err.Fail())

‎tools/debugserver/source/MacOSX/MachThread.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,31 +539,31 @@ MachThread::SetState(nub_state_t state)
539539
}
540540

541541
nub_size_t
542-
MachThread::GetNumRegistersInSet(int regSet) const
542+
MachThread::GetNumRegistersInSet(nub_size_t regSet) const
543543
{
544544
if (regSet < m_num_reg_sets)
545545
return m_reg_sets[regSet].num_registers;
546546
return 0;
547547
}
548548

549549
const char *
550-
MachThread::GetRegisterSetName(int regSet) const
550+
MachThread::GetRegisterSetName(nub_size_t regSet) const
551551
{
552552
if (regSet < m_num_reg_sets)
553553
return m_reg_sets[regSet].name;
554554
return NULL;
555555
}
556556

557557
const DNBRegisterInfo *
558-
MachThread::GetRegisterInfo(int regSet, int regIndex) const
558+
MachThread::GetRegisterInfo(nub_size_t regSet, nub_size_t regIndex) const
559559
{
560560
if (regSet < m_num_reg_sets)
561561
if (regIndex < m_reg_sets[regSet].num_registers)
562562
return &m_reg_sets[regSet].registers[regIndex];
563563
return NULL;
564564
}
565565
void
566-
MachThread::DumpRegisterState(int regSet)
566+
MachThread::DumpRegisterState(nub_size_t regSet)
567567
{
568568
if (regSet == REGISTER_SET_ALL)
569569
{

‎tools/debugserver/source/MacOSX/MachThread.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ class MachThread
8383
bool NotifyException(MachException::Data& exc);
8484
const MachException::Data& GetStopException() { return m_stop_exception; }
8585

86-
nub_size_t GetNumRegistersInSet(int regSet) const;
87-
const char * GetRegisterSetName(int regSet) const;
86+
nub_size_t GetNumRegistersInSet(nub_size_t regSet) const;
87+
const char * GetRegisterSetName(nub_size_t regSet) const;
8888
const DNBRegisterInfo *
89-
GetRegisterInfo(int regSet, int regIndex) const;
90-
void DumpRegisterState(int regSet);
89+
GetRegisterInfo(nub_size_t regSet, nub_size_t regIndex) const;
90+
void DumpRegisterState(nub_size_t regSet);
9191
const DNBRegisterSetInfo *
9292
GetRegisterSetInfo(nub_size_t *num_reg_sets ) const;
9393
bool GetRegisterValue ( uint32_t reg_set_idx, uint32_t reg_idx, DNBRegisterValue *reg_value );

‎tools/debugserver/source/MacOSX/MachVMMemory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ MachVMMemory::Read(task_t task, nub_addr_t address, void *data, nub_size_t data_
474474
{
475475
mach_vm_size_t curr_size = MaxBytesLeftInPage(task, curr_addr, data_count - total_bytes_read);
476476
mach_msg_type_number_t curr_bytes_read = 0;
477-
vm_offset_t vm_memory = NULL;
477+
vm_offset_t vm_memory = 0;
478478
m_err = ::mach_vm_read (task, curr_addr, curr_size, &vm_memory, &curr_bytes_read);
479479

480480
if (DNBLogCheckLogBit(LOG_MEMORY))

‎tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ DNBArchMachARM::Create (MachThread *thread)
139139
return obj;
140140
}
141141

142-
const uint8_t * const
142+
const uint8_t *
143143
DNBArchMachARM::SoftwareBreakpointOpcode (nub_size_t byte_size)
144144
{
145145
switch (byte_size)
@@ -2060,6 +2060,7 @@ DNBArchMachARM::GetRegisterContext (void *buf, nub_size_t buf_len)
20602060
p += sizeof(m_state.context.exc);
20612061

20622062
size_t bytes_written = p - (uint8_t *)buf;
2063+
(void)bytes_written;
20632064
assert (bytes_written == size);
20642065

20652066
}
@@ -2093,6 +2094,7 @@ DNBArchMachARM::SetRegisterContext (const void *buf, nub_size_t buf_len)
20932094
p += sizeof(m_state.context.exc);
20942095

20952096
size_t bytes_written = p - (uint8_t *)buf;
2097+
(void)bytes_written;
20962098
assert (bytes_written == size);
20972099

20982100
if (SetGPRState() | SetVFPState() | SetEXCState())

‎tools/debugserver/source/MacOSX/arm/DNBArchImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DNBArchMachARM : public DNBArchProtocol
7272
virtual bool NotifyException(MachException::Data& exc);
7373

7474
static DNBArchProtocol *Create (MachThread *thread);
75-
static const uint8_t * const SoftwareBreakpointOpcode (nub_size_t byte_size);
75+
static const uint8_t * SoftwareBreakpointOpcode (nub_size_t byte_size);
7676
static uint32_t GetCPUType();
7777

7878
virtual uint32_t NumSupportedHardwareBreakpoints();

‎tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ DNBArchMachARM64::Create (MachThread *thread)
8484
return obj;
8585
}
8686

87-
const uint8_t * const
87+
const uint8_t *
8888
DNBArchMachARM64::SoftwareBreakpointOpcode (nub_size_t byte_size)
8989
{
9090
return g_arm_breakpoint_opcode;
@@ -1995,6 +1995,7 @@ DNBArchMachARM64::GetRegisterContext (void *buf, nub_size_t buf_len)
19951995
p += sizeof(m_state.context.exc);
19961996

19971997
size_t bytes_written = p - (uint8_t *)buf;
1998+
(void)bytes_written;
19981999
assert (bytes_written == size);
19992000
}
20002001
DNBLogThreadedIf (LOG_THREAD, "DNBArchMachARM64::GetRegisterContext (buf = %p, len = %zu) => %zu", buf, buf_len, size);
@@ -2027,6 +2028,7 @@ DNBArchMachARM64::SetRegisterContext (const void *buf, nub_size_t buf_len)
20272028
p += sizeof(m_state.context.exc);
20282029

20292030
size_t bytes_written = p - (uint8_t *)buf;
2031+
(void)bytes_written;
20302032
assert (bytes_written == size);
20312033
SetGPRState();
20322034
SetVFPState();

‎tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class DNBArchMachARM64 : public DNBArchProtocol
6767
virtual bool NotifyException(MachException::Data& exc);
6868

6969
static DNBArchProtocol *Create (MachThread *thread);
70-
static const uint8_t * const SoftwareBreakpointOpcode (nub_size_t byte_size);
70+
static const uint8_t * SoftwareBreakpointOpcode (nub_size_t byte_size);
7171
static uint32_t GetCPUType();
7272

7373
virtual uint32_t NumSupportedHardwareWatchpoints();

0 commit comments

Comments
 (0)
This repository has been archived.