From: Evgeny Karpov <[email protected]>
Subject: [PATCH] Support experimental SARIF JSON-RPC notifications on MinGW
 host

[PATCH] diagnostics: add experimental SARIF JSON-RPC notifications for IDEs 
[PR115970]
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=8a155c170b443e332b3db4922f0f0d588a17604f

introduces a regression when building the toolchain for the
aarch64-w64-mingw32 host, at least. It is most likely the same for *-*-mingw32
targets.

This patch resolves the issue when using sockets for SARIF JSON-RPC 
notifications
on MinGW host and adds the required socket library to LINK_SPEC.

Signed-off-by: Evgeny Karpov <[email protected]>
---
 gcc/config/mingw/mingw32.h    | 2 +-
 gcc/diagnostics/sarif-sink.cc | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index 7b7acc3578f..3a59c8a4be2 100644
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -125,7 +125,7 @@ along with GCC; see the file COPYING3.  If not see
                 "%{mwindows:-lgdi32 -lcomdlg32} " \
      "%{fvtable-verify=preinit:-lvtv -lpsapi; \
         fvtable-verify=std:-lvtv -lpsapi} " \
-                 "-ladvapi32 -lshell32 -luser32 -lkernel32"
+                 "-ladvapi32 -lshell32 -luser32 -lkernel32 -lws2_32"
 
 /* Weak symbols do not get resolved if using a Windows dll import lib.
    Make the unwind registration references strong undefs.  */
diff --git a/gcc/diagnostics/sarif-sink.cc b/gcc/diagnostics/sarif-sink.cc
index ac0a2747255..58aa1a93333 100644
--- a/gcc/diagnostics/sarif-sink.cc
+++ b/gcc/diagnostics/sarif-sink.cc
@@ -18,6 +18,13 @@ You should have received a copy of the GNU General Public 
License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#ifdef __MINGW32__
+#include <winsock2.h>
+#include <afunix.h>
+#else
+#include <sys/un.h>
+#include <sys/socket.h>
+#endif
 
 #include "config.h"
 #define INCLUDE_LIST
@@ -55,8 +62,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "backtrace.h"
 #include "xml.h"
 #include "intl.h"
-#include <sys/un.h>
-#include <sys/socket.h>
 
 namespace diagnostics {
 
-- 
2.50.1 (Apple Git-155)

Reply via email to