summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Malea <daniel.malea@intel.com>2012-12-07 22:21:08 +0000
committerDaniel Malea <daniel.malea@intel.com>2012-12-07 22:21:08 +0000
commita85e6b6c323d97c3c5b3c2b45f15ef3066aa9e79 (patch)
tree31449c19dec1fb8ed688c82c056fc1dc880ba6ae
parent84b2a795705d994d2a333d49a00ff7132627cbe3 (diff)
downloadbcm5719-llvm-a85e6b6c323d97c3c5b3c2b45f15ef3066aa9e79.tar.gz
bcm5719-llvm-a85e6b6c323d97c3c5b3c2b45f15ef3066aa9e79.zip
Fix a few more clang (3.2) warnings on Linux:
- remove unused members - add NO_PEDANTIC to selected Makefiles - fix return values (removed NULL as needed) - disable warning about four-char-constants - remove unneeded const from operator*() declaration - add missing lambda function return types - fix printf() with no format string - change sizeof to use a type name instead of variable name - fix Linux ProcessMonitor.cpp to be 32/64 bit friendly - disable warnings emitted by swig-generated C++ code Patch by Matt Kopec! llvm-svn: 169645
-rw-r--r--lldb/include/lldb/Core/CXXFormatterFunctions.h1
-rw-r--r--lldb/include/lldb/Expression/IRInterpreter.h1
-rw-r--r--lldb/source/Commands/Makefile2
-rw-r--r--lldb/source/Core/CXXFormatterFunctions.cpp2
-rw-r--r--lldb/source/Core/Log.cpp2
-rw-r--r--lldb/source/Core/ValueObject.cpp4
-rw-r--r--lldb/source/Expression/IRInterpreter.cpp3
-rw-r--r--lldb/source/Interpreter/CommandObjectScript.cpp3
-rw-r--r--lldb/source/Interpreter/CommandObjectScript.h3
-rw-r--r--lldb/source/Interpreter/Makefile7
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp4
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp4
-rw-r--r--lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp4
-rw-r--r--lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp25
-rw-r--r--lldb/source/Plugins/Process/POSIX/Makefile4
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp1
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp2
-rw-r--r--lldb/source/Utility/Makefile1
-rw-r--r--lldb/source/Utility/StringExtractor.cpp4
-rw-r--r--lldb/tools/driver/IOChannel.cpp2
-rw-r--r--lldb/tools/driver/Makefile2
22 files changed, 46 insertions, 37 deletions
diff --git a/lldb/include/lldb/Core/CXXFormatterFunctions.h b/lldb/include/lldb/Core/CXXFormatterFunctions.h
index 97dbc21312a..0b20f1d8249 100644
--- a/lldb/include/lldb/Core/CXXFormatterFunctions.h
+++ b/lldb/include/lldb/Core/CXXFormatterFunctions.h
@@ -294,7 +294,6 @@ namespace lldb_private {
private:
ExecutionContextRef m_exe_ctx_ref;
uint8_t m_ptr_size;
- uint64_t m_items;
DataDescriptor_32 *m_data_32;
DataDescriptor_64 *m_data_64;
std::vector<DictionaryItemDescriptor> m_children;
diff --git a/lldb/include/lldb/Expression/IRInterpreter.h b/lldb/include/lldb/Expression/IRInterpreter.h
index c8d341f045f..8adc06a6369 100644
--- a/lldb/include/lldb/Expression/IRInterpreter.h
+++ b/lldb/include/lldb/Expression/IRInterpreter.h
@@ -95,7 +95,6 @@ public:
private:
/// Flags
lldb_private::ClangExpressionDeclMap &m_decl_map; ///< The DeclMap containing the Decls
- lldb_private::Stream *m_error_stream;
bool
supportsFunction (llvm::Function &llvm_function,
diff --git a/lldb/source/Commands/Makefile b/lldb/source/Commands/Makefile
index dbef40c520b..1a66485a0c2 100644
--- a/lldb/source/Commands/Makefile
+++ b/lldb/source/Commands/Makefile
@@ -12,3 +12,5 @@ LIBRARYNAME := lldbCommands
BUILD_ARCHIVE = 1
include $(LLDB_LEVEL)/Makefile
+
+EXTRA_OPTIONS += -Wno-four-char-constants \ No newline at end of file
diff --git a/lldb/source/Core/CXXFormatterFunctions.cpp b/lldb/source/Core/CXXFormatterFunctions.cpp
index 6f728afac8a..f8f8fa57cb8 100644
--- a/lldb/source/Core/CXXFormatterFunctions.cpp
+++ b/lldb/source/Core/CXXFormatterFunctions.cpp
@@ -40,7 +40,7 @@ lldb_private::formatters::ExtractValueFromObjCExpression (ValueObject &valobj,
if (!selector || !*selector)
return false;
StreamString expr;
- expr.Printf("(%s)[(id)0x%llx %s]",target_type,valobj.GetPointerValue(),selector);
+ expr.Printf("(%s)[(id)0x%" PRIx64 " %s]",target_type,valobj.GetPointerValue(),selector);
ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
lldb::ValueObjectSP result_sp;
Target* target = exe_ctx.GetTargetPtr();
diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp
index 14e8ff82467..f8e422e2df7 100644
--- a/lldb/source/Core/Log.cpp
+++ b/lldb/source/Core/Log.cpp
@@ -102,7 +102,7 @@ Log::PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args)
if (m_options.Test (LLDB_LOG_OPTION_PREPEND_TIMESTAMP))
{
struct timeval tv = TimeValue::Now().GetAsTimeVal();
- header.Printf ("%9ld.%6.6" PRIi32 " ", tv.tv_sec, tv.tv_usec);
+ header.Printf ("%9ld.%6.6d ", tv.tv_sec, (int32_t)tv.tv_usec);
}
// Add the process and thread if requested
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 8e4495396c0..c95095f7c02 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -2527,7 +2527,7 @@ ValueObject::GetValueForExpressionPath_Impl(const char* expression_cstr,
if (child_valobj_sp.get()) // we know we are done, so just return
{
- *first_unparsed = '\0';
+ *first_unparsed = "";
*reason_to_stop = ValueObject::eExpressionPathScanEndReasonEndOfString;
*final_result = ValueObject::eExpressionPathEndResultTypePlain;
return child_valobj_sp;
@@ -2551,7 +2551,7 @@ ValueObject::GetValueForExpressionPath_Impl(const char* expression_cstr,
// so we hit the "else" branch, and return an error
if(child_valobj_sp.get()) // if it worked, just return
{
- *first_unparsed = '\0';
+ *first_unparsed = "";
*reason_to_stop = ValueObject::eExpressionPathScanEndReasonEndOfString;
*final_result = ValueObject::eExpressionPathEndResultTypePlain;
return child_valobj_sp;
diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp
index 64d5dc6a634..b81287585fb 100644
--- a/lldb/source/Expression/IRInterpreter.cpp
+++ b/lldb/source/Expression/IRInterpreter.cpp
@@ -28,8 +28,7 @@ using namespace llvm;
IRInterpreter::IRInterpreter(lldb_private::ClangExpressionDeclMap &decl_map,
lldb_private::Stream *error_stream) :
- m_decl_map(decl_map),
- m_error_stream(error_stream)
+ m_decl_map(decl_map)
{
}
diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp
index db4f74ea701..204270fa584 100644
--- a/lldb/source/Interpreter/CommandObjectScript.cpp
+++ b/lldb/source/Interpreter/CommandObjectScript.cpp
@@ -35,8 +35,7 @@ CommandObjectScript::CommandObjectScript (CommandInterpreter &interpreter, Scrip
CommandObjectRaw (interpreter,
"script",
"Pass an expression to the script interpreter for evaluation and return the results. Drop into the interactive interpreter if no expression is given.",
- "script [<script-expression-for-evaluation>]"),
- m_script_lang (script_lang)
+ "script [<script-expression-for-evaluation>]")
{
}
diff --git a/lldb/source/Interpreter/CommandObjectScript.h b/lldb/source/Interpreter/CommandObjectScript.h
index c812539e9ef..fd55fc44a46 100644
--- a/lldb/source/Interpreter/CommandObjectScript.h
+++ b/lldb/source/Interpreter/CommandObjectScript.h
@@ -35,9 +35,6 @@ public:
protected:
virtual bool
DoExecute (const char *command, CommandReturnObject &result);
-
-private:
- lldb::ScriptLanguage m_script_lang;
};
} // namespace lldb_private
diff --git a/lldb/source/Interpreter/Makefile b/lldb/source/Interpreter/Makefile
index b9ffd0e5c45..24ee3941e82 100644
--- a/lldb/source/Interpreter/Makefile
+++ b/lldb/source/Interpreter/Makefile
@@ -16,6 +16,13 @@ BUILT_SOURCES := LLDBWrapPython.cpp
include $(LLDB_LEVEL)/Makefile
-include $(PROJ_OBJ_DIR)/LLDBWrapPython.cpp.d
+# Drop -Wfour-char-constants, which we are not currently clean with.
+EXTRA_OPTIONS += -Wno-four-char-constants
+
+# Drop -Wself-assign, -Wmissing-field-initializers and -Wsometimes-uninitialized,
+# which we are not currently clean with (due to SWIG generated cpp source).
+EXTRA_OPTIONS += -Wno-missing-field-initializers -Wno-self-assign -Wno-sometimes-uninitialized
+
# edit-swig-python-wrapper-file.py needs $(SRCROOT)
export SRCROOT := $(PROJ_SRC_DIR)/$(LLDB_LEVEL)
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index f9b00f61e69..758798480eb 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -1101,7 +1101,7 @@ DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos ()
if (!AddModulesUsingImageInfosAddress (m_dyld_all_image_infos.dylib_info_addr,
m_dyld_all_image_infos.dylib_info_count))
{
- DEBUG_PRINTF( "unable to read all data for all_dylib_infos.");
+ DEBUG_PRINTF("%s", "unable to read all data for all_dylib_infos.");
m_dyld_image_infos.clear();
}
}
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 6b438e02f39..b7edba8b600 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -849,7 +849,7 @@ public:
return *this;
}
- const ObjCLanguageRuntime::ObjCISA operator*() const
+ ObjCLanguageRuntime::ObjCISA operator*() const
{
if (m_index == -1)
return 0;
@@ -2012,7 +2012,7 @@ AppleObjCRuntimeV2::LookupRuntimeSymbol (const ConstString &name)
const ConstString ivar_name_cs(class_and_ivar.second);
const char *ivar_name_cstr = ivar_name_cs.AsCString();
- auto ivar_func = [&ret, ivar_name_cstr](const char *name, const char *type, lldb::addr_t offset_addr, uint64_t size)
+ auto ivar_func = [&ret, ivar_name_cstr](const char *name, const char *type, lldb::addr_t offset_addr, uint64_t size) -> lldb::addr_t
{
if (!strcmp(name, ivar_name_cstr))
{
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
index 0c3c8b9655e..4e573302aa9 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
@@ -522,7 +522,7 @@ AppleObjCTypeVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl)
interface_decl->setSuperClass(superclass_decl);
};
- auto instance_method_func = [log, interface_decl, this](const char *name, const char *types)
+ auto instance_method_func = [log, interface_decl, this](const char *name, const char *types) -> bool
{
ObjCRuntimeMethodType method_type(types);
@@ -537,7 +537,7 @@ AppleObjCTypeVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl)
return false;
};
- auto class_method_func = [log, interface_decl, this](const char *name, const char *types)
+ auto class_method_func = [log, interface_decl, this](const char *name, const char *types) -> bool
{
ObjCRuntimeMethodType method_type(types);
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index 7f7ac203df9..668799c35e4 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -178,7 +178,7 @@ bool
OperatingSystemPython::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_thread_list)
{
if (!m_interpreter || !m_python_object)
- return NULL;
+ return false;
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
@@ -193,7 +193,7 @@ OperatingSystemPython::UpdateThreadList (ThreadList &old_thread_list, ThreadList
auto object_sp = m_interpreter->OSPlugin_QueryForThreadsInfo(m_interpreter->MakeScriptObject(m_python_object));
if (!object_sp)
- return NULL;
+ return false;
PythonDataObject pyobj((PyObject*)object_sp->GetObject());
PythonDataArray threads_array (pyobj.GetArrayObject());
if (threads_array)
diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
index 35d12abb448..483834045cc 100644
--- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
+++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
@@ -13,6 +13,7 @@
#include <errno.h>
#include <poll.h>
#include <string.h>
+#include <stdint.h>
#include <unistd.h>
#include <sys/ptrace.h>
#include <sys/socket.h>
@@ -200,7 +201,7 @@ DoReadMemory(lldb::pid_t pid,
// Copy the data into our buffer
if (log)
- memset(dst, 0, sizeof(dst));
+ memset(dst, 0, sizeof(unsigned char));
for (unsigned i = 0; i < remainder; ++i)
dst[i] = ((data >> i*8) & 0xFF);
@@ -414,7 +415,7 @@ public:
void Execute(ProcessMonitor *monitor);
private:
- unsigned m_offset;
+ uintptr_t m_offset;
RegisterValue &m_value;
bool &m_result;
};
@@ -453,7 +454,7 @@ public:
void Execute(ProcessMonitor *monitor);
private:
- unsigned m_offset;
+ uintptr_t m_offset;
const RegisterValue &m_value;
bool &m_result;
};
@@ -465,13 +466,11 @@ WriteRegOperation::Execute(ProcessMonitor *monitor)
lldb::pid_t pid = monitor->GetPID();
LogSP log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_REGISTERS));
- if (sizeof(void*) == sizeof(uint64_t))
- buf = (void*) m_value.GetAsUInt64();
- else
- {
- assert(sizeof(void*) == sizeof(uint32_t));
- buf = (void*) m_value.GetAsUInt32();
- }
+#if __WORDSIZE == 32
+ buf = (void*) m_value.GetAsUInt32();
+#else
+ buf = (void*) m_value.GetAsUInt64();
+#endif
if (log)
log->Printf ("ProcessMonitor::%s() reg %s: %p", __FUNCTION__,
@@ -606,7 +605,7 @@ private:
void
ResumeOperation::Execute(ProcessMonitor *monitor)
{
- int data = 0;
+ intptr_t data = 0;
if (m_signo != LLDB_INVALID_SIGNAL_NUMBER)
data = m_signo;
@@ -637,7 +636,7 @@ private:
void
SingleStepOperation::Execute(ProcessMonitor *monitor)
{
- int data = 0;
+ intptr_t data = 0;
if (m_signo != LLDB_INVALID_SIGNAL_NUMBER)
data = m_signo;
@@ -986,7 +985,7 @@ ProcessMonitor::Launch(LaunchArgs *args)
goto FINISH;
}
- if ((pid = terminal.Fork(err_str, err_len)) < 0)
+ if ((pid = terminal.Fork(err_str, err_len)) == -1)
{
args->m_error.SetErrorToGenericError();
args->m_error.SetErrorString("Process fork failed.");
diff --git a/lldb/source/Plugins/Process/POSIX/Makefile b/lldb/source/Plugins/Process/POSIX/Makefile
index 6705b0d8d16..45d8d582485 100644
--- a/lldb/source/Plugins/Process/POSIX/Makefile
+++ b/lldb/source/Plugins/Process/POSIX/Makefile
@@ -18,6 +18,10 @@ CPPFLAGS += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Utility
ifeq ($(HOST_OS),Linux)
CPPFLAGS += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Process/Linux
+
+# Disable warning for now as offsetof is used with an index into a structure member array
+# in defining register info tables.
+CPPFLAGS += -Wno-extended-offsetof
endif
ifeq ($(HOST_OS),FreeBSD)
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index f79daa92efa..fa8dcd3d179 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -87,6 +87,7 @@ RegisterContextLLDB::RegisterContextLLDB
void
RegisterContextLLDB::InitializeZerothFrame()
{
+ LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
ExecutionContext exe_ctx(m_thread.shared_from_this());
RegisterContextSP reg_ctx_sp = m_thread.GetRegisterContext();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 4a7e6f1915f..8d7dcbbfdfa 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -448,7 +448,7 @@ SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_inf
else
{
comp_unit_info->symbol_file_supported = false;
- return false;
+ return NULL;
}
}
// Always create a new module for .o files. Why? Because we
diff --git a/lldb/source/Utility/Makefile b/lldb/source/Utility/Makefile
index f1be07e6417..13bcd8376c2 100644
--- a/lldb/source/Utility/Makefile
+++ b/lldb/source/Utility/Makefile
@@ -10,5 +10,6 @@
LLDB_LEVEL := ../..
LIBRARYNAME := lldbUtility
BUILD_ARCHIVE = 1
+NO_PEDANTIC = 1
include $(LLDB_LEVEL)/Makefile
diff --git a/lldb/source/Utility/StringExtractor.cpp b/lldb/source/Utility/StringExtractor.cpp
index 77cb456f2f4..bbe01d240a3 100644
--- a/lldb/source/Utility/StringExtractor.cpp
+++ b/lldb/source/Utility/StringExtractor.cpp
@@ -148,8 +148,8 @@ StringExtractor::GetHexU8 (uint8_t fail_value, bool set_eof_on_fail)
uint32_t i = m_index;
if ((i + 2) <= m_packet.size())
{
- const uint8_t hi_nibble = g_hex_ascii_to_hex_integer[m_packet[i]];
- const uint8_t lo_nibble = g_hex_ascii_to_hex_integer[m_packet[i+1]];
+ const uint8_t hi_nibble = g_hex_ascii_to_hex_integer[static_cast<uint8_t>(m_packet[i])];
+ const uint8_t lo_nibble = g_hex_ascii_to_hex_integer[static_cast<uint8_t>(m_packet[i+1])];
if (hi_nibble < 16 && lo_nibble < 16)
{
m_index += 2;
diff --git a/lldb/tools/driver/IOChannel.cpp b/lldb/tools/driver/IOChannel.cpp
index ade07b003b6..92bd3720fc7 100644
--- a/lldb/tools/driver/IOChannel.cpp
+++ b/lldb/tools/driver/IOChannel.cpp
@@ -472,7 +472,7 @@ IOChannel::Run ()
}
BroadcastEventByType (IOChannel::eBroadcastBitThreadDidExit);
m_driver = NULL;
- m_read_thread = NULL;
+ m_read_thread = 0;
}
bool
diff --git a/lldb/tools/driver/Makefile b/lldb/tools/driver/Makefile
index 88b1f1a661c..af2d9554a63 100644
--- a/lldb/tools/driver/Makefile
+++ b/lldb/tools/driver/Makefile
@@ -10,6 +10,8 @@ LLDB_LEVEL := ../..
TOOLNAME = lldb
+NO_PEDANTIC = 1
+
LLVMLibsOptions += -ledit -llldb -llldbUtility
include $(LLDB_LEVEL)/Makefile
OpenPOWER on IntegriCloud