https://github.com/mati865 created 
https://github.com/llvm/llvm-project/pull/138120

With this define present and building with Clang the build fails:
```
In file included from 
/h/projects/llvm-project/clang/tools/libclang/CIndexer.cpp:36:
In file included from /usr/include/w32api/windows.h:69:
In file included from /usr/include/w32api/windef.h:9:
In file included from /usr/include/w32api/minwindef.h:163:
In file included from /usr/include/w32api/winnt.h:1658:
In file included from /usr/lib/clang/20/include/x86intrin.h:15:
In file included from /usr/lib/clang/20/include/immintrin.h:24:
In file included from /usr/lib/clang/20/include/xmmintrin.h:31:
/usr/lib/clang/20/include/mm_malloc.h:45:22: error: use of undeclared 
identifier '_aligned_malloc'; did you mean 'aligned_alloc'?
   45 |   __mallocedMemory = _aligned_malloc(__size, __align);
      |                      ^
```
Removing it allows the build with Clang to succeed and doesn't break build with 
GCC.

Split out from https://github.com/llvm/llvm-project/pull/134494

From 3dc4b18cc6ecb734fb3ab7fff68f2802149b5007 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= <o...@mateuszmikula.dev>
Date: Fri, 4 Apr 2025 21:41:50 +0200
Subject: [PATCH] [Clang][Cygwin] Remove erroneous _WIN32 define and clean up
 Cygwin code

With this define present and building with Clang the build fails:
```
In file included from 
/h/projects/llvm-project/clang/tools/libclang/CIndexer.cpp:36:
In file included from /usr/include/w32api/windows.h:69:
In file included from /usr/include/w32api/windef.h:9:
In file included from /usr/include/w32api/minwindef.h:163:
In file included from /usr/include/w32api/winnt.h:1658:
In file included from /usr/lib/clang/20/include/x86intrin.h:15:
In file included from /usr/lib/clang/20/include/immintrin.h:24:
In file included from /usr/lib/clang/20/include/xmmintrin.h:31:
/usr/lib/clang/20/include/mm_malloc.h:45:22: error: use of undeclared 
identifier '_aligned_malloc'; did you mean 'aligned_alloc'?
   45 |   __mallocedMemory = _aligned_malloc(__size, __align);
      |                      ^
```
Removing it allows the build with Clang to succeed and doesn't break build with 
GCC.

Co-authored-by: Jeremy Drake <git...@jdrake.com>
---
 clang/tools/libclang/CIndexer.cpp | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/clang/tools/libclang/CIndexer.cpp 
b/clang/tools/libclang/CIndexer.cpp
index 12d9d418dea51..11d9312b64849 100644
--- a/clang/tools/libclang/CIndexer.cpp
+++ b/clang/tools/libclang/CIndexer.cpp
@@ -26,12 +26,6 @@
 #include <cstdio>
 #include <mutex>
 
-#ifdef __CYGWIN__
-#include <cygwin/version.h>
-#include <sys/cygwin.h>
-#define _WIN32 1
-#endif
-
 #ifdef _WIN32
 #include <windows.h>
 #elif defined(_AIX)
@@ -112,16 +106,6 @@ const std::string &CIndexer::getClangResourcesPath() {
                sizeof(mbi));
   GetModuleFileNameA((HINSTANCE)mbi.AllocationBase, path, MAX_PATH);
 
-#ifdef __CYGWIN__
-  char w32path[MAX_PATH];
-  strcpy(w32path, path);
-#if CYGWIN_VERSION_API_MAJOR > 0 || CYGWIN_VERSION_API_MINOR >= 181
-  cygwin_conv_path(CCP_WIN_A_TO_POSIX, w32path, path, MAX_PATH);
-#else
-  cygwin_conv_to_full_posix_path(w32path, path);
-#endif
-#endif
-
   LibClangPath += path;
 #elif defined(_AIX)
   getClangResourcesPathImplAIX(LibClangPath);

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to