From 51ce6c437fec1fe0170d077424e1cbc141d05c2b Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 24 Feb 2025 12:15:32 -0600 Subject: [PATCH] [lldb-dap] Fix error C2065: 'PATH_MAX': undeclared identifier This should fix the Windows build. --- lldb/tools/lldb-dap/EventHelper.cpp | 9 +++++++++ lldb/tools/lldb-dap/lldb-dap.cpp | 8 +------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lldb/tools/lldb-dap/EventHelper.cpp b/lldb/tools/lldb-dap/EventHelper.cpp index 20845fbc5b91..705eb0a457d9 100644 --- a/lldb/tools/lldb-dap/EventHelper.cpp +++ b/lldb/tools/lldb-dap/EventHelper.cpp @@ -12,6 +12,15 @@ #include "LLDBUtils.h" #include "lldb/API/SBFileSpec.h" +#if defined(_WIN32) +#define NOMINMAX +#include + +#ifndef PATH_MAX +#define PATH_MAX MAX_PATH +#endif +#endif + namespace lldb_dap { static void SendThreadExitedEvent(DAP &dap, lldb::tid_t tid) { diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index fcefb4137f22..7935e88dba71 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -80,6 +80,7 @@ #include #undef GetObject #include +typedef int socklen_t; #else #include #include @@ -91,13 +92,6 @@ #include #endif -#if defined(_WIN32) -#ifndef PATH_MAX -#define PATH_MAX MAX_PATH -#endif -typedef int socklen_t; -#endif - using namespace lldb_dap; using lldb_private::NativeSocket; using lldb_private::Socket;