[llvm] Fix _WIN32 Wundef warning; NFC (PR #159301)

Sven van Haastregt via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 02:52:26 PDT 2025


https://github.com/svenvh created https://github.com/llvm/llvm-project/pull/159301

The `_WIN32` macro is tested for defined-ness everywhere else.  The instance here triggers a warning when compiling with `-Wundef`.

>From 9b9cd748e304516dbd1bc0d6505080750e53b5d6 Mon Sep 17 00:00:00 2001
From: Sven van Haastregt <sven.vanhaastregt at arm.com>
Date: Wed, 17 Sep 2025 10:41:30 +0100
Subject: [PATCH] Fix _WIN32 Wundef warning; NFC

The `_WIN32` macro is tested for defined-ness everywhere else.  The
instance here triggers a warning when compiling with `-Wundef`.
---
 llvm/lib/Support/raw_socket_stream.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Support/raw_socket_stream.cpp b/llvm/lib/Support/raw_socket_stream.cpp
index fd1c681672138..3b510d357fd5d 100644
--- a/llvm/lib/Support/raw_socket_stream.cpp
+++ b/llvm/lib/Support/raw_socket_stream.cpp
@@ -255,7 +255,7 @@ manageTimeout(const std::chrono::milliseconds &Timeout,
   // has been canceled by another thread
   if (getActiveFD() == -1 || (CancelFD.has_value() && FD[1].revents & POLLIN))
     return std::make_error_code(std::errc::operation_canceled);
-#if _WIN32
+#ifdef _WIN32
   if (PollStatus == SOCKET_ERROR)
 #else
   if (PollStatus == -1)



More information about the llvm-commits mailing list