Skip to content

Commit daf3699

Browse files
committed
[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
1 parent ac29c35 commit daf3699

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lldb/bindings/python/python-wrapper.swig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ private:
3939
// This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...)
4040
// and is used when a script command is attached to a breakpoint for execution.
4141

42+
#pragma clang diagnostic push
43+
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
44+
45+
// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
46+
// C-linkage specified, but returns UDT 'llvm::Expected<bool>' which is
47+
// incompatible with C
48+
#if _MSC_VER
49+
#pragma warning (push)
50+
#pragma warning (disable : 4190)
51+
#endif
52+
4253
SWIGEXPORT llvm::Expected<bool>
4354
LLDBSwigPythonBreakpointCallbackFunction
4455
(
@@ -85,6 +96,12 @@ LLDBSwigPythonBreakpointCallbackFunction
8596
return result.get().get() != Py_False;
8697
}
8798

99+
#if _MSC_VER
100+
#pragma warning (pop)
101+
#endif
102+
103+
#pragma clang diagnostic pop
104+
88105
// This function is called by lldb_private::ScriptInterpreterPython::WatchpointCallbackFunction(...)
89106
// and is used when a script command is attached to a watchpoint for execution.
90107

0 commit comments

Comments
 (0)