From daf36998694fd9a0beaf7e1659ae41a6d1079107 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Wed, 10 Mar 2021 12:48:05 -0800 Subject: [PATCH] [lldb] Ignore linkage diagnostic for LLDBSwigPythonBreakpointCallbackFunction (NFC) Ignore `-Wreturn-type-c-linkage` diagnostics for `LLDBSwigPythonBreakpointCallbackFunction`. The function is defined in `python-wrapper.swig` which uses `extern "C" { ... }` blocks. The declaration of this function in `ScriptInterpreterPython.cpp` already uses these same pragmas to silence the warning there. This prevents `-Werror` builds from failing. Differential Revision: https://reviews.llvm.org/D98368 --- lldb/bindings/python/python-wrapper.swig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index 443ddfb..b189bfd 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -39,6 +39,17 @@ private: // This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...) // and is used when a script command is attached to a breakpoint for execution. +#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 + SWIGEXPORT llvm::Expected LLDBSwigPythonBreakpointCallbackFunction ( @@ -85,6 +96,12 @@ LLDBSwigPythonBreakpointCallbackFunction return result.get().get() != Py_False; } +#if _MSC_VER +#pragma warning (pop) +#endif + +#pragma clang diagnostic pop + // This function is called by lldb_private::ScriptInterpreterPython::WatchpointCallbackFunction(...) // and is used when a script command is attached to a watchpoint for execution. -- 2.7.4