From 1cc0ba4cbdc54200e1b3c65e83e51a5368a819ea Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Tue, 3 Dec 2019 09:53:26 -0500 Subject: [PATCH] [LLDB] Disable MSVC warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has C-linkage specified, but returns UDT 'llvm::Expected' which is incompatible with C Differential Revision: https://reviews.llvm.org/D70830 --- .../ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 12 ++++++++++++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 5ed01cf..f6b9183 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -77,11 +77,23 @@ extern "C" void init_lldb(void); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" +// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has +// C-linkage specified, but returns UDT 'llvm::Expected' which is +// incompatible with C +#if _MSC_VER +#pragma warning (push) +#pragma warning (disable : 4190) +#endif + extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction( const char *python_function_name, const char *session_dictionary_name, const lldb::StackFrameSP &sb_frame, const lldb::BreakpointLocationSP &sb_bp_loc, StructuredDataImpl *args_impl); +#if _MSC_VER +#pragma warning (pop) +#endif + #pragma clang diagnostic pop extern "C" bool LLDBSwigPythonWatchpointCallbackFunction( diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp index 12ffdfe..8bc510b 100644 --- a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp +++ b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp @@ -62,6 +62,14 @@ extern "C" void init_lldb(void) {} #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" +// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has +// C-linkage specified, but returns UDT 'llvm::Expected' which is +// incompatible with C +#if _MSC_VER +#pragma warning (push) +#pragma warning (disable : 4190) +#endif + extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction( const char *python_function_name, const char *session_dictionary_name, const lldb::StackFrameSP &sb_frame, @@ -70,6 +78,10 @@ extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction( return false; } +#if _MSC_VER +#pragma warning (pop) +#endif + #pragma clang diagnostic pop extern "C" bool LLDBSwigPythonWatchpointCallbackFunction( -- 2.7.4