dim created this revision.
dim added reviewers: tammela, siger-young, emaste.
dim requested review of this revision.
Herald added a project: LLDB.

When lldb Lua bindings are enabled, the generated `LLDBWrapLua.cpp` file
generates a compiler warning about C-linkage:

  lldb/LLDBWrapLua.cpp:71170:1: warning: 
'LLDBSwigLuaBreakpointCallbackFunction' has C-linkage specified, but returns 
incomplete type 'llvm::Expected<bool>' which could be incompatible with C

In `lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp` these warnings
are suppressed using a few pragmas. Also Add these to `lua-wrapper.swig`
so they end up in `LLDBWrapLua.cpp`, making the warnings disappear.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115074

Files:
  lldb/bindings/lua/lua-wrapper.swig


Index: lldb/bindings/lua/lua-wrapper.swig
===================================================================
--- lldb/bindings/lua/lua-wrapper.swig
+++ lldb/bindings/lua/lua-wrapper.swig
@@ -21,6 +21,17 @@
 
 %wrapper %{
 
+#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<bool>' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 // This function is called from Lua::CallBreakpointCallback
 SWIGEXPORT llvm::Expected<bool>
 LLDBSwigLuaBreakpointCallbackFunction
@@ -101,6 +112,12 @@
    return stop;
 }
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
+#pragma clang diagnostic pop
+
 SWIGEXPORT void
 LLDBSwigLuaCallLuaLogOutputCallback(const char *str, void *baton) {
    lua_State *L = (lua_State *)baton;


Index: lldb/bindings/lua/lua-wrapper.swig
===================================================================
--- lldb/bindings/lua/lua-wrapper.swig
+++ lldb/bindings/lua/lua-wrapper.swig
@@ -21,6 +21,17 @@
 
 %wrapper %{
 
+#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<bool>' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 // This function is called from Lua::CallBreakpointCallback
 SWIGEXPORT llvm::Expected<bool>
 LLDBSwigLuaBreakpointCallbackFunction
@@ -101,6 +112,12 @@
    return stop;
 }
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
+#pragma clang diagnostic pop
+
 SWIGEXPORT void
 LLDBSwigLuaCallLuaLogOutputCallback(const char *str, void *baton) {
    lua_State *L = (lua_State *)baton;
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to