Skip to content

Commit 93a24ff

Browse files
mati865jeremyd2019
andcommitted
[Clang][Cygwin] Remove erroneous _WIN32 define and clean up Cygwin code (llvm#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. The "#define _WIN32" was originally "#define LLVM_ON_WIN32", but this was changed into a plain "#define _WIN32" (which not necessarily is something that is supported to do) in 1865df4 as part of a larger refactoring. This cygwin specific code isn't needed for converting paths anymore, as dladdr takes care of it. (dladdr was added to cygwin in 2017, according to the tags in version 2.8.0.) Co-authored-by: Jeremy Drake <[email protected]>
1 parent 1a8814d commit 93a24ff

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

clang/tools/libclang/CIndexer.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@
2626
#include <cstdio>
2727
#include <mutex>
2828

29-
#ifdef __CYGWIN__
30-
#include <cygwin/version.h>
31-
#include <sys/cygwin.h>
32-
#define _WIN32 1
33-
#endif
34-
3529
#ifdef _WIN32
3630
#include <windows.h>
3731
#elif defined(_AIX)
@@ -112,16 +106,6 @@ const std::string &CIndexer::getClangResourcesPath() {
112106
sizeof(mbi));
113107
GetModuleFileNameA((HINSTANCE)mbi.AllocationBase, path, MAX_PATH);
114108

115-
#ifdef __CYGWIN__
116-
char w32path[MAX_PATH];
117-
strcpy(w32path, path);
118-
#if CYGWIN_VERSION_API_MAJOR > 0 || CYGWIN_VERSION_API_MINOR >= 181
119-
cygwin_conv_path(CCP_WIN_A_TO_POSIX, w32path, path, MAX_PATH);
120-
#else
121-
cygwin_conv_to_full_posix_path(w32path, path);
122-
#endif
123-
#endif
124-
125109
LibClangPath += path;
126110
#elif defined(_AIX)
127111
getClangResourcesPathImplAIX(LibClangPath);

0 commit comments

Comments
 (0)