clang: clean up msysize patches

cmake defines CYGWIN now and in C we have __CYGWIN__ too
This commit is contained in:
Christoph Reiter
2021-04-26 18:54:22 +02:00
parent bcfe069869
commit db97f886e4
4 changed files with 6 additions and 669 deletions

View File

@@ -1,77 +1,11 @@
From 88e7895f08d55c69500d363fffbae3ca705356be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= <mati865@gmail.com>
Date: Thu, 29 Oct 2020 18:31:43 +0100
Subject: Msysize
---
CMakeLists.txt | 6 +++---
cmake/config-ix.cmake | 4 ++--
cmake/modules/AddLLVM.cmake | 10 +++++-----
cmake/modules/CMakeLists.txt | 2 +-
cmake/modules/HandleLLVMOptions.cmake | 14 +++++++-------
include/llvm/Config/abi-breaking.h.cmake | 2 +-
include/llvm/Support/Compiler.h | 6 ++++--
lib/Support/MemoryBuffer.cpp | 2 +-
lib/Support/Unix/DynamicLibrary.inc | 4 ++--
lib/Support/Unix/Path.inc | 8 +++++---
lib/Support/raw_ostream.cpp | 2 +-
lib/Transforms/Hello/CMakeLists.txt | 2 +-
test/CodeGen/MIR/AArch64/lit.local.cfg | 2 +-
test/Unit/lit.cfg.py | 2 +-
test/lit.cfg.py | 2 +-
tools/CMakeLists.txt | 2 +-
tools/bugpoint-passes/CMakeLists.txt | 2 +-
tools/lli/lli.cpp | 2 +-
tools/llvm-shlib/CMakeLists.txt | 2 +-
.../unittests/ExecutionEngine/MCJIT/CMakeLists.txt | 2 +-
utils/benchmark/CMakeLists.txt | 2 +-
utils/benchmark/src/internal_macros.h | 4 ++--
utils/lit/lit/formats/googletest.py | 2 +-
utils/lit/tests/lit.cfg | 2 +-
.../include/gtest/internal/gtest-port-arch.h | 2 +-
25 files changed, 47 insertions(+), 43 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 038139a2409..0f73da65365 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -281,7 +281,7 @@ mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
-if(WIN32 OR CYGWIN)
+if(WIN32 OR CYGWIN OR MSYS)
# DLL platform -- put DLLs into bin.
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
else()
@@ -513,7 +513,7 @@ endif()
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
# On Win32 hosts, provide an option to specify the path to the GnuWin32 tools.
-if( WIN32 AND NOT CYGWIN )
+if( WIN32 AND NOT (CYGWIN OR MSYS) )
set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools")
endif()
@@ -666,7 +666,7 @@ set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
message(STATUS "LLVM host triple: ${LLVM_HOST_TRIPLE}")
message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}")
-if(WIN32 OR CYGWIN)
+if(WIN32 OR CYGWIN OR MSYS)
if(BUILD_SHARED_LIBS OR LLVM_BUILD_LLVM_DYLIB)
set(LLVM_ENABLE_PLUGINS_default ON)
else()
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 90e5d327c75..69f1ed7bc14 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -1,4 +1,4 @@
-if( WIN32 AND NOT CYGWIN )
+if( WIN32 AND NOT (CYGWIN OR MSYS) )
# We consider Cygwin as another Unix
set(PURE_WINDOWS 1)
endif()
@@ -269,7 +269,7 @@ CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
@@ -81,251 +15,6 @@ index 90e5d327c75..69f1ed7bc14 100644
add_definitions( -D_GNU_SOURCE )
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
endif()
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 333167bfb6b..72ddfbf7aaa 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -279,7 +279,7 @@ function(set_output_directory target)
# module_dir -- corresponding to LIBRARY_OUTPUT_DIRECTORY.
# It affects output of add_library(MODULE).
- if(WIN32 OR CYGWIN)
+ if(WIN32 OR CYGWIN OR MSYS)
# DLL platform
set(module_dir ${ARG_BINARY_DIR})
else()
@@ -613,7 +613,7 @@ function(llvm_add_library name)
endif()
endif()
- if(ARG_MODULE AND LLVM_EXPORT_SYMBOLS_FOR_PLUGINS AND ARG_PLUGIN_TOOL AND (WIN32 OR CYGWIN))
+ if(ARG_MODULE AND LLVM_EXPORT_SYMBOLS_FOR_PLUGINS AND ARG_PLUGIN_TOOL AND (WIN32 OR CYGWIN OR MSYS))
# On DLL platforms symbols are imported from the tool by linking against it.
set(llvm_libs ${ARG_PLUGIN_TOOL})
elseif (NOT ARG_COMPONENT_LIB)
@@ -1108,10 +1108,10 @@ function(export_executable_symbols target)
# ".dll.a", but for clang.exe that causes a collision with libclang.dll,
# where the import libraries of both get named libclang.dll.a. Use a suffix
# of ".exe.a" to avoid this.
- if(CYGWIN OR MINGW)
+ if(CYGWIN OR MINGW OR MSYS)
set_target_properties(${target} PROPERTIES IMPORT_SUFFIX ".exe.a")
endif()
- elseif(NOT (WIN32 OR CYGWIN))
+ elseif(NOT (WIN32 OR CYGWIN OR MSYS))
# On Windows auto-exporting everything doesn't work because of the limit on
# the size of the exported symbol table, but on other platforms we can do
# it without any trouble.
@@ -1676,7 +1676,7 @@ function(get_llvm_lit_path base_dir file_name)
endif()
set(lit_file_name "llvm-lit")
- if (CMAKE_HOST_WIN32 AND NOT CYGWIN)
+ if (CMAKE_HOST_WIN32 AND NOT (CYGWIN OR MSYS))
# llvm-lit needs suffix.py for multiprocess to find a main module.
set(lit_file_name "${lit_file_name}.py")
endif ()
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 4b8879f65fe..159dd50cb8a 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -59,7 +59,7 @@ set(LLVM_CONFIG_TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}")
# Generate a default location for lit
if (LLVM_BUILD_UTILS)
- if (CMAKE_HOST_WIN32 AND NOT CYGWIN)
+ if (CMAKE_HOST_WIN32 AND NOT (CYGWIN OR MSYS))
set(LLVM_CONFIG_DEFAULT_EXTERNAL_LIT "${LLVM_CONFIG_TOOLS_BINARY_DIR}/llvm-lit.py")
else()
set(LLVM_CONFIG_DEFAULT_EXTERNAL_LIT "${LLVM_CONFIG_TOOLS_BINARY_DIR}/llvm-lit")
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
index 5ef22eb493b..ea97e1ce9f3 100644
--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -124,13 +124,13 @@ endif()
if(WIN32)
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
- if(CYGWIN)
+ if(CYGWIN OR MSYS)
set(LLVM_ON_WIN32 0)
set(LLVM_ON_UNIX 1)
- else(CYGWIN)
+ else(CYGWIN OR MSYS)
set(LLVM_ON_WIN32 1)
set(LLVM_ON_UNIX 0)
- endif(CYGWIN)
+ endif(CYGWIN OR MSYS)
else(WIN32)
if(FUCHSIA OR UNIX)
set(LLVM_ON_WIN32 0)
@@ -209,7 +209,7 @@ endif()
# Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
# build might work on ELF but fail on MachO/COFF.
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|SunOS" OR
- WIN32 OR CYGWIN) AND
+ WIN32 OR CYGWIN OR MSYS) AND
NOT LLVM_USE_SANITIZER)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
endif()
@@ -282,7 +282,7 @@ if( LLVM_ENABLE_PIC )
# Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
# know how to disable this, so just force ENABLE_PIC off for now.
message(WARNING "-fPIC not supported with Xcode.")
- elseif( WIN32 OR CYGWIN)
+ elseif( WIN32 OR CYGWIN OR MSYS)
# On Windows all code is PIC. MinGW warns if -fPIC is used.
else()
add_flag_or_print_warning("-fPIC" FPIC)
@@ -303,7 +303,7 @@ if( LLVM_ENABLE_PIC )
endif()
endif()
-if(NOT WIN32 AND NOT CYGWIN AND NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
+if(NOT WIN32 AND NOT (CYGWIN OR MSYS) AND NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
# MinGW warns if -fvisibility-inlines-hidden is used.
# GCC on AIX warns if -fvisibility-inlines-hidden is used.
check_cxx_compiler_flag("-fvisibility-inlines-hidden" SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG)
@@ -820,7 +820,7 @@ endif()
# FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
# But MinSizeRel seems to add that automatically, so maybe disable these
# flags instead if LLVM_NO_DEAD_STRIP is set.
-if(NOT CYGWIN AND NOT WIN32)
+if(NOT (CYGWIN OR MSYS) AND NOT WIN32)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND
NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
check_c_compiler_flag("-Werror -fno-function-sections" C_SUPPORTS_FNO_FUNCTION_SECTIONS)
diff --git a/include/llvm/Config/abi-breaking.h.cmake b/include/llvm/Config/abi-breaking.h.cmake
index a1ffad66077..534410b2ce6 100644
--- a/include/llvm/Config/abi-breaking.h.cmake
+++ b/include/llvm/Config/abi-breaking.h.cmake
@@ -31,7 +31,7 @@
#pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS))
#undef LLVM_XSTR
#undef LLVM_STR
-#elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch
+#elif defined(_WIN32) || defined(__CYGWIN__) || defined(__MSYS__) // Win32 w/o #pragma detect_mismatch
// FIXME: Implement checks without weak.
#elif defined(__cplusplus)
#if !(defined(_AIX) && defined(__GNUC__) && !defined(__clang__))
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h
index 80ea76240d6..82b3d68c02d 100644
--- a/include/llvm/Support/Compiler.h
+++ b/include/llvm/Support/Compiler.h
@@ -123,7 +123,8 @@
/// this attribute will be made public and visible outside of any shared library
/// they are linked in to.
#if (__has_attribute(visibility) || LLVM_GNUC_PREREQ(4, 0, 0)) && \
- !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32)
+ !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32) && \
+ !defined(__MSYS__)
#define LLVM_LIBRARY_VISIBILITY __attribute__ ((visibility("hidden")))
#define LLVM_EXTERNAL_VISIBILITY __attribute__ ((visibility("default")))
#else
@@ -189,7 +190,8 @@
// FIXME: Provide this for PE/COFF targets.
#if (__has_attribute(weak) || LLVM_GNUC_PREREQ(4, 0, 0)) && \
- (!defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32))
+ (!defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32) && \
+ !defined(__MSYS__))
#define LLVM_ATTRIBUTE_WEAK __attribute__((__weak__))
#else
#define LLVM_ATTRIBUTE_WEAK
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp
index 248fb72c496..3bea6ef9fe8 100644
--- a/lib/Support/MemoryBuffer.cpp
+++ b/lib/Support/MemoryBuffer.cpp
@@ -363,7 +363,7 @@ static bool shouldUseMmap(sys::fs::file_t FD,
if ((FileSize & (PageSize -1)) == 0)
return false;
-#if defined(__CYGWIN__)
+#if defined(__CYGWIN__) || defined(__MSYS__)
// Don't try to map files that are exactly a multiple of the physical page size
// if we need a null terminator.
// FIXME: We should reorganize again getPageSize() on Win32.
diff --git a/lib/Support/Unix/DynamicLibrary.inc b/lib/Support/Unix/DynamicLibrary.inc
index a2a379963de..d9f8abb5e67 100644
--- a/lib/Support/Unix/DynamicLibrary.inc
+++ b/lib/Support/Unix/DynamicLibrary.inc
@@ -31,7 +31,7 @@ void *DynamicLibrary::HandleSet::DLOpen(const char *File, std::string *Err) {
return &DynamicLibrary::Invalid;
}
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__MSYS__)
// Cygwin searches symbols only in the main
// with the handle of dlopen(NULL, RTLD_GLOBAL).
if (!File)
@@ -91,7 +91,7 @@ static void *DoSearch(const char* SymbolName) {
}
#endif
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__MSYS__)
{
EXPLICIT_SYMBOL(_alloca);
EXPLICIT_SYMBOL(__main);
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index d91b269cc6d..308fa8f6e7a 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -123,7 +123,8 @@ const file_t kInvalidFile = -1;
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
defined(__minix) || defined(__FreeBSD_kernel__) || defined(__linux__) || \
- defined(__CYGWIN__) || defined(__DragonFly__) || defined(_AIX) || defined(__GNU__)
+ defined(__CYGWIN__) || defined(__DragonFly__) || defined(_AIX) || \
+ defined(__GNU__) || defined(__MSYS__)
static int
test_dir(char ret[PATH_MAX], const char *dir, const char *bin)
{
@@ -239,7 +240,8 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
// If we don't have procfs mounted, fall back to argv[0]
if (getprogpath(exe_path, argv0) != NULL)
return exe_path;
-#elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__)
+#elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__) || \
+ defined(__MSYS__)
char exe_path[PATH_MAX];
const char *aPath = "/proc/self/exe";
if (sys::fs::exists(aPath)) {
@@ -469,7 +471,7 @@ static bool is_local_impl(struct STATVFS &Vfs) {
default:
return true;
}
-#elif defined(__CYGWIN__)
+#elif defined(__CYGWIN__) || defined(__MSYS__)
// Cygwin doesn't expose this information; would need to use Win32 API.
return false;
#elif defined(__Fuchsia__)
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index f2d78d77323..c344401eb81 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -41,7 +41,7 @@
# include <unistd.h>
#endif
-#if defined(__CYGWIN__)
+#if defined(__CYGWIN__) || defined(__MSYS__)
#include <io.h>
#endif
diff --git a/lib/Transforms/Hello/CMakeLists.txt b/lib/Transforms/Hello/CMakeLists.txt
index c4f10247c1a..249f86ec272 100644
--- a/lib/Transforms/Hello/CMakeLists.txt
+++ b/lib/Transforms/Hello/CMakeLists.txt
@@ -6,7 +6,7 @@ if( NOT LLVM_REQUIRES_RTTI )
endif()
endif()
-if(WIN32 OR CYGWIN)
+if(WIN32 OR CYGWIN OR MSYS)
set(LLVM_LINK_COMPONENTS Core Support)
endif()
diff --git a/test/CodeGen/MIR/AArch64/lit.local.cfg b/test/CodeGen/MIR/AArch64/lit.local.cfg
index f4f77c5aa31..04f6c112bdd 100644
--- a/test/CodeGen/MIR/AArch64/lit.local.cfg
@@ -363,45 +52,6 @@ index 4eaa6cb77c8..dfac0215771 100644
lli_args = ['-mtriple=' + config.host_triple + '-elf']
llc_args = []
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index b6d3b2c2fcb..296660e97d2 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -17,7 +17,7 @@ if(NOT LLVM_USE_INTEL_JITEVENTS )
set(LLVM_TOOL_LLVM_JITLISTENER_BUILD Off)
endif()
-if(CYGWIN OR NOT LLVM_ENABLE_PIC)
+if(CYGWIN OR MSYS OR NOT LLVM_ENABLE_PIC)
set(LLVM_TOOL_LTO_BUILD Off)
endif()
diff --git a/tools/bugpoint-passes/CMakeLists.txt b/tools/bugpoint-passes/CMakeLists.txt
index eea3e239b80..eaa72cd8a95 100644
--- a/tools/bugpoint-passes/CMakeLists.txt
+++ b/tools/bugpoint-passes/CMakeLists.txt
@@ -10,7 +10,7 @@ if( NOT LLVM_REQUIRES_RTTI )
endif()
endif()
-if(WIN32 OR CYGWIN)
+if(WIN32 OR CYGWIN OR MSYS)
set(LLVM_LINK_COMPONENTS Core)
endif()
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index 981e0812d45..5fc87aa0e4a 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -61,7 +61,7 @@
#include "llvm/Transforms/Instrumentation.h"
#include <cerrno>
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__MSYS__)
#include <cygwin/version.h>
#if defined(CYGWIN_VERSION_DLL_MAJOR) && CYGWIN_VERSION_DLL_MAJOR<1007
#define DO_NOTHING_ATEXIT 1
diff --git a/tools/llvm-shlib/CMakeLists.txt b/tools/llvm-shlib/CMakeLists.txt
index f3a2056f80d..f1decd975d4 100644
--- a/tools/llvm-shlib/CMakeLists.txt
@@ -415,46 +65,6 @@ index f3a2056f80d..f1decd975d4 100644
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "GNU")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
diff --git a/unittests/ExecutionEngine/MCJIT/CMakeLists.txt b/unittests/ExecutionEngine/MCJIT/CMakeLists.txt
index b5f8a14c41c..03da955f388 100644
--- a/unittests/ExecutionEngine/MCJIT/CMakeLists.txt
+++ b/unittests/ExecutionEngine/MCJIT/CMakeLists.txt
@@ -29,6 +29,6 @@ add_llvm_unittest(MCJITTests
${MCJITTestsSources}
)
-if(MINGW OR CYGWIN)
+if(MINGW OR CYGWIN OR MSYS)
set_property(TARGET MCJITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
endif()
diff --git a/utils/benchmark/CMakeLists.txt b/utils/benchmark/CMakeLists.txt
index 38bc8c6bc95..88454f8a88f 100644
--- a/utils/benchmark/CMakeLists.txt
+++ b/utils/benchmark/CMakeLists.txt
@@ -173,7 +173,7 @@ else()
# predefined macro, which turns on all of the wonderful libc extensions.
# However g++ doesn't do this in Cygwin so we have to define it ourselfs
# since we depend on GNU/POSIX/BSD extensions.
- if (CYGWIN)
+ if (CYGWIN OR MSYS)
add_definitions(-D_GNU_SOURCE=1)
endif()
diff --git a/utils/benchmark/src/internal_macros.h b/utils/benchmark/src/internal_macros.h
index f2d54bfcbd9..79745e78f83 100644
--- a/utils/benchmark/src/internal_macros.h
+++ b/utils/benchmark/src/internal_macros.h
@@ -31,8 +31,8 @@
#define BENCHMARK_NORETURN
#endif
-#if defined(__CYGWIN__)
- #define BENCHMARK_OS_CYGWIN 1
+#if defined(__CYGWIN__) || defined(__MSYS__)
+#define BENCHMARK_OS_CYGWIN 1
#elif defined(_WIN32)
#define BENCHMARK_OS_WINDOWS 1
#if defined(__MINGW32__)
diff --git a/utils/lit/lit/formats/googletest.py b/utils/lit/lit/formats/googletest.py
index 059eb99762e..5ef9c2fb128 100644
--- a/utils/lit/lit/formats/googletest.py
@@ -481,19 +91,3 @@ index 3c49f076a66..62fa8816e47 100644
config.available_features.add('system-windows')
if platform.system() == 'AIX':
config.available_features.add('system-aix')
diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h b/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h
index f1319c7f2e2..e19c6a04b78 100644
--- a/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h
+++ b/utils/unittest/googletest/include/gtest/internal/gtest-port-arch.h
@@ -36,7 +36,7 @@
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
// Determines the platform on which Google Test is compiled.
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__MSYS__)
# define GTEST_OS_CYGWIN 1
#elif defined __SYMBIAN32__
# define GTEST_OS_SYMBIAN 1
--
2.29.0.windows.1

View File

@@ -1,168 +1,3 @@
From 81c534afc411d980e8d85a6ef72b1f3b6a7a91eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= <mati865@gmail.com>
Date: Thu, 29 Oct 2020 18:42:31 +0100
Subject: Msysize
---
CMakeLists.txt | 4 ++--
examples/AnnotateFunctions/CMakeLists.txt | 2 +-
examples/Attribute/CMakeLists.txt | 2 +-
examples/PrintFunctionNames/CMakeLists.txt | 2 +-
test/CodeGen/2003-08-21-WideString.c | 2 +-
test/CodeGen/2009-07-15-pad-wchar_t-array.c | 2 +-
test/CodeGen/extern-weak.c | 5 +++--
test/CodeGen/wchar-const.c | 2 +-
test/Sema/return.c | 2 +-
test/Sema/wchar.c | 2 +-
test/lit.cfg.py | 4 ++--
tools/CMakeLists.txt | 2 +-
tools/driver/CMakeLists.txt | 2 +-
tools/libclang/CIndexer.cpp | 4 ++--
tools/scan-build-py/libear/__init__.py | 2 +-
tools/scan-build-py/libscanbuild/intercept.py | 2 +-
tools/scan-build/CMakeLists.txt | 2 +-
17 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e06c5fd902..7bc1cbdf9d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,7 +98,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
- if(WIN32 OR CYGWIN)
+ if(WIN32 OR CYGWIN OR MSYS)
# DLL platform -- put DLLs into bin.
set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
else()
@@ -214,7 +214,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
# On Win32 hosts, provide an option to specify the path to the GnuWin32 tools.
- if( WIN32 AND NOT CYGWIN )
+ if( WIN32 AND NOT CYGWIN OR MSYS )
set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools")
endif()
else()
diff --git a/examples/AnnotateFunctions/CMakeLists.txt b/examples/AnnotateFunctions/CMakeLists.txt
index e9850b64f08..c10584f747a 100644
--- a/examples/AnnotateFunctions/CMakeLists.txt
+++ b/examples/AnnotateFunctions/CMakeLists.txt
@@ -1,6 +1,6 @@
add_llvm_library(AnnotateFunctions MODULE AnnotateFunctions.cpp PLUGIN_TOOL clang)
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN OR MSYS))
set(LLVM_LINK_COMPONENTS
Support
)
diff --git a/examples/Attribute/CMakeLists.txt b/examples/Attribute/CMakeLists.txt
index ed02f5e5992..0218a379a28 100644
--- a/examples/Attribute/CMakeLists.txt
+++ b/examples/Attribute/CMakeLists.txt
@@ -1,6 +1,6 @@
add_llvm_library(Attribute MODULE Attribute.cpp PLUGIN_TOOL clang)
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN OR MSYS))
target_link_libraries(Attribute PRIVATE
clangAST
clangBasic
diff --git a/examples/PrintFunctionNames/CMakeLists.txt b/examples/PrintFunctionNames/CMakeLists.txt
index 63b0c015732..df5165de3de 100644
--- a/examples/PrintFunctionNames/CMakeLists.txt
+++ b/examples/PrintFunctionNames/CMakeLists.txt
@@ -11,7 +11,7 @@ endif()
add_llvm_library(PrintFunctionNames MODULE PrintFunctionNames.cpp PLUGIN_TOOL clang)
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN OR MSYS))
set(LLVM_LINK_COMPONENTS
Support
)
diff --git a/test/CodeGen/2003-08-21-WideString.c b/test/CodeGen/2003-08-21-WideString.c
index 1a6e5b7c882..0b1c9933f83 100644
--- a/test/CodeGen/2003-08-21-WideString.c
+++ b/test/CodeGen/2003-08-21-WideString.c
@@ -3,7 +3,7 @@
// This bit is taken from Sema/wchar.c so we can avoid the wchar.h include.
typedef __WCHAR_TYPE__ wchar_t;
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
- || defined(_M_X64) || defined(SHORT_WCHAR)
+ || defined(_M_X64) || defined(SHORT_WCHAR) || defined(__MSYS__)
#define WCHAR_T_TYPE unsigned short
#elif defined(__sun)
#define WCHAR_T_TYPE long
diff --git a/test/CodeGen/2009-07-15-pad-wchar_t-array.c b/test/CodeGen/2009-07-15-pad-wchar_t-array.c
index 4ae35158fa8..086c6de86de 100644
--- a/test/CodeGen/2009-07-15-pad-wchar_t-array.c
+++ b/test/CodeGen/2009-07-15-pad-wchar_t-array.c
@@ -3,7 +3,7 @@
// This bit is taken from Sema/wchar.c so we can avoid the wchar.h include.
typedef __WCHAR_TYPE__ wchar_t;
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
- || defined(_M_X64) || defined(SHORT_WCHAR)
+ || defined(_M_X64) || defined(SHORT_WCHAR) || defined(__MSYS__)
#define WCHAR_T_TYPE unsigned short
#elif defined(__sun)
#define WCHAR_T_TYPE long
diff --git a/test/CodeGen/extern-weak.c b/test/CodeGen/extern-weak.c
index 6a78a33af65..15dc76b4c59 100644
--- a/test/CodeGen/extern-weak.c
+++ b/test/CodeGen/extern-weak.c
@@ -1,8 +1,9 @@
// RUN: %clang_cc1 -O3 -emit-llvm -o - %s | grep extern_weak
// RUN: %clang_cc1 -O3 -emit-llvm -o - %s | llc
-#if !defined(__linux__) && !defined(__FreeBSD__) && \
- !defined(__OpenBSD__) && !defined(__CYGWIN__) && !defined(__DragonFly__)
+#if !defined(__linux__) && !defined(__FreeBSD__) && \
+ !defined(__OpenBSD__) && !defined(__CYGWIN__) && !defined(__DragonFly__) && \
+ !defined(__MSYS__)
void foo() __attribute__((weak_import));
#else
void foo() __attribute__((weak));
diff --git a/test/CodeGen/wchar-const.c b/test/CodeGen/wchar-const.c
index 91b14ecc102..4a103a6ea03 100644
--- a/test/CodeGen/wchar-const.c
+++ b/test/CodeGen/wchar-const.c
@@ -5,7 +5,7 @@
// This bit is taken from Sema/wchar.c so we can avoid the wchar.h include.
typedef __WCHAR_TYPE__ wchar_t;
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
- || defined(_M_X64) || defined(SHORT_WCHAR)
+ || defined(_M_X64) || defined(SHORT_WCHAR) || defined(__MSYS__)
#define WCHAR_T_TYPE unsigned short
#elif defined(__sun)
#define WCHAR_T_TYPE long
diff --git a/test/Sema/return.c b/test/Sema/return.c
index 632d3430c30..0002e7d4c11 100644
--- a/test/Sema/return.c
+++ b/test/Sema/return.c
@@ -209,7 +209,7 @@ int test30() {
if (j)
longjmp(test30_j, 1);
else
-#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) || defined(__MSYS__)
longjmp(test30_j, 2);
#else
_longjmp(test30_j, 1);
diff --git a/test/Sema/wchar.c b/test/Sema/wchar.c
index 6a4b75b39fd..a2b1a18d427 100644
--- a/test/Sema/wchar.c
+++ b/test/Sema/wchar.c
@@ -4,7 +4,7 @@
typedef __WCHAR_TYPE__ wchar_t;
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
- || defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR)
+ || defined(_M_X64) || defined(__ORBIS__) || defined(SHORT_WCHAR) || defined(__MSYS__)
#define WCHAR_T_TYPE unsigned short
#elif defined(__arm) || defined(__aarch64__)
#define WCHAR_T_TYPE unsigned int
diff --git a/test/lit.cfg.py b/test/lit.cfg.py
index dacda6894a0..dd35dc83b8c 100644
--- a/test/lit.cfg.py
@@ -185,54 +20,6 @@ index dacda6894a0..dd35dc83b8c 100644
config.available_features.add('clang-driver')
# Tests that are specific to the Apple Silicon macOS.
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 85a85812a8d..84d9bd60fde 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -15,7 +15,7 @@ add_clang_subdirectory(c-index-test)
add_clang_subdirectory(clang-rename)
add_clang_subdirectory(clang-refactor)
-if(UNIX OR MINGW)
+if(UNIX OR MINGW OR MSYS)
add_clang_subdirectory(clang-shlib)
endif()
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
index c53485ef195..524b03e8364 100644
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -49,7 +49,7 @@ clang_target_link_libraries(clang
clangSerialization
)
-if(WIN32 AND NOT CYGWIN)
+if(WIN32 AND NOT (CYGWIN OR MSYS))
# Prevent versioning if the buildhost is targeting for Win32.
else()
set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
diff --git a/tools/libclang/CIndexer.cpp b/tools/libclang/CIndexer.cpp
index 3d8c00cf211..0f02a333dcb 100644
--- a/tools/libclang/CIndexer.cpp
+++ b/tools/libclang/CIndexer.cpp
@@ -25,7 +25,7 @@
#include <cstdio>
#include <mutex>
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__MSYS__)
#include <cygwin/version.h>
#include <sys/cygwin.h>
#define _WIN32 1
@@ -111,7 +111,7 @@ const std::string &CIndexer::getClangResourcesPath() {
sizeof(mbi));
GetModuleFileNameA((HINSTANCE)mbi.AllocationBase, path, MAX_PATH);
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__MSYS__)
char w32path[MAX_PATH];
strcpy(w32path, path);
#if CYGWIN_VERSION_API_MAJOR > 0 || CYGWIN_VERSION_API_MINOR >= 181
diff --git a/tools/scan-build-py/libear/__init__.py b/tools/scan-build-py/libear/__init__.py
index 0dfe8c11eba..b46c202ab68 100644
--- a/tools/scan-build-py/libear/__init__.py
@@ -259,19 +46,3 @@ index 70f3233f5e8..c6951cf6d20 100644
@command_entry_point
diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
index ec0702d76f1..ba68989136d 100644
--- a/tools/scan-build/CMakeLists.txt
+++ b/tools/scan-build/CMakeLists.txt
@@ -2,7 +2,7 @@ option(CLANG_INSTALL_SCANBUILD "Install the scan-build tool" ON)
include(GNUInstallDirs)
-if (WIN32 AND NOT CYGWIN)
+if (WIN32 AND NOT (CYGWIN OR MSYS))
set(BinFiles
scan-build
scan-build.bat
--
2.29.0.windows.1

View File

@@ -1,25 +0,0 @@
From 694a3db2770bf7c27455cb49b2fda65e2fb147b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= <mati865@gmail.com>
Date: Thu, 29 Oct 2020 18:43:23 +0100
Subject: Msysize
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 040bb2c8f6d..c26abbb951f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,7 +130,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
# On Win32 hosts, provide an option to specify the path to the GnuWin32 tools.
- if(WIN32 AND NOT CYGWIN)
+ if(WIN32 AND NOT (CYGWIN OR MSYS))
set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools")
endif()
else()
--
2.29.0.windows.1

View File

@@ -15,7 +15,7 @@ _realname=clang
pkgbase=${_realname}
pkgname=("${_realname}" "lld" "llvm")
pkgver=11.0.0
pkgrel=2
pkgrel=3
pkgdesc="C language family frontend for LLVM"
arch=('i686' 'x86_64')
url="https://llvm.org/"
@@ -47,8 +47,7 @@ source=(${_url}/clang-${pkgver}.src.tar.xz{,.sig}
"0301-LLD-COFF-Error-out-if-creating-a-DLL-with-too-many-e.patch"
"0302-LLD-Allow-configuring-default-ld.lld-backend.patch"
"0303-LLD-Ignore-ELF-tests-when-ld.lld-defaults-to-MinGW.patch"
"0304-ignore-new-bfd-options.patch"
"0305-Msysize.patch")
"0304-ignore-new-bfd-options.patch")
# Some patch notes :)
#0001-0099 -> llvm
#0101-0199 -> clang
@@ -63,19 +62,18 @@ sha256sums=('0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209'
'1f318c0370357fdf9c54ae6d31bad761b0caa58ac099998937b636309ecb6590'
'33400d16d5f6671a8fd60345c3ae44b9777a7d600061957889d14305eb2ad709'
'1c9efccd40a0e7834c3aa9d819aa25cfdd2cec389d1bd3e8a89bc9ff670a0129'
'462fb587e613c46948f7bc040e3523ae2fb0959b70ea0e18f10e4988ba36113c'
'b4983f1ebcaa7da0f1d010652ecd0972dc9f91ed02595ad913f582f830cdfeda'
'fb37e32d843c817aaa57a15f2f65014c38eb80bfe2af7b84fe5c6f356eea836a'
'ddc43bc16f5edaf5290adabd71ce6a8a593fc3f824d7d99acd247bcce88aaf03'
'01b029f2a21bd998ce374a90d41d214c891dfbb611dfbd9ca147517cd2c228ea'
'a60f7328d84628a56a9f626e4dc26ffd0c35292c79eeba62ac3d4f25aef2fe5c'
'0098da33ce4cfea2a6b6943c15e769345f89b84ebea28facff4cc8b92a17bc8f'
'865706f9816bfa5abaa648cf7f14e2350bc384ae01109ba821bc9296f7851b39'
'937c2293e85b2199cf2c85c9e76a52143d032c06dc5eebe44062ad9f7426c903'
'2189f1e4bb90d11111ebf0d22a1f6f6f7cb05d69617cae9b21e9f1e195ebd8c1'
'0b996f438f7c7bf42c789729dfd588a65d5016386e7032e03e8cd52f1dc8bc73'
'c74c313e442a5b8fed7c6372ac8ff8f3598c9e33db1b520f1297949e18042e55'
'2e1705274dfc55466cc8977e61d569a685e18ce07895cbec2ccf3b848eafd8ee'
'778e0db0a5b0657ab05e2a81d83241347a4a41af2b0f9903422f651fa58e8d40'
'b2b5fd8b23710d172082df92c4d44dc31eb948cb34d325c106dde22d8d559d01')
'778e0db0a5b0657ab05e2a81d83241347a4a41af2b0f9903422f651fa58e8d40')
validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D' # Hans Wennborg, Google.
'474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard
noextract=(clang-${pkgver}.src.tar.xz)
@@ -116,8 +114,7 @@ prepare() {
"0301-LLD-COFF-Error-out-if-creating-a-DLL-with-too-many-e.patch" \
"0302-LLD-Allow-configuring-default-ld.lld-backend.patch" \
"0303-LLD-Ignore-ELF-tests-when-ld.lld-defaults-to-MinGW.patch" \
"0304-ignore-new-bfd-options.patch" \
"0305-Msysize.patch"
"0304-ignore-new-bfd-options.patch"
cd "${srcdir}"
rm -rf clang lld | true